public class IlvDiagrammer extends JComponent
IlvDiagrammer
is the main class of the Perforce JViews Diagrammer
product. It is the Swing component that lets you display and edit diagrams.
A diagram is a graph containing nodes and (optionally) links between nodes. A diagram is defined by the data that it represents (that is, the set of nodes and links), and by the graphical representation of this data.
The diagram data is described by a data model, similar to the Swing data
models. The data model is represented by the
IlvSDMModel
interface, which defines the set of nodes
and links and their attributes.
Data models can come from different sources such as XML files or databases, or they
can directly represent in-memory application objects. The connection of
the diagram component to these data sources is implemented by the
IlvDiagrammerDataSource
class and
its subclasses.
The graphical representation of the diagram is fully customizable through
style sheets. A style sheet is a text file containing style rules, each
rule defining the graphic objects that represent nodes or links according
to their type and their attributes. Style sheets are set using the
setStyleSheet
method. Diagrammer style sheets use the syntax
of CSS level 2. Here is a short extract of a JViews Diagrammer style sheet:
node.activity { class : "ilog.views.sdm.graphic.IlvGeneralNode"; shapeType : "RoundRectangle"; foreground : "black"; background : "blue"; }
A diagram is described by an instance of the class
IlvDiagrammerProject
. A project
contains a data source configuration and one or more style sheets.
Projects are stored to XML files, usually with an .idpr
suffix.
You set a project through the setProject
method.
Here is an example of code that creates a diagram component and loads a
project file:
IlvDiagrammer diagrammer = new IlvDiagrammer(); diagrammer.setProject( new IlvDiagrammerProject( new URL("file:myproject.idpr")));
The easiest way to create a project file is by using the Designer application. The Designer is an editor that lets you load data from a data source, and then define the style of the nodes and links.
You can also create and customize a diagram through the API. For example, the following code creates a node and adds it to the diagram:
Object town1 = diagrammer.createNode("town"); diagrammer.setObjectProperty(town1, "x", new Double(100)); diagrammer.setObjectProperty(town1, "y", new Double(100)); diagrammer.addObject(town1, null);
IlvDiagrammer
supports editing: you can not only
display diagrams, but also edit them interactively. Predefined actions
are available to create new nodes and links (see
IlvDiagrammerPaletteBar
).
The IlvDiagrammer
class also has a full set of editing methods:
cut
, copy
, paste
,
undo
, redo
, and so on.
To help you develop Swing GUIs around a diagram component, Perforce JViews Diagrammer
provides a set of application components that are ready to connect to an
IlvDiagrammer
instance: toolbars and menus containing predefined
Swing actions to control and edit the diagram, a property sheet, a tree view,
and more. These application components are contained in the
ilog.views.diagrammer.application
package. This package also contains
a ready-to-execute application, IlvDiagrammerApplication
,
that you can use to view your diagrams and do some simple editing.
The IlvDiagrammer
class is a front-end that gives access to
the functionality provided by the underlying JViews packages: the Graphic Framework,
the Stylable Data Mapper (SDM), and the Graph Layout package. These underlying
packages can be accessed directly if you need to use advanced features
or if you want to extend the component. For example, the getEngine
method lets you access the SDM engine that handles the mapping from the
data model to the graphic view.
Modifier and Type | Class and Description |
---|---|
static interface |
IlvDiagrammer.PrinterExceptionHandler
This interface is used to pass back exceptions that occur during the asynchronous
printing of a diagram component.
|
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
IlvDiagrammer()
Creates a new, empty
ilog.views.diagrammer.IlvDiagrammer instance. |
IlvDiagrammer(IlvSDMView view)
Creates a new
ilog.views.diagrammer.IlvDiagrammer instance
containing an existing SDM view. |
Modifier and Type | Method and Description |
---|---|
void |
addObject(Object nodeOrLink,
Object parentNode)
Adds a node or a link to the diagram.
|
void |
addStyleSheet(URL url)
Adds a style sheet to this diagram component.
|
void |
alignBottom()
Aligns the bottom sides of the selected nodes.
|
void |
alignHorizontalCenter()
Aligns the horizontal centers of the selected nodes.
|
void |
alignLeft()
Aligns the left sides of the selected nodes.
|
void |
alignRight()
Aligns the right sides of the selected nodes.
|
void |
alignTop()
Aligns the top sides of the selected nodes.
|
void |
alignVerticalCenter()
Aligns the vertical centers of the selected nodes.
|
void |
assignProject(IlvDiagrammerProject project)
Sets the current project of diagrammer.
|
boolean |
canAlign()
Returns true if the current selection can be aligned.
|
boolean |
canDistribute()
Returns true if the current selection can be distributed.
|
boolean |
canEdit()
Returns
true if at least one object is selected in the diagram component. |
boolean |
canGroup()
Returns
true if editing is allowed and several objects are selected. |
boolean |
canPaste()
|
boolean |
canPrint()
Returns
true if the diagram component can be printed, that is,
if the diagram is not empty. |
boolean |
canRedo()
Returns
true if a change can be redone. |
boolean |
canResetZoom()
Returns
true if the view is currently zoomed in or out,
or false if the view is at the initial zoom level (1:1). |
boolean |
canSelect()
Returns
true if the diagram component is not empty. |
boolean |
canUndo()
Returns
true if a change can be undone. |
boolean |
canUngroup()
Returns
true if editing is allowed and
at least one group (a node that has children) is selected. |
boolean |
canZoomIn()
Returns
true if the view can be zoomed in, or
false if the maximum zoom factor has been reached. |
boolean |
canZoomOut()
Returns
true if the view can be zoomed out, or
false if the minimum zoom factor has been reached. |
void |
clearAdjusting()
Stop an editing sequence but prevents diagrammer from performing any
computation regarding the changes.
|
void |
clearPrintArea()
Clears the print area for this diagram component.
|
void |
copy()
Copies the selected objects.
|
Object |
createGroupParent()
Creates a parent node for group.
|
Object |
createLink(String tag,
Object sourceNode,
Object targetNode)
Creates a new link in the diagram.
|
Object |
createNode(String tag)
Creates a new node in the diagram.
|
protected JComponent |
createScrollComponent(IlvSDMView view)
Creates the scroll component for the SDM view.
|
protected IlvXMLDataSource |
createXMLDataSource()
Creates an XML data source Factory.
|
void |
cut()
Cuts the selected objects.
|
void |
delete()
Deletes the selected objects.
|
void |
deselectAll()
Deselects all the selected objects in the diagram.
|
void |
distributeHorizontally()
Distributes selected nodes horizontally.
|
void |
distributeVertically()
Distributes selected nodes vertically.
|
void |
duplicate()
Duplicates the selected objects.
|
void |
fitToContents()
Zooms the diagram in or out so that it fits the view size of the
diagram component.
|
void |
fitToContents(boolean delayUntilShowing)
Zooms the diagram in or out so that it fits the view size of the
diagram component.
|
Iterator |
getAllObjects()
Returns all the objects added to the diagram of this diagram component.
|
int |
getBaseTextDirection()
Return default base text direction.
|
Iterator |
getChildren(Object parentNode)
Returns the child objects added to the subgraph represented by the
parentNode . |
static IlvDiagrammer |
getCurrentDiagrammer(Component component)
Returns the current diagram component for the hierarchy that
contains the specified component.
|
URL |
getDataFile()
Returns the URL of the XML file that has been loaded into this diagram component using
setDataFile(java.net.URL) . |
IlvDiagrammerDataSource |
getDataSource()
Returns the current data source of this diagram component.
|
URL |
getDefaultStyleSheet()
Returns the default style sheet URL.
|
IlvEditSDMLabelInteractor |
getEditLabelInteractor()
Returns the interactor used when the diagram component is in edit label mode.
|
IlvSDMEngine |
getEngine()
Returns the SDM engine that is used internally by this diagram component.
|
IlvGrid |
getGrid()
Returns the
IlvGrid object displayed by this diagram component
when setGridVisible(true) is called. |
String |
getID(Object nodeOrLink)
Returns the identifier of a node or a link.
|
double |
getMaximumZoom()
Returns the maximum zoom allowed.
|
double |
getMinimumZoom()
Returns the minimum zoom allowed.
|
Object |
getObject(String id)
Returns the object with the specified identifier, or
null
if no object has this identifier. |
Object |
getObjectProperty(Object nodeOrLink,
String propertyName)
Gets a property of a node or a link of this diagram component.
|
Iterator |
getObjects()
Returns the top-level objects added to the diagram of this diagram component.
|
IlvDiagrammer |
getPalette()
Gets the "palette" for this diagram component.
|
IlvPanInteractor |
getPanInteractor()
Returns the interactor used when the diagram component is in pan mode.
|
Object |
getParent(Object nodeOrLink)
Returns the parent node of a node or a link.
|
IlvManagerPrintingController |
getPrintingController()
Returns the printing controller that handles all the printing-related
tasks for this diagram component.
|
IlvDiagrammerProject |
getProject()
Returns the project currently loaded in this diagram component.
|
JComponent |
getScrollComponent()
Returns the scroll component when the SDM view is scrollable.
|
Iterator |
getSelectedObjects()
Returns the nodes and links that are currently selected in the diagram component.
|
IlvSelectInteractor |
getSelectInteractor()
Returns the interactor used when the diagram component is in select mode.
|
Object |
getSourceNode(Object link)
Returns the source node of the specified link.
|
URL |
getStyleSheet()
Returns the URL of the style sheet used by this diagram component to render the diagram.
|
URL[] |
getStyleSheets()
Returns all the style sheets of this diagram component.
|
String |
getTag(Object nodeOrLink)
Returns the tag of a node or a link, that is, the String
that was passed to
createNode(java.lang.String) or createLink(java.lang.String, java.lang.Object, java.lang.Object) to
create the object. |
Object |
getTargetNode(Object link)
Returns the target node of the specified link.
|
IlvSDMUndoManager |
getUndoManager()
Returns the undo manager of this diagrammer.
|
IlvSDMView |
getView()
Returns the SDM view that is used internally by this diagram component.
|
double |
getZoomFactor()
|
IlvZoomViewInteractor |
getZoomInteractor()
Returns the interactor used when the diagram component is in zoom mode.
|
void |
group()
Groups the selected objects into a subgraph.
|
boolean |
hasFrameOrDialogAncestor()
Returns
true if this diagram component is contained in a Frame or a Dialog ancestor. |
boolean |
isAdjusting()
Returns
true if the diagram component
is currently in an editing sequence. |
boolean |
isAutoEditLabel()
Returns
true if this diagram component switches automatically to
label editing mode when a new node is created interactively. |
static boolean |
isAutomaticCurrentDiagrammer()
Returns
true if the automatic handling of the current diagram
component is enabled. |
boolean |
isAutomaticLabelLayout()
Returns
true if the labels in the diagram are
laid out automatically whenever the diagram is modified. |
boolean |
isAutomaticLinkLayout()
Returns
true if the links in the diagram are
laid out automatically whenever the diagram is modified. |
boolean |
isAutomaticNodeLayout()
Returns
true if the nodes in the diagram are
laid out automatically whenever the diagram is modified. |
boolean |
isEditable()
Returns
true if the data model of this diagram component
supports editing. |
boolean |
isEditingAllowed()
Returns
true if the nodes in the diagram
can be edited, or false if the nodes cannot be edited. |
boolean |
isEditLabelMode()
Returns
true if label editing is currently enabled. |
boolean |
isEmpty()
Tests if the diagrammer is empty.
|
boolean |
isGridVisible()
Returns
true if the grid of the diagram component is currently
visible. |
boolean |
isLabelLayoutAvailable()
Returns
true if label layout is available for this diagram component,
that is, if the style sheets contain the configuration of a label layout
algorithm. |
boolean |
isLink(Object nodeOrLink)
Returns
true if the specified object is a link, or
false if the object is a node. |
boolean |
isLinkLayoutAvailable()
Returns
true if link layout is available for this diagram component,
that is, if the style sheet contains the configuration of a link layout
algorithm. |
boolean |
isModified()
Returns
true if the diagram has been modified since
the last open or save operation. |
boolean |
isNodeLayoutAvailable()
Returns
true if node layout is available for this diagram component,
that is, if the style sheet contains the configuration of a node layout
algorithm, and if editing is allowed in this diagram component. |
boolean |
isPanMode()
Returns
true if panning is currently enabled. |
boolean |
isResizingAllowed()
Returns
true if the user is allowed to resize nodes
interactively. |
boolean |
isScrollable()
Returns
true if this diagram component allows scrolling or false
otherwise. |
boolean |
isSelected(Object nodeOrLink)
Returns
true if the specified node or link is currently selected
in the diagram component, or false if the object is not selected. |
boolean |
isSelectMode()
Returns
true if the selection of nodes and links in the diagram
is allowed, or false if selection is not allowed. |
boolean |
isStickyModes()
Returns the "sticky modes" flag of the diagram component.
|
boolean |
isStyleApplicationComponents()
Specifies whether styling is enabled for the application components
(
IlvDiagrammerTree ,
(IlvDiagrammerPropertySheet ,
(IlvDiagrammerTable ,
(IlvDiagrammerOverview ,
(IlvDiagrammerStatusBar )
associated with this diagram component. |
boolean |
isZoomMode()
Returns
true if zooming is currently enabled. |
void |
layoutAllNodes()
Performs a layout of all the nodes in the diagram.
|
void |
layoutLabels()
Performs a layout of the labels in the diagram.
|
void |
layoutLinks()
Performs a layout of the links in the diagram.
|
void |
layoutSelectedNodes()
Performs a layout of the selected nodes in the diagram only.
|
void |
pageSetup()
Displays a page setup dialog for this diagram component.
|
void |
paste()
Pastes the selected objects.
|
void |
print(boolean showPrintDialog,
boolean asynchronous,
IlvDiagrammer.PrinterExceptionHandler exceptionHandler)
Prints this diagram component according to the page setup parameters and the print area.
|
void |
printPreview()
Displays a print preview dialog for this diagram component.
|
void |
printToBitmap(File file)
Prints this diagram component to a bitmap file, according to the page setup
parameters and the print area.
|
boolean |
processServerAction(int x,
int y)
This method can be called when the diagram component is used on the
server-side of a web application, to process an action sent by the client-side.
|
void |
redo()
Redoes the last change in the diagram component.
|
void |
refresh()
Refreshes the diagram.
|
void |
removeObject(Object nodeOrLink)
Removes a node or a link from the diagram.
|
void |
removeStyleSheet(URL url)
Removes a style sheet from this diagram component.
|
void |
resetZoom()
Resets the zoom of the diagram component to 1:1.
|
void |
scrollToObject(Object object)
Makes sure that the specified object is visible in this diagram component.
|
void |
selectAll()
Selects all the objects in the diagram.
|
void |
setAdjusting(boolean adjusting)
Starts or stops an editing sequence.
|
void |
setAllSelectedObjects(Collection nodesAndLinks)
Selects the objects given as arguments, and deselects all other objects in
the diagram.
|
static void |
setAsRoot(Component component)
Defines the supplied component as the root component of a hierarchy
with a diagrammer component.
|
void |
setAutoEditLabel(boolean autoEditLabel)
Enables or disables automatic label editing when a new node is created in this
diagram component.
|
static void |
setAutomaticCurrentDiagrammer(boolean automatic)
Enables or disables the automatic handling of the current diagram
component for each Swing hierarchy.
|
void |
setAutomaticLabelLayout(boolean enabled)
Enables or disables the automatic layout of labels.
|
void |
setAutomaticLinkLayout(boolean enabled)
Enables or disables the automatic layout of links.
|
void |
setAutomaticNodeLayout(boolean enabled)
Enables or disables the automatic layout of nodes.
|
void |
setBaseTextDirection(int baseTextDirection)
Set default base text direction of Diagrammer.
|
void |
setBaseTextDirection(int baseTextDirection,
boolean redraw)
Set default base text direction of Diagrammer.
|
static void |
setCurrentDiagrammer(Component component,
IlvDiagrammer diagrammer)
Sets the current diagram component for the hierarchy that
contains the specified component.
|
static void |
setCurrentDiagrammer(Component component,
IlvDiagrammer diagrammer,
boolean findCommonAncestor)
Sets the current diagram component for the hierarchy that
contains the specified component.
|
void |
setDataFile(URL url)
Loads the contents of the specified XML file into this diagram component.
|
void |
setDataSource(IlvDiagrammerDataSource dataSource)
Sets the data source of this diagram component.
|
void |
setEditingAllowed(boolean editingAllowed)
Allows or forbids the modifying (move, cut, copy, paste, and so on)
of the nodes and links in the diagram.
|
void |
setEditLabelInteractor(IlvEditSDMLabelInteractor editLabelInteractor)
Changes the interactor used when the diagram component is in edit label mode.
|
void |
setEditLabelMode(boolean editLabel)
Enables or disables label editing.
|
void |
setGrid(IlvGrid grid)
Changes the
IlvGrid object displayed by this diagram component
when setGridVisible(true) is called. |
void |
setGridVisible(boolean visible)
Shows or hides the grid of the diagram component.
|
void |
setGroupParent(IlvDiagrammer sourceDiagrammer,
Object sourceParent)
Sets the prototype of the object that will be used by the
group() method
as a model to create the parent of the new group. |
void |
setID(Object nodeOrLink,
String id)
Sets the identifier of a node or a link.
|
void |
setMaximumZoom(double maximumZoom)
Changes the maximum zoom allowed.
|
void |
setMinimumZoom(double minimumZoom)
Changes the minimum zoom allowed.
|
void |
setModified(boolean modified)
Sets the "modified" flag.
|
void |
setObjectProperty(Object nodeOrLink,
String propertyName,
Object propertyValue)
Sets a property of a node or a link of this diagram component.
|
void |
setPalette(IlvDiagrammer palette)
Sets the "palette bar" for this diagram component.
|
void |
setPanInteractor(IlvPanInteractor panInteractor)
Changes the interactor used when the diagram component is in pan mode.
|
void |
setPanMode(boolean pan)
Enables or disables panning.
|
void |
setPrintArea()
Lets the user define the print area for this diagram component interactively.
|
void |
setPrintingController(IlvManagerPrintingController printingController)
Changes the printing controller that handles all the printing-related
tasks for this diagram component.
|
void |
setProject(IlvDiagrammerProject project)
Loads a project in this diagram component.
|
void |
setProject(IlvDiagrammerProject project,
boolean loadData)
Deprecated.
replaced by
setProject(IlvDiagrammerProject) |
void |
setResizingAllowed(boolean allowed)
Allows or forbids the user to resize nodes interactively.
|
void |
setScrollable(boolean scrollable)
Specifies whether this diagram component should allow scrolling or not.
|
void |
setSelected(Object nodeOrLink,
boolean selected)
Selects or deselects a node or a link in the diagram component.
|
void |
setSelectInteractor(IlvSelectInteractor selectInteractor)
Changes the interactor used when the diagram component is in select mode.
|
void |
setSelectMode(boolean selectMode)
Enables or disables the selection of objects in the diagram.
|
void |
setSourceNode(Object link,
Object node)
Changes the source node of the specified link.
|
void |
setStickyModes(boolean stickyModes)
Specifies whether the operating modes of this diagram component (for example, zoom,
create node/link, and edit label) should be "sticky" or not.
|
void |
setStyleApplicationComponents(boolean styleApplicationComponents)
Specifies whether styling is enabled or disabled for the application
components associated with this diagram component:
IlvDiagrammerTree ,
IlvDiagrammerPropertySheet ,
IlvDiagrammerTable . |
void |
setStyleSheet(URL url)
Sets the URL of the style sheet used by this diagram component to render the graph.
|
void |
setTargetNode(Object link,
Object node)
Changes the target node of the specified link.
|
void |
setZoomFactor(double zoomFactor)
|
void |
setZoomInteractor(IlvZoomViewInteractor zoomInteractor)
Changes the interactor used when the diagram component is in zoom mode.
|
void |
setZoomMode(boolean zoom)
Enables or disables zooming.
|
void |
undo()
Undoes the last change in the diagram component.
|
void |
ungroup()
Ungroups the selected groups.
|
void |
writeData()
Writes the diagram to the current data source.
|
void |
writeDataFile(String filename)
Writes the current diagram to a data file.
|
void |
writeDataFile(URL url)
Writes the current diagram to the specified data URL.
|
void |
writeProjectFile(URL projectURL)
Writes the diagrammer project file to the specified URL.
|
void |
zoomIn()
Zooms the diagram component view in (using the zoom factor specified by
setZoomFactor(double) ). |
void |
zoomOut()
Zooms the diagram component view out (using the inverse of the zoom factor specified by
setZoomFactor(double) ). |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public IlvDiagrammer()
ilog.views.diagrammer.IlvDiagrammer
instance.public IlvDiagrammer(IlvSDMView view)
ilog.views.diagrammer.IlvDiagrammer
instance
containing an existing SDM view.view
- The SDM view that the new diagram component will contain.public URL getDefaultStyleSheet()
public void setScrollable(boolean scrollable)
scrollable
- If true
, the diagram component displays scroll bars
to allow the user to scroll the diagram. If false
, no scroll bars
are displayed.public boolean isScrollable()
true
if this diagram component allows scrolling or false
otherwise.public void setStyleSheet(URL url) throws IOException, IlvDiagrammerException
A style sheet contains style rules that specify how the diagram must be rendered.
url
- The URL of the style sheet.IOException
- If an I/O error occurred while reading the style sheet.IlvDiagrammerException
- If an error occurred while processing the style sheet.public URL getStyleSheet()
public void addStyleSheet(URL url) throws IOException, IlvDiagrammerException
Style sheets can be cascaded, which means that several style sheets can be applied. This method adds a style sheet to the set of style sheets already applied to this diagram component.
If the diagram component already contains this style sheet, it is not added again.
url
- The URL of the new style sheet.IOException
- If an I/O error occurred while reading the style sheet.IlvDiagrammerException
- If an error occurred while processing the style sheet.public void removeStyleSheet(URL url) throws IOException, IlvDiagrammerException
url
- The URL of the style sheet to remove.IOException
- If an I/O error occurred while reading the style sheet.IlvDiagrammerException
- If an error occurred while processing the style sheet.addStyleSheet(java.net.URL)
public URL[] getStyleSheets()
setStyleSheet(java.net.URL)
, plus the cascading style sheets added through
addStyleSheet(java.net.URL)
.public boolean isStyleApplicationComponents()
IlvDiagrammerTree
,
(IlvDiagrammerPropertySheet
,
(IlvDiagrammerTable
,
(IlvDiagrammerOverview
,
(IlvDiagrammerStatusBar
)
associated with this diagram component. When styling is enabled, application
components can be customized very easily through the style
sheet without coding.
Here is an example of style rules that can be used to style the Diagrammer application components:
Diagrammer { styleApplicationComponents : "true"; // enable styling on application components } DiagrammerTree { rootLabel : "My Graph"; // set label of root item in tree } node:DiagrammerTree { text : "@name"; // use "name" property as label of items in tree } node:DiagrammerPropertySheet:type { editable : "false"; // set "type" property for all nodes read-only } node.activity:DiagrammerTable { background : "yellow"; // set yellow background for "activity" nodes in table }See the user documentation of Diagrammer for a complete list of styling options available for the application components.
true
if styling of the application components is enabled.public void setStyleApplicationComponents(boolean styleApplicationComponents)
IlvDiagrammerTree
,
IlvDiagrammerPropertySheet
,
IlvDiagrammerTable
.
By default, styling of application components is disabled.
styleApplicationComponents
- If true
, styling of the
application components is enabled, otherwise styling is disabled.public void setDataFile(URL url) throws IOException, IlvDiagrammerException
The diagram component accepts two kinds of XML file:
.idpr
suffix).
IlvXMLConnector
.
url
- The URL of the data file.IOException
IlvDiagrammerException
setProject(IlvDiagrammerProject)
public URL getDataFile()
setDataFile(java.net.URL)
.public void writeProjectFile(URL projectURL) throws IlvDiagrammerException
projectURL
- the project URL.IlvDiagrammerException
- If exception occurred while writing the diagram.public void writeDataFile(URL url) throws IlvDiagrammerException
If the current data source is an XML data source, the data source will be modified to point to the new URL, and the data in the diagram component will be written to the new file. Otherwise, the data source of the diagram component will be replaced by an XML data source pointing to the specified URL.
url
- The URL to write the data to.IlvDiagrammerException
- If any other exception occurred while writing the diagram.public void writeDataFile(String filename) throws IOException, IlvDiagrammerException
writeDataFile(java.net.URL)
.filename
- The file to write the data to.IOException
- If an I/O exception occurred while writing the diagram.IlvDiagrammerException
- If any other exception occurred while writing the diagram.public void writeData() throws IlvDiagrammerException
IlvDiagrammerException
- If any other exception occurred while writing the diagram.setDataFile(java.net.URL)
,
setProject(IlvDiagrammerProject)
public void setDataSource(IlvDiagrammerDataSource dataSource) throws IlvDiagrammerException, IOException
dataSource
- The new data source.IOException
- If an I/O exception occurred while reading the data.IlvDiagrammerException
- If any other exception occurred while rendering the data.public IlvDiagrammerDataSource getDataSource()
public IlvDiagrammerProject getProject()
setProject(IlvDiagrammerProject)
public void setProject(IlvDiagrammerProject project) throws IOException, IlvDiagrammerException
setDataFile(java.net.URL)
.project
- The project to load.IOException
- If an I/O error occurred while reading the data or style.IlvDiagrammerException
- If an error occurred while rendering the diagram.IlvDiagrammerProject
@Deprecated public void setProject(IlvDiagrammerProject project, boolean loadData) throws IOException, IlvDiagrammerException
setProject(IlvDiagrammerProject)
setDataFile(java.net.URL)
.project
- The project to load.loadData
- If true
, the project's data source and style sheet
are loaded into the diagram component and a new diagram is rendered.IOException
- If an I/O error occurred while reading the data or style.IlvDiagrammerException
- If an error occurred while rendering the diagram.IlvDiagrammerProject
public void assignProject(IlvDiagrammerProject project)
setProject(IlvDiagrammerProject)
this method doesn't read the content of the project. It is used for new document, to
initialize the data source were the project will be savedproject
- the new projectpublic void refresh() throws IlvDiagrammerException, IOException
IlvDiagrammerException
- when a diagrammer exception occursIOException
- when a IO exception occurspublic Object createNode(String tag)
addObject(java.lang.Object, java.lang.Object)
.tag
- The tag (type) of the new node.public Object createLink(String tag, Object sourceNode, Object targetNode)
addObject(java.lang.Object, java.lang.Object)
.tag
- The tag (type) of the new link.sourceNode
- The source node of the link.targetNode
- The target node of the link.public String getTag(Object nodeOrLink)
createNode(java.lang.String)
or createLink(java.lang.String, java.lang.Object, java.lang.Object)
to
create the object.nodeOrLink
- A node or a link of the diagram.public String getID(Object nodeOrLink)
nodeOrLink
- A node or a link of the diagram.public void setID(Object nodeOrLink, String id)
nodeOrLink
- A node or a link of the diagram.id
- The new identifier.public Object getObject(String id)
null
if no object has this identifier.id
- The identifier of the object.public void addObject(Object nodeOrLink, Object parentNode)
nodeOrLink
- The node or link to add to the diagram. This is an object
that has been created using the createNode(java.lang.String)
or createLink(java.lang.String, java.lang.Object, java.lang.Object)
method.parentNode
- The parent node to which the new node or link should be added.
Pass null
to add the new object at the top level. Passing a non-null parent
will add the new node or link to the subgraph representing the parent.public void removeObject(Object nodeOrLink)
nodeOrLink
- The node or link to remove from the diagram. This is an object
that has been created using the createNode(java.lang.String)
or createLink(java.lang.String, java.lang.Object, java.lang.Object)
method, and added using addObject(java.lang.Object, java.lang.Object)
.public void setObjectProperty(Object nodeOrLink, String propertyName, Object propertyValue)
nodeOrLink
- The node or link. This is an object
that has been created using the createNode(java.lang.String)
or createLink(java.lang.String, java.lang.Object, java.lang.Object)
method.propertyName
- The name of the property.propertyValue
- The new value of the property. Pass null
to remove
the property.public Object getObjectProperty(Object nodeOrLink, String propertyName)
nodeOrLink
- The node or link. This is an object
that has been created using the createNode(java.lang.String)
or createLink(java.lang.String, java.lang.Object, java.lang.Object)
method.propertyName
- The name of the property.null
if the property
has never been set.public Iterator getObjects()
The objects that have been created using createNode(java.lang.String)
or createLink(java.lang.String, java.lang.Object, java.lang.Object)
but that have not yet been added using addObject(java.lang.Object, java.lang.Object)
, or that have been removed
using removeObject(java.lang.Object)
, are not returned.
The objects that have been added to a subgraph (by passing a non-null parent
to addObject(java.lang.Object, java.lang.Object)
) are not returned: they can be obtained by calling getChildren(java.lang.Object)
.
remove
operation.public Iterator getAllObjects()
The objects that have been created using createNode(java.lang.String)
or createLink(java.lang.String, java.lang.Object, java.lang.Object)
but that have not yet been added using addObject(java.lang.Object, java.lang.Object)
, or that have been removed
using removeObject(java.lang.Object)
, are not returned.
The objects that have been added to a subgraph (by passing a non-null parent
to addObject(java.lang.Object, java.lang.Object)
) are also returned. This iterator does not support the
remove
operation.
public Iterator getChildren(Object parentNode)
parentNode
.
The objects that have been created using createNode(java.lang.String)
or createLink(java.lang.String, java.lang.Object, java.lang.Object)
but that have not yet been added using addObject(java.lang.Object, java.lang.Object)
, or that have been removed
using removeObject(java.lang.Object)
, are not returned.
Only the objects that have been added to the specified subgraph (by passing parentNode
to addObject(java.lang.Object, java.lang.Object)
) are returned.
parentNode
- the noderemove
operation.public Object getParent(Object nodeOrLink)
parentNode
to addObject(java.lang.Object, java.lang.Object)
),
the parent node is returned. Otherwise, this method returns null
.nodeOrLink
- The parent node, or null
if the node or
link is not contained in a subgraph.public IlvSDMEngine getEngine()
This is an advanced method.
public IlvSDMView getView()
This is an advanced method.
public JComponent getScrollComponent()
null
when the SDM view is not scrollable.
By default, it returns an instance of IlvJScrollManagerView
when the SDM view is scrollable.
This is an advanced method.
createScrollComponent(ilog.views.sdm.IlvSDMView)
protected JComponent createScrollComponent(IlvSDMView view)
IlvJScrollManagerView
This is an advanced method that can be overridden if a different scroll component is required.
getScrollComponent()
public boolean isLink(Object nodeOrLink)
true
if the specified object is a link, or
false
if the object is a node.nodeOrLink
- model objectpublic Object getSourceNode(Object link)
link
- A link in the diagram.public void setSourceNode(Object link, Object node)
link
- A link in the diagram.node
- The new source node of the link.public Object getTargetNode(Object link)
link
- A link in the diagram.public void setTargetNode(Object link, Object node)
link
- A link in the diagram.node
- The new target node of the link.public void setAdjusting(boolean adjusting)
This method is used to tell the diagram component that a sequence of modifications of the diagram should be considered as a whole. The diagram component will then render the changes more efficiently at the end of the editing sequence.
For example, to add several objects to the diagram, you should do the following:
diagrammer.setAdjusting(true); Object town1 = diagrammer.createNode("town"); diagrammer.setObjectProperty(town1, "x", new Double(100)); diagrammer.setObjectProperty(town1, "y", new Double(100)); diagrammer.addObject(town1, null); Object town2 = diagrammer.createNode("town"); diagrammer.setObjectProperty(town2, "x", new Double(200)); diagrammer.setObjectProperty(town2, "y", new Double(200)); diagrammer.addObject(town2, null); ... diagrammer.setAdjusting(false);
Editing sequences can be nested, as long as there is one
setAdjusting(false)
call for each
setAdjusting(true)
call. The editing sequence ends at the
the topmost setAdjusting(false)
call.
adjusting
- If true
,
and if the diagram component was not already in an editing sequence,
a new sequence is started. If false
,
and if this call matches the first setAdjusting(true)
,
then the editing sequence ends, and the diagram component updates the
display.public void clearAdjusting()
setAdjusting(false)
to validate
model changes without spending time refreshing the modified objects.
For example, call this method when the changes do not impact the graphic
representations.setAdjusting(boolean)
public boolean isAdjusting()
true
if the diagram component
is currently in an editing sequence.setAdjusting(boolean)
public void setSelectMode(boolean selectMode)
selectMode
- If true
, the nodes and links of the
diagram can be selected. Otherwise, they cannot be selected.public boolean isSelectMode()
true
if the selection of nodes and links in the diagram
is allowed, or false
if selection is not allowed.public Iterator getSelectedObjects()
remove
operation.setAllSelectedObjects(Collection)
public void setSelected(Object nodeOrLink, boolean selected)
nodeOrLink
- The node or link to select or deselect.selected
- If true
, the node or link is selected, otherwise
it is deselected.public boolean isSelected(Object nodeOrLink)
true
if the specified node or link is currently selected
in the diagram component, or false
if the object is not selected.nodeOrLink
- The node or link to test.public void deselectAll()
public void setAllSelectedObjects(Collection nodesAndLinks)
nodesAndLinks
- A set of noded and/or links.getSelectedObjects()
public void selectAll()
public boolean canSelect()
true
if the diagram component is not empty.public void scrollToObject(Object object)
object
- The object that must be made visible.public void setEditingAllowed(boolean editingAllowed)
Enabling this mode installs the undo manager and wraps the SDM model
into an undoable model. Do not change the SDM model while
isEditingAllowed()
returns true, since this will break the
undo mechanism.
Note that, to edit the diagram, selection must be allowed using
setSelectMode(true)
.
editingAllowed
- If true
, the nodes and links of the
diagram can be modified. Otherwise, they cannot be modified.getUndoManager()
public boolean isEditingAllowed()
true
if the nodes in the diagram
can be edited, or false
if the nodes cannot be edited.setEditingAllowed(boolean)
public boolean isEditable()
true
if the data model of this diagram component
supports editing.public boolean isResizingAllowed()
true
if the user is allowed to resize nodes
interactively.setResizingAllowed(boolean)
public void setResizingAllowed(boolean allowed)
allowed
- If true
, selected nodes have "handles"
that the user can drag to resize them. If false
, selected
nodes have no handles, and the user can only move them.public void cut()
public boolean canEdit()
true
if at least one object is selected in the diagram component.public void copy()
public void paste()
public boolean canPaste()
public void delete()
public void duplicate()
public void undo()
public boolean canUndo()
true
if a change can be undone.public void redo()
public boolean canRedo()
true
if a change can be redone.public boolean isModified()
true
if the diagram has been modified since
the last open or save operation.public void setModified(boolean modified)
modified
parameter is
false
, all undoable edits are discarded.modified
- The new value of the modified flag.public void group()
setGroupParent(ilog.views.diagrammer.IlvDiagrammer, java.lang.Object)
.
If no group parent was specified, the parent will be a new node of
type "group"
. If the data model does not support nodes of
this type, the group operation will fail and a RuntimeException will be
thrown.public Object createGroupParent()
setGroupParent(IlvDiagrammer, Object)
public void setGroupParent(IlvDiagrammer sourceDiagrammer, Object sourceParent)
group()
method
as a model to create the parent of the new group.sourceDiagrammer
- The diagram component in which the sourceParent
appears.sourceParent
- The model that will be used to create group parents.public boolean canGroup()
true
if editing is allowed and several objects are selected.public void ungroup()
public boolean canUngroup()
true
if editing is allowed and
at least one group (a node that has children) is selected.public double getZoomFactor()
public void setZoomFactor(double zoomFactor)
zoomFactor
- The new zoom factor.public double getMinimumZoom()
public void setMinimumZoom(double minimumZoom)
Note that this minimum zoom affects only
the result of canZoomOut()
method. Calling the zoomOut()
method will
always zoom the diagram out even if the minimum zoom is reached.
minimumZoom
- The minimum zoom allowed.public double getMaximumZoom()
public void setMaximumZoom(double maximumZoom)
Note that this maximum zoom affects only
the result of canZoomIn()
method. Calling the zoomIn()
method will
always zoom the diagram in even if the maximum zoom is reached.
maximumZoom
- The maximum zoom allowed.public void zoomIn()
setZoomFactor(double)
).public boolean canZoomIn()
true
if the view can be zoomed in, or
false
if the maximum zoom factor has been reached.setMaximumZoom(double)
public void zoomOut()
setZoomFactor(double)
).public boolean canZoomOut()
true
if the view can be zoomed out, or
false
if the minimum zoom factor has been reached.setMinimumZoom(double)
public void resetZoom()
public boolean canResetZoom()
true
if the view is currently zoomed in or out,
or false
if the view is at the initial zoom level (1:1).public void setZoomMode(boolean zoom)
With zooming enabled, the user can drag a rectangle to zoom part of the view only.
zoom
- If true
, zooming is enabled; otherwise zooming is disabled.public boolean isZoomMode()
true
if zooming is currently enabled.public void setPanMode(boolean pan)
With zooming enabled, the user can drag click and drag the mouse to translate the view.
pan
- If true
, panning is enabled; otherwise panning is disabled.public boolean isPanMode()
true
if panning is currently enabled.public void fitToContents()
IlvManagerView.fitTransformerToContent(Insets, int)
for details.
This method computes the zoom factor based on the size of the diagrammer
view. Therefore, if the diagrammer is not visible, the method does nothing.
See fitToContents(boolean)
if you want to call this operation
before the diagrammer is visible.public void fitToContents(boolean delayUntilShowing)
IlvManagerView.fitTransformerToContent(Insets, int, boolean)
for details.
This method can be called when the diagrammer view is not yet showing
or visible (see Component.isShowing()
). If the view is
not yet showing but the parameter delayUntilShowing
is
true
, it waits until the view becomes showing before
doing the operation. This ensures that the transformer will be adapted to
the effective size of the showing view even when called at a
nonshowing view.
delayUntilShowing
- If true
and the view is not yet
showing, it waits until the view becomes showing and then
fits the transformer to the size. If false
or if the view
is already showing, it fits the transformer immediately to the size.public void setEditLabelMode(boolean editLabel)
With label editing enabled, the user can click on the label of a node or a link in diagram to edit its label in place.
editLabel
- If true
, label editing is enabled,
otherwise label editing is disabled.public boolean isEditLabelMode()
true
if label editing is currently enabled.public boolean isAutoEditLabel()
true
if this diagram component switches automatically to
label editing mode when a new node is created interactively.setAutoEditLabel(boolean)
public void setAutoEditLabel(boolean autoEditLabel)
autoEditLabel
- If true
, the diagram component will switch automatically to
label editing mode when a new node is created interactively (for
example, from a palette toolbar).setEditLabelMode(boolean)
public void setAutomaticNodeLayout(boolean enabled)
enabled
- If true
, the nodes of the diagram are
laid out automatically whenever the diagram is modified. If false
,
the nodes are not laid out automatically, but they can be laid out explicitly
by calling layoutAllNodes()
.
This method has no effect if node layout is not available.isNodeLayoutAvailable()
public boolean isAutomaticNodeLayout()
true
if the nodes in the diagram are
laid out automatically whenever the diagram is modified.setAutomaticNodeLayout(boolean)
public void layoutAllNodes()
public void layoutSelectedNodes()
public boolean isNodeLayoutAvailable()
true
if node layout is available for this diagram component,
that is, if the style sheet contains the configuration of a node layout
algorithm, and if editing is allowed in this diagram component.public void setAutomaticLinkLayout(boolean enabled)
enabled
- If true
, the links in the diagram are
laid out automatically whenever the diagram is modified. If false
,
the links are not laid out automatically, but they can be laid out explicitly
by calling layoutLinks()
.
This method has no effect if link layout is not available.isLinkLayoutAvailable()
public boolean isAutomaticLinkLayout()
true
if the links in the diagram are
laid out automatically whenever the diagram is modified.setAutomaticLinkLayout(boolean)
public void layoutLinks()
public boolean isLinkLayoutAvailable()
true
if link layout is available for this diagram component,
that is, if the style sheet contains the configuration of a link layout
algorithm.public void setAutomaticLabelLayout(boolean enabled)
enabled
- If true
, the labels in the diagram are
laid out automatically whenever the diagram is modified. If false
,
the labels are not laid out automatically, but they can be laid out explicitly
by calling layoutLabels()
.
This method has no effect if label layout is not available.isLabelLayoutAvailable()
public boolean isAutomaticLabelLayout()
true
if the labels in the diagram are
laid out automatically whenever the diagram is modified.setAutomaticLabelLayout(boolean)
public void layoutLabels()
public boolean isLabelLayoutAvailable()
true
if label layout is available for this diagram component,
that is, if the style sheets contain the configuration of a label layout
algorithm.public IlvManagerPrintingController getPrintingController()
Typical applications do not need to access the printing controller
directly, since all the printing tasks are handled automatically by
the methods print(boolean, boolean, ilog.views.diagrammer.IlvDiagrammer.PrinterExceptionHandler)
, pageSetup()
and so on.
You need to access the printing controller only if you want to
customize the printing process.
SecurityException
- in applet mode, if the user does not grant
access to the printerprint(boolean, boolean, ilog.views.diagrammer.IlvDiagrammer.PrinterExceptionHandler)
,
pageSetup()
,
printPreview()
,
setPrintArea()
,
clearPrintArea()
,
printToBitmap(java.io.File)
public void setPrintingController(IlvManagerPrintingController printingController)
Typical applications do not need to access the printing controller
directly, since all the printing tasks are handled automatically by
the methods print(boolean, boolean, ilog.views.diagrammer.IlvDiagrammer.PrinterExceptionHandler)
, pageSetup()
and so on.
You need to access the printing controller only if you want to
customize the printing process.
printingController
- The new printing controller to use for this
Diagrammer.print(boolean, boolean, ilog.views.diagrammer.IlvDiagrammer.PrinterExceptionHandler)
,
pageSetup()
,
printPreview()
,
setPrintArea()
,
clearPrintArea()
,
printToBitmap(java.io.File)
public void pageSetup()
public void printPreview()
public void setPrintArea()
public void clearPrintArea()
public void print(boolean showPrintDialog, boolean asynchronous, IlvDiagrammer.PrinterExceptionHandler exceptionHandler) throws PrinterException
showPrintDialog
- If true
, a print setup dialog is displayed before printing.
If false
, the parameters set previously by pageSetup()
are used.asynchronous
- If true
, the print job is performed in a separate thread, and
this method returns immediately. In this case, you must specify a non-null
exceptionHandler
parameter to handle possible printer exceptions.exceptionHandler
- A handler that will be called if an exception occurs
while printing asynchronously. This parameter is used only if
asynchronous
is true
.PrinterException
- if an exception occurspageSetup()
,
printPreview()
,
setPrintArea()
,
clearPrintArea()
,
printToBitmap(java.io.File)
public void printToBitmap(File file) throws IOException, PrinterException
file
- The file in which the bitmap will be saved.IOException
- If a I/O exception occurred while saving the bitmap file.PrinterException
- If an exception occurred while printing the diagram component.pageSetup()
,
printPreview()
,
setPrintArea()
,
clearPrintArea()
,
printToBitmap(java.io.File)
,
print(boolean, boolean, ilog.views.diagrammer.IlvDiagrammer.PrinterExceptionHandler)
public boolean hasFrameOrDialogAncestor()
true
if this diagram component is contained in a Frame or a Dialog ancestor.
A Frame or Dialog ancestor is necessary to call the pageSetup()
or printPreview()
methods.public boolean canPrint()
true
if the diagram component can be printed, that is,
if the diagram is not empty.public void setPalette(IlvDiagrammer palette)
The palette bar is a Diagrammer component that is used as a container for "prototype" nodes and links that can be created interactively in this diagram component. When a node or a link is selected in the palette, the user can click to create a copy of the selected node or link. If the selected object is a node, the user clicks once to define the location of the new node. If the selected object is a link, the user clicks twice to define the new link: once on the source node, and once on the target node.
palette
- The Diagrammer component that is used as a palette for this diagram component.public IlvDiagrammer getPalette()
setPalette(ilog.views.diagrammer.IlvDiagrammer)
public boolean isStickyModes()
setStickyModes(boolean)
public void setStickyModes(boolean stickyModes)
stickyModes
- Sets the value of the "sticky modes" flag for the diagram component.public void setBaseTextDirection(int baseTextDirection)
IlvBidiUtil.COMPONENT_DIRECTION
:
the base text direction is calculated from the
component orientation.
IlvBidiUtil.LEFT_TO_RIGHT
:
the base text direction is left-to-right.
IlvBidiUtil.RIGHT_TO_LEFT
:
the base text direction is right-to-left.
IlvBidiUtil.CONTEXTUAL_DIRECTION
:
the base test direction is determined from the text
that is displayed according to the standard Bidi
algorithm, if the text contains at least one character
with a strong left-to-right or right-to-left direction.
If the text doesn't contain any character with a strong
direction, the real text direction is determined from
the current component orientation of the object.
StyleSheet {
baseTextDirection: ...;
}
has no effect anymore.baseTextDirection
- New default base text directionIlvSDMEngine.setBaseTextDirection(int, boolean)
,
IlvSDMEngine.setUseBaseTextDirectionFromStyleSheetRenderer(boolean)
public void setBaseTextDirection(int baseTextDirection, boolean redraw)
IlvBidiUtil.COMPONENT_DIRECTION
:
the base text direction is calculated from the
component orientation.
IlvBidiUtil.LEFT_TO_RIGHT
:
the base text direction is left-to-right.
IlvBidiUtil.RIGHT_TO_LEFT
:
the base text direction is right-to-left.
IlvBidiUtil.CONTEXTUAL_DIRECTION
:
the base test direction is determined from the text
that is displayed according to the standard Bidi
algorithm, if the text contains at least one character
with a strong left-to-right or right-to-left direction.
If the text doesn't contain any character with a strong
direction, the real text direction is determined from
the current component orientation of the object.
StyleSheet {
baseTextDirection: ...;
}
has no effect anymore.baseTextDirection
- New default base text directionredraw
- Whether to redraw the diagrammer.IlvSDMEngine.setBaseTextDirection(int, boolean)
,
IlvSDMEngine.setUseBaseTextDirectionFromStyleSheetRenderer(boolean)
public int getBaseTextDirection()
public IlvSelectInteractor getSelectInteractor()
setSelectMode(boolean)
public void setSelectInteractor(IlvSelectInteractor selectInteractor)
setSelectMode(true)
after this method to install a new
select interactor.selectInteractor
- The new select interactor.setSelectMode(boolean)
public IlvZoomViewInteractor getZoomInteractor()
setZoomMode(boolean)
public void setZoomInteractor(IlvZoomViewInteractor zoomInteractor)
zoomInteractor
- the new zoom interactorsetZoomMode(boolean)
public IlvPanInteractor getPanInteractor()
setPanMode(boolean)
public void setPanInteractor(IlvPanInteractor panInteractor)
panInteractor
- the pan interactorsetPanMode(boolean)
public IlvEditSDMLabelInteractor getEditLabelInteractor()
setEditLabelMode(boolean)
public void setEditLabelInteractor(IlvEditSDMLabelInteractor editLabelInteractor)
editLabelInteractor
- the new edit label interactorsetEditLabelMode(boolean)
public boolean isGridVisible()
true
if the grid of the diagram component is currently
visible.public void setGridVisible(boolean visible)
visible
- If true
, the grid is displayed, and objects
"snap" to the grid when they are moved or created.public IlvGrid getGrid()
IlvGrid
object displayed by this diagram component
when setGridVisible(true)
is called.public void setGrid(IlvGrid grid)
IlvGrid
object displayed by this diagram component
when setGridVisible(true)
is called.
It may be useful to change the grid object if you want to subclass
IlvGrid
to implement a custom look for the grid.
By default, an instance of IlvGrid
is used.
grid
- The new grid object.public IlvSDMUndoManager getUndoManager()
UndoableEditListener
with the Undo Manager
so objects are notified when an edit has happened and update your GUI
accordingly. For example, to gray out undo/redo buttons.isEditingAllowed
returns true
, the
undo manager is returned. Otherwise null
is returned.IlvSDMUndoManager
,
setEditingAllowed(boolean)
,
isEditingAllowed()
public boolean canAlign()
true
if at least 2 nodes are selected.public boolean canDistribute()
true
if at least 2 nodes are selected.public void alignLeft()
public void alignRight()
public void alignTop()
public void alignBottom()
public void alignVerticalCenter()
public void alignHorizontalCenter()
public void distributeHorizontally()
public void distributeVertically()
public static IlvDiagrammer getCurrentDiagrammer(Component component)
This method is used by the GUI components contained in the
ilog.views.diagrammer.application
package to determine
which diagram component is the current target to which they are connected.
By default, the current diagram component is managed automatically, so actions and GUI components are automatically connected to the current diagram component.
The default mechanism assumes that there is at most one "current" diagrammer for
each Swing hierarchy
whose root is a JRootPane
. Swing listeners are setup automatically
so that the "current" diagrammer of this hierarchy is changed automatically.
This mechanism handles the following situations:
JDesktopPane
whose internal frames contain
different instances of IlvDiagrammer
,
JTabbedPane
whose tabs contain
different instances of IlvDiagrammer
.
In other situations, you can define yourself which component is to be
considered as the root of the hierarchy that contains a diagrammer and its
associated components. For instance, if you have two JPanel
instances,
each containing a diagrammer and a toolbar, you can specify that each
JPanel
must be considered as a root, and be handled independently.
For this, you will call setAsRoot(Component)
and pass the JPanel
as the parameter. You can also use the convenience method
setCurrentDiagrammer(toolbar, diagrammer, true)
,
which will find the common ancestor between the toolbar and the diagrammer.
In some rare situations, you may need to completely manage the current
diagram component yourself. To do so, you can disable the automatic mode
by calling setAutomaticDiagrammerMode(false)
.
Then you must call setCurrentDiagrammer(Component, IlvDiagrammer, boolean)
each time the current
diagram component changes.
component
- The component that identifies a hierarchy for
which the current diagram component is queried.setCurrentDiagrammer(Component, IlvDiagrammer, boolean)
,
setAutomaticCurrentDiagrammer(boolean)
,
isAutomaticCurrentDiagrammer()
public static void setCurrentDiagrammer(Component component, IlvDiagrammer diagrammer)
This is an advanced method: see getCurrentDiagrammer(java.awt.Component)
for
explanations.
component
- The component that identifies a hierarchy for
which the current diagram component is queried.diagrammer
- The new current diagram component.getCurrentDiagrammer(java.awt.Component)
,
setAutomaticCurrentDiagrammer(boolean)
,
isAutomaticCurrentDiagrammer()
public static void setCurrentDiagrammer(Component component, IlvDiagrammer diagrammer, boolean findCommonAncestor)
This is an advanced method: see getCurrentDiagrammer(java.awt.Component)
for
explanations.
This method is similar to the variant
setCurrentDiagrammer(Component, IlvDiagrammer)
,
except that it optionally finds the common ancestor of component
and diagrammer
, and calls setAsRoot(Component)
on this
common ancestor.
component
- The component that identifies a hierarchy for
which the current diagram component is queried.diagrammer
- The new current diagram component.findCommonAncestor
- look for common ancestorgetCurrentDiagrammer(java.awt.Component)
,
setAutomaticCurrentDiagrammer(boolean)
,
isAutomaticCurrentDiagrammer()
public static void setAsRoot(Component component)
Use this method when you have several diagram components in a swing frame or when there is no swing frame.
This is an advanced method: see getCurrentDiagrammer(java.awt.Component)
for
explanations.
component
- the new root componentgetCurrentDiagrammer(java.awt.Component)
public static void setAutomaticCurrentDiagrammer(boolean automatic)
This is an advanced method: see getCurrentDiagrammer(java.awt.Component)
for
explanations.
automatic
- If true
, the current diagram component
is set automatically, otherwise it must be set manually by calling the
setCurrentDiagrammer(Component, IlvDiagrammer, boolean)
method.getCurrentDiagrammer(java.awt.Component)
,
setCurrentDiagrammer(Component, IlvDiagrammer, boolean)
,
isAutomaticCurrentDiagrammer()
public static boolean isAutomaticCurrentDiagrammer()
true
if the automatic handling of the current diagram
component is enabled.
This is an advanced method: see getCurrentDiagrammer(java.awt.Component)
for
explanations.
getCurrentDiagrammer(java.awt.Component)
,
setCurrentDiagrammer(Component, IlvDiagrammer, boolean)
,
setAutomaticCurrentDiagrammer(boolean)
public boolean processServerAction(int x, int y)
x
- The X coordinate of the point where the user clicked on the client-side,
in view coordinates.y
- The y coordinate of the point where the user clicked on the client-side,
in view coordinates.true
if the action was processed,
false
if the action was not processed.public boolean isEmpty()
true
if the diagrammer is empty.protected IlvXMLDataSource createXMLDataSource()
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.