JIDE 3.5.15

com.jidesoft.dashboard
Class Dashboard

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.jidesoft.dashboard.Dashboard
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable
Direct Known Subclasses:
SingleDashboardHolder

public class Dashboard
extends JPanel
implements Scrollable

Dashboard is the container that contain the GadgetContainers. GadgetContainer contains the GadgetComponent. Ideally, we would like Dashboard to contain the gadget directly without the help of the gadget container in between. It will require a customized layout manager which we currently don't have. So right now we set the dashboard to grid layout and add gadget container to this grid layout. Each gadget container is using JideBoxLayout.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static int COMPONENT_MAXIMIZED
          The value return by getColumnIndex(javax.swing.JComponent) if the component is maximized GadgetComponent.
static int H_GAP
           
static String PROPERTY_COLUMN_COUNT
           
static String PROPERTY_ICON
           
static String PROPERTY_KEY
           
static String PROPERTY_TITLE
           
static int V_GAP
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Dashboard()
           
Dashboard(String key)
           
Dashboard(String key, String title)
           
Dashboard(String key, String title, Icon icon)
           
Dashboard(String key, String title, Icon icon, int columnCount)
           
Dashboard(String key, String title, int columnCount)
           
 
Method Summary
 void addPlaceHolder()
           
 void addPlaceHolder(Object constraints)
           
 void addPlaceHolder(PlaceHolder placeHolder, Object constraints)
           
protected  PlaceHolder createDefaultPlaceHolder()
           
protected  JPanel createMaximizedGadgetContainer()
          Create maximized gadget container.
protected  JPanel createNormalGadgetContainer()
          Deprecated. replaced by createNormalGadgetContainer(boolean)
protected  JPanel createNormalGadgetContainer(boolean columnResizable)
          Create normal gadget container.
protected  JPanel createSubpanel()
          Creates the panel for each column.
 void doLayout()
           
 int getColumnCount()
          Gets the number of columns.
 int getColumnIndex(JComponent gadgetComponent)
          Get the column index of the GadgetComponent instance inside the dashboard.
protected  Component getComponentAtLeft(Point p)
           
protected  Component getComponentAtTop(Point p)
           
protected  Object getComponentConstraints(int index)
          Gets the constraints defined in the layout while adding the component into the layout.
protected  LayoutManager getDashboardLayout(Container pane)
           
static int getDefaultColumnCount()
          Gets the default column count.
 GadgetComponent[] getGadgetComponents()
          Gets all GadgetComponents inside the dashboard.
 Container getGadgetContainer(int column)
          Get the GadgetContainer instance in the designated column.
 Icon getIcon()
          Gets the icon for the dashboard.
protected  ImageIcon getImageIcon(String name)
          Gets the image icons that is used in Dashboard.
 String getKey()
          Gets the key of this dashboard.
 PredefinedLayoutAdapter getLayoutAdapter()
          Gets the layout adapter.
 LayoutManager getPredefinedLayout()
          Gets predefined layout for the normal gadget container.
 Dimension getPreferredScrollableViewportSize()
           
 int getRowIndex(JComponent gadgetComponent)
          Get the row index of the GadgetComponent instance inside the dashboard.
 int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
           
 boolean getScrollableTracksViewportHeight()
           
 boolean getScrollableTracksViewportWidth()
           
 int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
           
 Map<String,String> getSettings()
          Gets the settings.
 String getTitle()
          Gets the title of this dashboard.
protected  void initDashboard()
          Initializes the dashboard.
 boolean isColumnResizable()
          Get the flag indicating if the column is resizable.
 boolean isPredefinedLayoutSet()
          Checks if the predefined layout is configured.
 boolean isRowResizable()
           
 boolean isShowGripper()
          Get the flag indicating if Dashboard will show the gripper.
 void maximizeGadget(GadgetComponent component)
          Deprecated. replaced by maximizeGadgetComponent(GadgetComponent)
 void maximizeGadget(int column, int row)
          Deprecated. replaced by maximizeGadgetComponent(int, int)
 void maximizeGadgetComponent(GadgetComponent component)
          Maximize the designated GadgetComponent.
 void maximizeGadgetComponent(int index)
           
 void maximizeGadgetComponent(int column, int row)
          Maximize the GadgetComponent in designated column and row.
 void removePredefinedGadgetPosition(int index)
           
 void restoreGadget()
          Deprecated. replaced by restoreGadgetComponent()
 void restoreGadgetComponent()
          Restore the maximized GadgetComponent.
 void setColumnCount(int columnCount)
          Sets the column count.
 void setColumnResizable(boolean columnResizable)
          Set the flag indicating if the column is resizable.
