public class DiagramController extends Object implements com.orange.links.client.event.NewFunctionEvent.HasNewFunctionHandlers, com.orange.links.client.event.TieLinkEvent.HasTieLinkHandlers, com.orange.links.client.event.UntieLinkEvent.HasUntieLinkHandlers, com.orange.links.client.event.ChangeOnDiagramEvent.HasChangeOnDiagramHandlers, com.orange.links.client.menu.HasContextMenu
Modifier and Type | Field and Description |
---|---|
boolean |
inDragBuildArrow |
boolean |
inDragMovablePoint |
boolean |
inDragWidget |
boolean |
inEditionDragMovablePoint |
boolean |
inEditionSelectableShapeToDrawConnection |
static int |
minDistanceToSegment
If the distance between the mouse and segment is under this number in
pixels, then, the mouse is considered over the segment
|
static int |
refreshRate
Timer refresh duration, in milliseconds.
|
Constructor and Description |
---|
DiagramController(int canvasWidth,
int canvasHeight)
Initialize the controller diagram.
|
Modifier and Type | Method and Description |
---|---|
com.google.gwt.event.shared.HandlerRegistration |
addChangeOnDiagramHandler(com.orange.links.client.event.ChangeOnDiagramHandler handler) |
void |
addDecoration(com.google.gwt.user.client.ui.Widget decoration,
com.orange.links.client.connection.Connection decoratedConnection)
Add a widget as a decoration on a connection
|
com.google.gwt.event.shared.HandlerRegistration |
addNewFunctionHandler(com.orange.links.client.event.NewFunctionHandler handler) |
void |
addPointOnConnection(com.orange.links.client.connection.Connection c,
int left,
int top)
Add an segment on a path by adding a point on the connection
|
com.google.gwt.event.shared.HandlerRegistration |
addTieLinkHandler(com.orange.links.client.event.TieLinkHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addUntieLinkHandler(com.orange.links.client.event.UntieLinkHandler handler) |
FunctionShape |
addWidget(com.google.gwt.user.client.ui.Widget w,
int left,
int top)
Add a widget on the diagram
|
FunctionShape |
addWidgetAtMousePoint(com.google.gwt.user.client.ui.Widget w) |
void |
clearDiagram()
Clear the diagram (connections and widgets)
|
void |
deleteConnection(com.orange.links.client.connection.Connection c) |
void |
deleteWidget(com.google.gwt.user.client.ui.Widget widget) |
<C extends com.orange.links.client.connection.Connection> |
drawConnection(com.orange.links.client.connection.ConnectionFactory<C> cf,
com.orange.links.client.shapes.Shape start,
com.orange.links.client.shapes.Shape end) |
com.orange.links.client.connection.Connection |
drawStraightArrowConnection(com.google.gwt.user.client.ui.Widget startWidget,
com.google.gwt.user.client.ui.Widget endWidget,
GUITransition transition) |
com.orange.links.client.connection.Connection |
drawStraightArrowConnection(com.google.gwt.user.client.ui.Widget startWidget,
com.google.gwt.user.client.ui.Widget endWidget,
String name)
Draw a straight connection with an arrow between two GWT widgets.
|
com.orange.links.client.connection.Connection |
drawStraightConnection(com.google.gwt.user.client.ui.Widget startWidget,
com.google.gwt.user.client.ui.Widget endWidget)
Draw a straight connection between two GWT widgets.
|
String |
exportDiagram() |
void |
fireEvent(com.google.gwt.event.shared.GwtEvent<?> event) |
int |
getCanvasHeight() |
int |
getCanvasWidth() |
com.orange.links.client.menu.ContextMenu |
getContextMenu() |
com.orange.links.client.canvas.DiagramCanvas |
getDiagramCanvas()
Get the diagram canvas
|
com.orange.links.client.save.DiagramModel |
getDiagramModel() |
long |
getFps() |
Map<com.google.gwt.user.client.ui.Widget,Map<com.google.gwt.user.client.ui.Widget,com.orange.links.client.connection.Connection>> |
getFunctionsMap() |
com.orange.links.client.shapes.Point |
getMousePoint() |
com.orange.links.client.shapes.DrawableSet<FunctionShape> |
getShapes() |
com.orange.links.client.shapes.DrawableSet<com.orange.links.client.connection.Connection> |
getUnsynchronizedConnections() |
com.google.gwt.user.client.ui.AbsolutePanel |
getView() |
com.google.gwt.user.client.ui.ScrollPanel |
getViewAsScrollPanel() |
void |
importDiagram(String diagramXmlExport,
com.orange.links.client.save.DiagramWidgetFactory saveFactory) |
protected void |
initMenu() |
protected void |
initMouseHandlers(com.orange.links.client.canvas.DiagramCanvas canvas) |
protected void |
initWidgetPanel(com.orange.links.client.canvas.DiagramCanvas canvas) |
boolean |
isShowGrid() |
void |
makeDraggable(com.smartgwt.client.widgets.Canvas widget)
OUR personalization to allow dragging into SmartGWT
|
void |
pauseRefresh() |
protected void |
redrawConnections()
If any connections need to be redrawn, clear the canvas and redraw all
lines.
|
void |
registerDragController(com.allen_sauer.gwt.dnd.client.DragController dragController)
Register a drag controller to control the refresh rate
|
protected void |
registerDragHandler(FunctionShape shape) |
void |
removeDecoration(com.orange.links.client.connection.Connection decoratedConnection)
Remove a decoration from the diagram
|
void |
runRefresh() |
void |
setFrameSize(int width,
int height) |
void |
showGrid(boolean showGrid)
Change the background of the canvas by displaying or not a gray grid.
|
void |
synchronizedShapes() |
void |
unsynchronizedShapes() |
void |
update() |
public static int minDistanceToSegment
public static int refreshRate
public boolean inEditionDragMovablePoint
public boolean inEditionSelectableShapeToDrawConnection
public boolean inDragBuildArrow
public boolean inDragMovablePoint
public boolean inDragWidget
public DiagramController(int canvasWidth, int canvasHeight)
DiagramController controller = new DiagramController(400,400);
RootPanel.get().add(controller.getView());
protected void initMouseHandlers(com.orange.links.client.canvas.DiagramCanvas canvas)
protected void initWidgetPanel(com.orange.links.client.canvas.DiagramCanvas canvas)
protected void initMenu()
public com.orange.links.client.menu.ContextMenu getContextMenu()
getContextMenu
in interface com.orange.links.client.menu.HasContextMenu
public void pauseRefresh()
public void runRefresh()
public void clearDiagram()
public com.orange.links.client.connection.Connection drawStraightArrowConnection(com.google.gwt.user.client.ui.Widget startWidget, com.google.gwt.user.client.ui.Widget endWidget, String name)
startWidget
- Start widgetendWidget
- End Widgetpublic com.orange.links.client.connection.Connection drawStraightArrowConnection(com.google.gwt.user.client.ui.Widget startWidget, com.google.gwt.user.client.ui.Widget endWidget, GUITransition transition)
public <C extends com.orange.links.client.connection.Connection> C drawConnection(com.orange.links.client.connection.ConnectionFactory<C> cf, com.orange.links.client.shapes.Shape start, com.orange.links.client.shapes.Shape end)
public com.orange.links.client.connection.Connection drawStraightConnection(com.google.gwt.user.client.ui.Widget startWidget, com.google.gwt.user.client.ui.Widget endWidget)
startWidget
- Start widgetendWidget
- End Widgetpublic FunctionShape addWidget(com.google.gwt.user.client.ui.Widget w, int left, int top)
w
- the widget to addleft
- left margin with the absolute paneltop
- top margin with the absolute panelpublic FunctionShape addWidgetAtMousePoint(com.google.gwt.user.client.ui.Widget w)
public void addDecoration(com.google.gwt.user.client.ui.Widget decoration, com.orange.links.client.connection.Connection decoratedConnection)
decoration
- widget that will be in the middle of the connectiondecoratedConnection
- the connection where the decoration will be
putpublic void removeDecoration(com.orange.links.client.connection.Connection decoratedConnection)
decoratedConnection
- connection where the decoration will be
deletedpublic void addPointOnConnection(com.orange.links.client.connection.Connection c, int left, int top)
c
- the connection where the point will be addedleft
- Left margin in pixelstop
- Top margin in pixelspublic void showGrid(boolean showGrid)
showGrid
- if true, show a grid, else don'tpublic com.orange.links.client.canvas.DiagramCanvas getDiagramCanvas()
public com.google.gwt.user.client.ui.AbsolutePanel getView()
public void setFrameSize(int width, int height)
public com.google.gwt.user.client.ui.ScrollPanel getViewAsScrollPanel()
public void makeDraggable(com.smartgwt.client.widgets.Canvas widget)
public void registerDragController(com.allen_sauer.gwt.dnd.client.DragController dragController)
dragController
- The DragController used to handle the drags on
widgetsprotected void registerDragHandler(FunctionShape shape)
public void unsynchronizedShapes()
public void synchronizedShapes()
public void fireEvent(com.google.gwt.event.shared.GwtEvent<?> event)
fireEvent
in interface com.google.gwt.event.shared.HasHandlers
public com.google.gwt.event.shared.HandlerRegistration addUntieLinkHandler(com.orange.links.client.event.UntieLinkHandler handler)
addUntieLinkHandler
in interface com.orange.links.client.event.UntieLinkEvent.HasUntieLinkHandlers
public com.google.gwt.event.shared.HandlerRegistration addTieLinkHandler(com.orange.links.client.event.TieLinkHandler handler)
addTieLinkHandler
in interface com.orange.links.client.event.TieLinkEvent.HasTieLinkHandlers
public com.google.gwt.event.shared.HandlerRegistration addChangeOnDiagramHandler(com.orange.links.client.event.ChangeOnDiagramHandler handler)
addChangeOnDiagramHandler
in interface com.orange.links.client.event.ChangeOnDiagramEvent.HasChangeOnDiagramHandlers
public com.google.gwt.event.shared.HandlerRegistration addNewFunctionHandler(com.orange.links.client.event.NewFunctionHandler handler)
addNewFunctionHandler
in interface com.orange.links.client.event.NewFunctionEvent.HasNewFunctionHandlers
public boolean isShowGrid()
public void update()
protected void redrawConnections()
public void deleteConnection(com.orange.links.client.connection.Connection c)
public void deleteWidget(com.google.gwt.user.client.ui.Widget widget)
public com.orange.links.client.shapes.Point getMousePoint()
public int getCanvasWidth()
public int getCanvasHeight()
public long getFps()
public com.orange.links.client.shapes.DrawableSet<com.orange.links.client.connection.Connection> getUnsynchronizedConnections()
public com.orange.links.client.save.DiagramModel getDiagramModel()
public String exportDiagram()
public void importDiagram(String diagramXmlExport, com.orange.links.client.save.DiagramWidgetFactory saveFactory)
public com.orange.links.client.shapes.DrawableSet<FunctionShape> getShapes()
Copyright © 2008-2014 Logical Objects. All Rights Reserved.