JGrafchart Editor


The JGrafchart editor consists of a graphical user-interface through which the user creates, compiles, executes, and stores function charts. The basic layout of the editor is shown below.

Overview

The editor consists of the following main parts:
  • Menu bar
The menu bar contains pull-down menus containing menu choices by which the user controls the editor.
  • Tool bar
The toolbar contains tool buttons that provide shortcuts to some of the menu choices available from the menus in the menu bar. The toolbar also contains a message menu. The message menu contains compilation error and warning messages. It is also possible for an application to write messages to the message menu and to clear the message menu. The message menu is implemented as a pull-down menu. It works as a stack where new messages are pushed on top of the stack and shown at the top of the menu. The toolbar can be removed and added using menu choices,
  • Palette
The palette is a five-tabbed pane containing the different language elements in JGrafchart. The user creates an application by drag-and-drop from the palette into a workspace. The five tabs are named: SFC (the default palette), VAR, IO, XML, and GUI. The SFC palette contains the basic JGrafchart language elements, e.g, steps, transitions, procedures, etc. The VAR palette contains JGrafchart variables and lists. The IO menu contains input and output objects. The XML palette contains objects for communication using XML. The objects in this menu assume the availability of the CCOM infrastructure. This is not available in all distributions. The GUI palette contains graphical objects, e.g., texts, rectangles, icons, etc. It also contains plotters, browsers, and buttons. In addition to the drag-and-droppable objects the GUI palette also contains two mode buttons: the line-mode button and the spline-mode button. By clicking on these buttons the mouse-behavior changes from the standard select-object mode to a line-drawing mode. The palette can be removed and added.
  • Workspace area
The workspace area is the area where the user application workspaces are shown. The workspaces are implemented as Swing internal frames. They can be maximized/minimized, iconized, deleted, scrolled, and panned using standard window operations.

Workspaces

Top-level workspaces and sub-workspaces are implemented as internal frames (windows). The windows can be moved within the workspace area of the editor. The windows have a border, a scroll bar and a pan bar. The border at the top of the window contains the name of the workspace, an iconize button, a maximize/minimize button, and, for non-top level workspaces, a delete button. Top-level workspaces can only be deleted using the Delete top-level workspace menu option in the Edit menu. Deletion of top-level workspaces is not undoable. For top-level workspaces, the workspace name is preceded by the text string "Top: ".



Top-level workspaces are given the default names J# where # is an integer number. The first top-level workspace created gets the name J1, the second one J2, etc. The name of a subworkspace is the same as the name of the language element that contains the subworkspace. The workspace which has the current focus is indicated by a highlighted border. The focus is changed by clicking on the workspace. Workspaces have an associated level number. The level of a top-level workspace is 1. The level of the immediate subworkspaces of this top-level workspace is 2 etc. Workspaces with a high level number are always shown on top of workspaces with a lower level number. When a workspace receives focus it is shown on top of all workspaces with the same or lower level number.

A workspace has an associated coordinate system. The origin of the coordinate system is the top-left corner of the workspace. Both positive and negative coordinates are supported. The window shows a view of the document associated with the window. By moving an object slowly towards the left/right or top/bottom border of the window the view is moved (equivalent to panning and scrolling). The horizontal and vertical scrollbars may be removed.

As a default each workspace has a rectangular grid where the width and the height are ten pixels. Objets that are created or moved will automatically snap to the grid. The default grid snap point of an object that contains a connection stub (steps, transitions, etc) is the top center of the main rectangle of the object. The default grid snap point of an object without any connection stubs is the top left corner of the object.

A top-level workspace can be locked. In a locked workspace it is not possible to move objects, delete objects, create objects, make connections etc. However, it is still possible to access the object-specific menus
and it is also possible to execute the workspace. A locked workspace cannot be resized or maximized. A locked workspace is indicated by a lock icon in the top-left corner of the window border. When a top-level workspace is locked the locking applies to all subworkspaces within the top-level workspace.

A workspace that is executing is indicated by an arrow icon in the top-left corner of the window border. The arrow icon overrides the lock icon.

Locked workspaces can be used in two main ways:
  • To restrict the operations that an end-user can perform on the application. This is particularly useful in graphical user interfaces.
  • To create application-specific libraries from which the user can drag-and-drop objects in the same as from the built-in palettes.


Mouse Interaction