static void setDefaultColumnCount(int defaultColumnCount)
          Sets the default column count.
 void setIcon(Icon icon)
          Sets the icon for the dashboard.
 void setKey(String key)
          Sets the key.
 void setLayoutAdapter(PredefinedLayoutAdapter layoutAdapter)
          Sets the layout adapter.
 void setPredefinedLayout(LayoutManager predefinedLayout)
          Sets predefined layout for the normal gadget container.
 void setRowResizable(boolean rowResizable)
           
 void setSettings(Map<String,String> settings)
           
 void setShowGripper(boolean showGripper)
          Set the flag indicating if Dashboard will show the gripper.
 void setTitle(String title)
          Sets the title.
 void showMaximizedGadgetContainer()
          Show maximized gadget container.
 void showNormalGadgetContainer()
          Show normal gadget container.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, 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, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
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, 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, hide, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

H_GAP

public static final int H_GAP
See Also:
Constant Field Values

V_GAP

public static final int V_GAP
See Also:
Constant Field Values

PROPERTY_KEY

public static final String PROPERTY_KEY
See Also:
Constant Field Values

PROPERTY_TITLE

public static final String PROPERTY_TITLE
See Also:
Constant Field Values

PROPERTY_ICON

public static final String PROPERTY_ICON
See Also:
Constant Field Values

PROPERTY_COLUMN_COUNT

public static final String PROPERTY_COLUMN_COUNT
See Also:
Constant Field Values

COMPONENT_MAXIMIZED

public static final int COMPONENT_MAXIMIZED
The value return by getColumnIndex(javax.swing.JComponent) if the component is maximized GadgetComponent.

See Also:
Constant Field Values
Constructor Detail

Dashboard

public Dashboard()

Dashboard

public Dashboard(String key)

Dashboard

public Dashboard(String key,
                 String title)

Dashboard

public Dashboard(String key,
                 String title,
                 Icon icon)

Dashboard

public Dashboard(String key,
                 String title,
                 int columnCount)

Dashboard

public Dashboard(String key,
                 String title,
                 Icon icon,
                 int columnCount)
Method Detail

getDefaultColumnCount

public static int getDefaultColumnCount()
Gets the default column count. It is 3 by default.

Returns:
the default column count.
See Also:
setDefaultColumnCount(int)

setDefaultColumnCount

public static void setDefaultColumnCount(int defaultColumnCount)
Sets the default column count. If you use create a dashboard without specifying the column count, the default column count will be used.

Please note, this method will only have effect on dashboards created after this call. All previous created dashboard will still have its old column count.

Parameters:
defaultColumnCount - the new default column count.

initDashboard

protected void initDashboard()
Initializes the dashboard. Subclass can override it. By default, we set the background, set the border.


getColumnIndex

public int getColumnIndex(JComponent gadgetComponent)
Get the column index of the GadgetComponent instance inside the dashboard.

Parameters:
gadgetComponent - the gadget component instance
Returns:
the column index. -1 if it is not found in the dashboard. COMPONENT_MAXIMIZED if it is maximized.

getRowIndex

public int getRowIndex(JComponent gadgetComponent)
Get the row index of the GadgetComponent instance inside the dashboard.

Parameters:
gadgetComponent - the gadget component instance
Returns:
the row index. -1 if it is not found in the dashboard. COMPONENT_MAXIMIZED if it is maximized.

createNormalGadgetContainer

@Deprecated
protected JPanel createNormalGadgetContainer()
Deprecated. replaced by createNormalGadgetContainer(boolean)

Create normal gadget container. By default, it will create a JideSplitPane to contain GadgetContainer so that the customer can resize the width of each GadgetContainer.

Returns:
the normal gadget container.

createNormalGadgetContainer

