JAC project
AOPSYS
CEDRIC & LIP6 labs

org.objectweb.jac.aspects.gui
Class CustomizedGUI

java.lang.Object
  |
  +--org.objectweb.jac.aspects.gui.CustomizedGUI

public class CustomizedGUI
extends Object

This interface allows the programmer to create simple customized GUIs.

The idea is to define sub-panels that can contain views on the objects of the application. The geometric placement of the sub-panel is defined by the setSubPanesGeometry method that has to be called at contruction-time.

Once the geometry is chosen, you can tell a pane to contain a view on a given object by using the addReferenceToPane method.

This class must be subclassed by the porgrammer of a JAC application to provide a customized GUI.

See Also:
GuiAC, setSubPanesGeometry(int,int,boolean[]), #addReferenceToPane(FieldItem,String,String)

Field Summary
static String BOTTOM
           
static int HORIZONTAL
          The subpanes are separated by an horizontal splitter
static int HORIZONTAL_DOWN
          The down subpanes are separated by a vertical splitter
static int HORIZONTAL_UP
          The upper subpanes are separated by a vertical splitter
static String TOP
           
static int VERTICAL
          The subpanes are separated by a vertical splitter
static int VERTICAL_LEFT
          The left subpanes are separated by an horizontal splitter
static int VERTICAL_RIGHT
          The right subpanes are separated by an horizontal splitter
 
Constructor Summary
CustomizedGUI(String id)
          Creates a new customized GUI.
 
Method Summary
 void addMenuItem(String menuName, String[] menuPath, Callback callback)
          Add an item in a menu
 void addMenuSeparator(String menuName, String[] menuPath)
          Add a separator in a menu
 void addReferenceToPane(MemberItem reference, String viewType, String[] viewParams, String paneId)
          Tells a referenced object to open in a given panel when a view is asked by the user (instead of opening in a popup).
 void addStatusBar(MethodItem method, String position)
          Adds a status bar to the GUI.
 void addStyleSheetURL(String url)
           
 void addToolbarAction(AbstractMethodItem method)
          Add a button in the toolbar
 void addToolbarAction(String objectName, AbstractMethodItem method)
          Add a button in the toolbar
 void addToolbarSeparator()
          Add a separator in the toolbar
 String getApplication()
          Get the value of application.
 List getFieldTargets(MemberItem reference)
           
 int getGeometry()
           
 int getHeight()
           
 String getIcon()
           
 String getId()
           
 String getInvalidPane(String changedPane)
           
 int getLeft()
           
protected  Menu getMenu(String menuName, String[] menuPath)
          Find a menu defined by its path
 Hashtable getMenus()
           
 Menu getMenus(String name)
           
 AbstractMethodItem getOnCloseHandler()
           
 String getPaneContainer(String paneId)
           
 Map getPaneContainers()
           
 String[] getPaneContentArgs(String paneID)
           
 Map getPaneContents()
           
 String getPaneContentType(String paneID)
          Returns the type of the object to be displayed in a pane
 boolean[] getScrollings()
           
 Map getSplitters()
           
 MethodItem getStatusBarMethod()
           
 String getStatusPosition()
           
 Vector getStyleSheetURLs()
           
 Map getSubPaneContents()
           
 int getSubPanesCount()
           
 Map getTargetContainers()
           
 String getTitle()
           
 Collection getToolbar()
          Returns the toolbar of the customized GUI.
 int getUp()
           
 int getWidth()
           
 boolean hasMenuBar()
           
 boolean hasStatusBar()
           
 boolean hasToolBar()
           
 boolean isGeometrySet()
          Returns true if the geometry of this GUI was set with setPosition.
 void setApplication(String v)
          Set the value of application.
 void setIcon(String icon)
           
 void setInvalidPane(String changedPane, String invalidPane)
           
 void setMenuIcon(String menuName, String[] menuPath, String icon)
           
 void setMenuPosition(String menuName, String position)
           
 void setOnCloseHandler(AbstractMethodItem handler)
           
 void setPaneContainer(String paneId, String containerType)
           
 void setPaneContent(String paneId, String viewType, String[] args)
          Sets the object that should be opened in the given panel id.
 void setPosition(int left, int up, int width, int height)
          Sets the dimensions and position of the window regarding to the main screen.
 void setSplitterLocation(int splitterId, float location)
          Sets a splitter location.
 void setSubPanesGeometry(int subPanesCount, int geometry, boolean[] scrollings)
          Sets the geometric arrangement of the panes.
 void setTitle(String title)
           
 void setWelcomeMessage(String title, String message, String icon)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HORIZONTAL