The primary mean for interaction with the editor is the mouse. Using the mouse the user selects objects, moves objects, connects objects together, brings up object specific pop-up menus, etc.

Select

  • An object is selected by single-clicking on the object. When an object has been selected its resize handles are highlighted.
  • A group of objects is selected by drawing an enclosing rectangle with the mouse.
  • An object is added to the current selection by single-clicking on the object while pressing down the Shift key.
  • An object is removed from the current selection by single-clicking on the object while pressing down the Shift key.

Move

  • A selection is moved using the mouse in the standard way.
  • Moving a selection while simultaneously pressing the Ctrl key will create a copy of the the selection,
  • Moving a selection slowly against the border of the window of a workspace will cause scrolling or panning.
  • Moving a selection rapidly towards another workspace will create a copy of the selection in the other workspace

Resize

  • An object is resized through its resize handles.

Connect

  • Two objects are connected by clicking on a port stub of one of the objects and moving the mouse while keeping the mouse button depressed to the port stub of the other object.
  • A connection between two ports that are sufficiently close together is created simply by clicking on one of the ports.
  • It is only possible to create syntactically legal connections.
  • A connection is redrawn whenever any of the interconnected objects is moved.
  • The corner points of a connection can be moved manually using the mouse. Once a connection segment has been placed manually it will remain at the new position also if the any of the interconnected objects is moved.

Show Object Menu

  • Object-specific pop-up menus are shown by double-clicking on the object or clicking on the object using the right mouse button.

Object Help

  • Object-specific help is available by selecting the Object Help menu option in the Help menu. This causes the editor to change mode into object-help mode. The object-help mode is indicated by a special "information cursor".
  • When in object-help mode, object-specific help is obtained by clicking on an object, on a menu option, or on a toolbar button.
  • To return to the standard editing mode, the Object Help menu option is selected again.

Drawing Lines

  • When clicking on the Line or Spline buttons in the GUI palette, the editor changes mode to line-drawing mode. 
  • A line is is created by clicking in a workspace.
  • For every subsequent click within the same workspace a new point of the line is created.
  • The line-drawing is terminated by a double-click.
  • For a line, the points of the line are interconnected by straight lines.
  • For a spline, the points of the line are interconnected by cubic splines. At least three points are needed in order to make a cubic spline.
  • If the start point and the end point are sufficiently close to each other a polygone (line) or "curved polygone" (spline) is created rather than a line/spline.
  • The start and end points are sufficiently close if they have the same nearest grid point.

File Menu

The file menu contains the following menu choices.

  • New (Keyboard accelerator: Ctrl-N Toolbar button:  )
The new menu choice is used to create a new top-level workspace. The new workspace receives a default name and automatically receives focus.
  • Open (Keyboard accelerator: Ctrl-O  Toolbar button: )
A saved application is opened. A file chooser menu is used to select the file to be opened.
  • Save  (Keyboard accelerator: Ctrl-S  Toolbar button: )
The top-level workspace together with all its subworkspaces are saved on a file using XML-format. If the workspace has not been saved before a file chooser menu is obtained. Selecting Save for a subworkspace is equivalent to saving the top-level workspace that the subworkspace belongs to. It is not possible to save if the workspace is executing.
  • Save As 
Equivalent to Save, but a file chooser menu is always shown. Using Save As it is possible to save a top-level workspace under a new file name.
  • OpenAll
Open a set of top-level workspaces that have been saved in a single XML file using SaveAll or SaveAllAs. This operation is currently error-prone and should be avoided.
  • SaveAll
Equivalent to Save, but saves all top-level workspaces currently in the editor as a single file. This operation is currently error-prone and should be avoided.
  • SaveAllAs
Equivalent to Save As, but saves all top-level workspaces currently in the editor as a single file. This operation is currently error-prone and should be avoided.

  • Print
Prints the workspace cuurently in focus. The operation calls the Java printing facilities and its behavior is dependent on the print support available on the current execution platform.
  • Properties (Tool bar button: )
Bring up a dialog that allows the user to change different properties related to the Grafchart execution thread associated with the current top-level workspace. Only accessible from top-level workspaces. The dialog is shown below.



Workspace Name: The name of the top-level workspace.

Thread Sleep Interval: The period of the execution thread associated with the top-level workspace in milliseconds. Default value is 40.

Simulator Mode: In simulator mode the digital and analog input variables are disconnected from their associated digital and analog I/O. Instead the user may change their values from the editor. In non-simulator mode the digital and analog input variables are connected to the I/O. Simulator mode is the default.