protected JPanel createNormalGadgetContainer(boolean columnResizable)
Create normal gadget container. By default, it will create a JideSplitPane to contain GadgetContainers so that the customer can resize the width of each GadgetContainer. If column resizable is disabled, a JPanel will be returned.

Parameters:
columnResizable - if the column is resizable.
Returns:
the normal gadget container.

getComponentAtLeft

protected Component getComponentAtLeft(Point p)

getComponentAtTop

protected Component getComponentAtTop(Point p)

getDashboardLayout

protected LayoutManager getDashboardLayout(Container pane)

addPlaceHolder

public void addPlaceHolder()

addPlaceHolder

public void addPlaceHolder(Object constraints)

addPlaceHolder

public void addPlaceHolder(PlaceHolder placeHolder,
                           Object constraints)

removePredefinedGadgetPosition

public void removePredefinedGadgetPosition(int index)

createDefaultPlaceHolder

protected PlaceHolder createDefaultPlaceHolder()

getImageIcon

protected ImageIcon getImageIcon(String name)
Gets the image icons that is used in Dashboard. By default it will use IconsFactory to get the image icons.

Subclass can override this method to provide their own icon. The the value of the name parameter will be "icons/dashboard.png".

Parameters:
name - the icon name
Returns:
the image icon of a name.

createMaximizedGadgetContainer

protected JPanel createMaximizedGadgetContainer()
Create maximized gadget container. By default, it will create a JPanel to contain the maximized Gadget so that the customer can show this container if he/she maximized any GadgetComponent.

Returns:
the maximized gadget container.

showNormalGadgetContainer

public void showNormalGadgetContainer()
Show normal gadget container.


showMaximizedGadgetContainer

public void showMaximizedGadgetContainer()
Show maximized gadget container.


maximizeGadget

@Deprecated
public void maximizeGadget(GadgetComponent component)
Deprecated. replaced by maximizeGadgetComponent(GadgetComponent)

Maximize the designated GadgetComponent. It will do nothing if the GadgetComponent does not exist in normal gadget container.

Parameters:
component - the gadget component

maximizeGadgetComponent

public void maximizeGadgetComponent(GadgetComponent component)
Maximize the designated GadgetComponent. It will do nothing if the GadgetComponent does not exist in normal gadget container.

Parameters:
component - the gadget component

maximizeGadget

@Deprecated
public void maximizeGadget(int column,
                                      int row)
Deprecated. replaced by maximizeGadgetComponent(int, int)

Maximize the GadgetComponent in designated column and row. It will do nothing if the parameter is invalid.

Parameters:
column - the column index
row - the row index

maximizeGadgetComponent

public void maximizeGadgetComponent(int index)

maximizeGadgetComponent

public void maximizeGadgetComponent(int column,
                                    int row)
Maximize the GadgetComponent in designated column and row. It will do nothing if the parameter is invalid.

Parameters:
column - the column index
row - the row index

restoreGadget

@Deprecated
public void restoreGadget()
Deprecated. replaced by restoreGadgetComponent()

Restore the maximized GadgetComponent.


restoreGadgetComponent

public void restoreGadgetComponent()
Restore the maximized GadgetComponent.


setShowGripper

public void setShowGripper(boolean showGripper)
Set the flag indicating if Dashboard will show the gripper.

If the normal gadget container is a subclass of JideSplitPane, we will just invoke JideSplitPane.setShowGripper(boolean).

Parameters:
showGripper - the flag

isShowGripper

public boolean isShowGripper()
Get the flag indicating if Dashboard will show the gripper.

Returns:
true if the normal gadget container is a subclass of JideSplitPane and JideSplitPane.isShowGripper() is true. Otherwise false.

createSubpanel

protected JPanel createSubpanel()
Creates the panel for each column.

Returns:
the panel for each column.

getColumnCount

public int getColumnCount()
Gets the number of columns.

Returns:
the column count.

setColumnCount

public void setColumnCount(int columnCount)
Sets the column count. It will fire PropertyChangeEvent on PROPERTY_COLUMN_COUNT.

Parameters:
columnCount - the new column count.

doLayout

public void doLayout()
Overrides:
doLayout in class Container

getTitle