public static final int HORIZONTAL
The subpanes are separated by an horizontal splitter

See Also:
Constant Field Values

HORIZONTAL_UP

public static final int HORIZONTAL_UP
The upper subpanes are separated by a vertical splitter

See Also:
Constant Field Values

HORIZONTAL_DOWN

public static final int HORIZONTAL_DOWN
The down subpanes are separated by a vertical splitter

See Also:
Constant Field Values

VERTICAL

public static final int VERTICAL
The subpanes are separated by a vertical splitter

See Also:
Constant Field Values

VERTICAL_LEFT

public static final int VERTICAL_LEFT
The left subpanes are separated by an horizontal splitter

See Also:
Constant Field Values

VERTICAL_RIGHT

public static final int VERTICAL_RIGHT
The right subpanes are separated by an horizontal splitter

See Also:
Constant Field Values

BOTTOM

public static final String BOTTOM
See Also:
Constant Field Values

TOP

public static final String TOP
See Also:
Constant Field Values
Constructor Detail

CustomizedGUI

public CustomizedGUI(String id)
Creates a new customized GUI.

When subclassing, a typical implementation of the constructor is:

 super()
 // initialization calls such as setSubPanesGeometry
 // addReferenceToPane, setPosition
 ...
 show();
 

See Also:
setSubPanesGeometry(int,int,boolean[]), #addReferenceToPane(FieldItem,String,String), setPosition(int,int,int,int), setSplitterLocation(int,float)
Method Detail

setInvalidPane

public void setInvalidPane(String changedPane,
                           String invalidPane)

getInvalidPane

public String getInvalidPane(String changedPane)

getSubPanesCount

public int getSubPanesCount()

getGeometry

public int getGeometry()

getScrollings

public boolean[] getScrollings()

getApplication

public String getApplication()
Get the value of application.

Returns:
value of application.

setApplication

public void setApplication(String v)
Set the value of application.

Parameters:
v - Value to assign to application.

setSubPanesGeometry

public void setSubPanesGeometry(int subPanesCount,
                                int geometry,
                                boolean[] scrollings)
Sets the geometric arrangement of the panes.


setPaneContent

public void setPaneContent(String paneId,
                           String viewType,
                           String[] args)
Sets the object that should be opened in the given panel id.

Parameters:
paneId - the panel id (see the geometry to know its placement)
viewType - of the type of the view
args - parameters to pass to the view type constructor
See Also:
setSubPanesGeometry(int,int,boolean[])

getPaneContentType

public String getPaneContentType(String paneID)
Returns the type of the object to be displayed in a pane


getPaneContentArgs

public String[] getPaneContentArgs(String paneID)

getPaneContents

public Map getPaneContents()

setPaneContainer

public void setPaneContainer(String paneId,
                             String containerType)

getPaneContainer

public String getPaneContainer(String paneId)

getPaneContainers

public Map getPaneContainers()

getSubPaneContents

public Map getSubPaneContents()

addReferenceToPane

public void addReferenceToPane(MemberItem reference,
                               String viewType,
                               String[] viewParams,
                               String paneId)
Tells a referenced object to open in a given panel when a view is asked by the user (instead of opening in a popup).