Token Luminance & Dim interval: Token luminance is useful for animating the execution of a function chart at high execution speeds when the token indicating the currently active step(s) moves rapidly between steps. Token luminance creates a trail of outlined and shaded tokens that follows the normal token. The dim interval decides how many scan-cycles that the outlined token should be visible after the deactivation of a step. Token luminance is only supported for simple function charts containing steps, transitions, and macro steps.

Socket Host: The IP address of the TCP socket server connected to the top-level workspace, An IP address number or localhost. If the string is empty no socket reader thread is created for the top-level workspace.

Socket Port: The port number of the TCP socket server. Default value is -1, indicating that no socket communication is used for the current top-level workspace.

Locked: Determines if the workspace should be locked or not. Default mode is not locked.

  • Grid
Bring up a dialog that makes it possible to change different graphical properties of the workspace.



Grid Size: Non-negative integers determining the width and height of the grid of the workspace.

Grid Style: Decides the style of the grid.

Snap On Move: Determines how moved objects should be related to the grid. No snap does not snap the object to the grid. Jump snaps to the grid continuously during the move. Afterwards does not perform the snap until the object is released.

Snap on Resize: Determines how resized objects should be related to the grid.

Horizontal Scrollbar: Determines if the workspace should have a horizontal scrollbar.

Vertical Scrollbar: Determines if the workspace should have a vertical scrollbar.

Paper Color: Makes it possible to change the background color of the workspace. Brings up a Java color choser menu.

  • Remove Palette
Remove the palette from the editor. Can be useful during execution when the screen size is limiting.
  • Add Palette
Add the palette to the editor.
  • Remove Toolbar
Remove the toolbar from the editor.
  • Add Toolbar
Add the toolbar to the editor.
  • Show Tree (Toolbar button:  )
Displays a hierarchical tree view navigation window of the Windows "explorer" type. The tree view shows a snapshot of all the objects in the current workspace and its subworkspaces. By clicking with the left mouse button on a node in the tree, the node becomes selected in its corresponding workspace view. Clicking with the right mouse button on a tree node has the same effect as clicking on the corresponding object in the workspace view, e.g., an object-specific pop-up menu is shown. All hierarchical objects, e.g., workspace objects and macro steps, can be expanded and collapsed. It is possible to have multiple
tree display open at the same time. It is important to understand that the tree only displays a snapshot of the application with the state it was in when the menu choice was selected, i.e., it is not updated if something changes. An example of the tree navigation window is shown below.



  • Exit
Exit JGrafchart. No saving of workspaces is performed. JGrafchart can also be exited using the delete button on the JGrafchart window. Before JGrafchart is closed down, the user must explicitly confirm the operation.

Edit Menu

The edit menu contains the following menu choices.
  • Cut (Keyboard accelerator: Ctrl-X  Toolbar button:. )
Cut the current selection to the clipboard.
  • Copy (Keyboard accelerator: Ctrl-C  Toolbar button.   )
Copy the current selection to the clipboard.
  • Paste (Keyboard accelerator: Ctrl-V  Toolbar button: )
Paste the content of the clipboard to the workspace. The newly pasted objects will be automatically selected. The default position where the pasting takes place is the original  location of the objects offset one grid-width to the right and one grid-height down. The pasting position can be changed by clicking on the workspace at the desired position before performing the paste.
  • Delete (Toolbar button:   )
Delete the current selection.
  • Delete top-level workspace
Delete the current top-level workspace. Before the workspace is deleted, the user must confirm the deletion.
  • Select All (Keyboard accelerator: Ctrl-A)
Select all objects in the current workspace.
  • Group 
Group the objects in the current selection into a single object. Grouping is still quite error-prone.
  • Ungroup
Ungroup the currently selected previously grouped object.
  • Undo (Keyboard accelerator: Ctrl-Z  Toolbar button: )
Undo the last editor operation. Only operations that are of a graphical nature can be undone.  Every workspace has its own undo history. The undo history is maximized to 30 past operations. Recording of undoable operations is turned off during execution. It is not possible to undo the deletion of an entire workspace. It is not possible to undo all operations.
  • Redo (Keyboard accelerator: Ctrl-Y  Toolbar button. )
Redo the last undone operation. It is not possible to redo all operations.
  • Move to front