public String getTitle()
Gets the title of this dashboard. If you never set the title, the key will be used. The difference of the key and the title is the key can be non-localized string and the title should be localized. The key has to be uniquely if there are several dashboards managed by GadgetManager.

Returns:
the title of this dashboard.

setTitle

public void setTitle(String title)
Sets the title.

Parameters:
title - the new title.

getKey

public String getKey()
Gets the key of this dashboard.

Returns:
the key.

setKey

public void setKey(String key)
Sets the key.

Parameters:
key - the new key.

getIcon

public Icon getIcon()
Gets the icon for the dashboard.

Returns:
the icon.

setIcon

public void setIcon(Icon icon)
Sets the icon for the dashboard.

Parameters:
icon - the icon

getSettings

public Map<String,String> getSettings()
Gets the settings.

Returns:
a map of the settings. The key is the name of the setting and the value of the map is the value of the setting. The value must be a string in order to be persisted in the xml format. If your original data format is not string, you need to convert to string first. You could leverage ObjectConverterManager and ObjectConverter to do it.

setSettings

public void setSettings(Map<String,String> settings)

getPreferredScrollableViewportSize

public Dimension getPreferredScrollableViewportSize()
Specified by:
getPreferredScrollableViewportSize in interface Scrollable

getScrollableBlockIncrement

public int getScrollableBlockIncrement(Rectangle visibleRect,
                                       int orientation,
                                       int direction)
Specified by:
getScrollableBlockIncrement in interface Scrollable

getScrollableTracksViewportHeight

public boolean getScrollableTracksViewportHeight()
Specified by:
getScrollableTracksViewportHeight in interface Scrollable

getScrollableTracksViewportWidth

public boolean getScrollableTracksViewportWidth()
Specified by:
getScrollableTracksViewportWidth in interface Scrollable

getScrollableUnitIncrement

public int getScrollableUnitIncrement(Rectangle visibleRect,
                                      int orientation,
                                      int direction)
Specified by:
getScrollableUnitIncrement in interface Scrollable

getGadgetComponents

public GadgetComponent[] getGadgetComponents()
Gets all GadgetComponents inside the dashboard.

Returns:
all GadgetComponents inside the dashboard.

getGadgetContainer

public Container getGadgetContainer(int column)
Get the GadgetContainer instance in the designated column.

Parameters:
column - the column index
Returns:
the gadget container instance.

isColumnResizable

public boolean isColumnResizable()
Get the flag indicating if the column is resizable.

The default value of this flag is false to keep consistent behavior with earlier release.

Returns:
the flag

setColumnResizable

public void setColumnResizable(boolean columnResizable)
Set the flag indicating if the column is resizable.

Parameters:
columnResizable - the flag

isRowResizable

public boolean isRowResizable()

setRowResizable

public void setRowResizable(boolean rowResizable)

setPredefinedLayout

public void setPredefinedLayout(LayoutManager predefinedLayout)
Sets predefined layout for the normal gadget container.

The column resizable and column count setting will not take effective as long as you set predefined layout here.

You need invoke setLayoutAdapter(PredefinedLayoutAdapter) to have layout adapter defined to have this feature working.

Parameters:
predefinedLayout - the layout manager
See Also:
setLayoutAdapter(PredefinedLayoutAdapter)

getPredefinedLayout

public LayoutManager getPredefinedLayout()
Gets predefined layout for the normal gadget container.

Returns:
the predefined layout.

isPredefinedLayoutSet

public boolean isPredefinedLayoutSet()
Checks if the predefined layout is configured.

Returns:
true if predefined layout is set to a non-null value. Otherwise false.

setLayoutAdapter

public void setLayoutAdapter(PredefinedLayoutAdapter layoutAdapter)
Sets the layout adapter.

Parameters:
layoutAdapter - the layout adapter

getLayoutAdapter

public PredefinedLayoutAdapter getLayoutAdapter()
Gets the layout adapter.

Returns:
the layout adapter.

getComponentConstraints

protected Object getComponentConstraints(int index)
Gets the constraints defined in the layout while adding the component into the layout.

Parameters:
index - the index of the child component
Returns:
the constraints used by the layout.

JIDE 3.5.15