Parameters:
reference - the reference (can be a method's result)
viewType - the type of the view that must be opened
paneId - the panel id where the view must be opened

getTargetContainers

public Map getTargetContainers()

getFieldTargets

public List getFieldTargets(MemberItem reference)

getLeft

public int getLeft()

getUp

public int getUp()

getWidth

public int getWidth()

getHeight

public int getHeight()

isGeometrySet

public boolean isGeometrySet()
Returns true if the geometry of this GUI was set with setPosition.

See Also:
setPosition(int,int,int,int)

setPosition

public void setPosition(int left,
                        int up,
                        int width,
                        int height)
Sets the dimensions and position of the window regarding to the main screen.

Parameters:
left - left-border pixel
up - upper-border pixel
width - in percentage regarding the screen
height - in percentage regarding the screen
See Also:
isGeometrySet()

setSplitterLocation

public void setSplitterLocation(int splitterId,
                                float location)
Sets a splitter location.

The splitter is referenced by its index going from the front-end splitter to the back-end splitters. For instance, in the case of a 3 sub-panel window, the 0 index references the splitter that splits the main window in two, the 1 index, the one that splits the half-window in two other smaller parts.

Parameters:
splitterId - the splitter's index
location - the position in pixel, regarding to the top/left component, a negative value means that the splitter should be set at the preferred sized of the inner components

getSplitters

public Map getSplitters()

hasStatusBar

public boolean hasStatusBar()

getStatusPosition

public String getStatusPosition()

getStatusBarMethod

public MethodItem getStatusBarMethod()

addStatusBar

public void addStatusBar(MethodItem method,
                         String position)
Adds a status bar to the GUI.


getId

public String getId()

getMenus

public Hashtable getMenus()

getMenus

public Menu getMenus(String name)

hasMenuBar

public boolean hasMenuBar()

addMenuItem

public void addMenuItem(String menuName,
                        String[] menuPath,
                        Callback callback)
Add an item in a menu

Parameters:
menuPath - the path of the menu where to add an item
callback - the method to call when this item is selected
See Also:
addMenuSeparator(String,String[])

addMenuSeparator

public void addMenuSeparator(String menuName,
                             String[] menuPath)
Add a separator in a menu

Parameters:
menuName - the name of the menu
menuPath - the path of the menu where to add a separator
See Also:
addMenuItem(String,String[],Callback)

addToolbarAction

public void addToolbarAction(AbstractMethodItem method)
Add a button in the toolbar

Parameters:
method - the static method to call when the button is pressed
See Also:
addToolbarSeparator(), #addToolbarAction(String,MethodItem)

addToolbarAction

public void addToolbarAction(String objectName,
                             AbstractMethodItem method)
Add a button in the toolbar

Parameters:
objectName - name of the object on which to invoke the method
method - the method to call when the button is pressed
See Also:
addToolbarSeparator(), addToolbarAction(AbstractMethodItem)

addToolbarSeparator

public void addToolbarSeparator()
Add a separator in the toolbar

See Also:
addToolbarAction(AbstractMethodItem)

getToolbar

public Collection getToolbar()
Returns the toolbar of the customized GUI.

Returns:
a collection representing the tool. It contains AbstractMethodItem objects for buttons, and null for a separator.

hasToolBar

public boolean hasToolBar()

getMenu

protected Menu getMenu(String menuName,
                       String[] menuPath)
Find a menu defined by its path


setMenuIcon

public void setMenuIcon(String menuName,
                        String[] menuPath,
                        String icon)

setMenuPosition

public void setMenuPosition(String menuName,
                            String position)

setWelcomeMessage

public void setWelcomeMessage(String title,
                              String message,
                              String icon)

setTitle

public void setTitle(String title)

getTitle

public String getTitle()

addStyleSheetURL

public void addStyleSheetURL(String url)

getStyleSheetURLs

public Vector getStyleSheetURLs()

setOnCloseHandler

public void setOnCloseHandler(AbstractMethodItem handler)

getOnCloseHandler

public AbstractMethodItem getOnCloseHandler()

getIcon

public String getIcon()

setIcon

public void setIcon(String icon)

Contact JAC development team:
Renaud Pawlak
Lionel Seinturier
Laurent Martelli