Move the currently selected objects in front of any other objects in the workspace.
  • Move to back
Move the currently selected objects behind any other objects in the workspace.
  • Zoom in (Keyboard accelerator. Ctrl-B  Toolbar button: )
Zoom in on the current workspace with 10%.
  • Zoom out (Keyboard accelerator: Ctrl-D  Toolbar button. )
Zoom out on the current workspace with 10%.
  • Zoom normal size (Keyboard accelerator: Ctrl-F)
Zoom back to the normal size.
  • Zoom to fit
Zoom in on a workspace so that all objects fit in the current workspace window.
  • Overview
Bring up a separate top-level window containing a miniature of the contents of the document showed by the current workspace. The overview window also contains an outlined rectangle showing the current position of the view of the document shown in the workspace. When the rectangle is moved the current workspace view is panned and scrolled accordingly.

Execute Menu

The execute menu contains the following menu choices.
  • Compile (Toolbar button: )
Compile the current top-level workspace and all its subworkspaces. Applying the menu choice to a subworkspace is equivalent to applying it to the top-level workspace of the subworkspace. Compilation error and warnings are shown in the message menu.
  • Compile all
Apply compile to all top-level workspaces in the system.
  • Execute (Toolbar button: )
Start  the execution of the current top-level workspace context. Applying the menu choice to a subworkspace is equivalent to applying it to the top-level workspace of the workspace. It is only possible to start execution of a top-level workspace if the top-level workspace has been previously compiled without any compilation errors. During execution it is not possible to drag-and-drop from the palette onto the workspace. During execution the undo history is switched off. During execution the top-level frame icon is changed to an arrow icon .
  • Stop (Toolbar button: )
Stop the execution of the current top-level workspace context. Applying the menu choice to a subworkspace is equivalent to applying it to the top-level workspace of the workspace.
  • Shutdown client
Stop the socket reader thread associated with the workspace and close the socket connection.

Misc Menu

The menu choices available in the misc. menu are the following:
  • Connect CCOM
Connects to the CCOM server (Requires that the CCOM infrastructure is available).
  • Disconnect CCOM
Disconnects from the CCOM server (Requires that the CCOM infrastructure is available).
  • CCOM Server
Brings up a dialog from which the CCOM server properties can be edited.



CCOM Server IP address:
The IP address to the CCOM/xmlBlaster node.

CCOM Server Port:
The port of the CCOM server. (Default = 3412)

CCOM Login Name:
The login name to CCOM. (Default = JGrafchart)
  • Enable slide mode
Change the editor into slide show mode.
  • Disable slide mode
Change the editor into its normal mode.

Help Menu

The menu choice available in the help menu is the following.
  • On-Line Help
Show the interactive help system browser.
  • Object Help (Toolbar button:  )
A toggle menu choice that changes the editor mode into object-help mode. In object-help mode, specific help information is obtained by clicking on an object, a menu option, or a toolbar button.
  • Open On-Line Tutorial
Brings up the JGrafchart interactive on-line tutorial containing examples of how to use the different elements of JGrafchart. The tutorial is an ordinary JGrafchart application residing in the file ../grafchart/doc/tutorial/tutorial.xml. The tutorial can be changed and extended by the user.
  • Close On-Line Tutorial
Closes the onj-line tutorial.




Command Line Arguments

JGrafchart supports the following command line arguments:

  • -geometry 1024x768
The initial size of the JGrafchart window (default 1024x768)
  • -windows 1
Use the Windows look-and-feel UI rather than the standard Java look-and-feel.
  • -name JGrafchart
The name of the JGrafchart application. This will also be the identifier used in CCOM communication. Default is JGrafchart.
  • -localIO "class_name"
The implementation class for the custom IO.
  • -connect 1
Make an automatic connect to the CCOM server.
  • -serverIP "IP address"
The CCOM server IP address. Localhost is not a valid value.
  • -port "number"
The port number that the CCOM server listens to.
  • -Xincgc
Enables incremental Java GC. This option should be given to the JVM and not to JGrafchart.
  • -load "file_name"
Loads the application named by file when JGrafchart has started. The file name should be an absolute reference.
  • -loadcompile "file_name"
Loads and compiles the application named by file when JGrafchart has started. The file name should be an absolute reference.
  • -loadcompilestart "file_name"
Loads, compiles, and, if the compilation was successful, starts the application named by file when JGrafchart has started. The file name should be an absolute reference.