|
JIDE 2.9.5 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jidesoft.dashboard.GadgetManager
public class GadgetManager
You can view GadgetManager as the model of the whole JIDE Dashboard. It has a list of dashboards and
gadgets.
DashboardHolder must work with a GadgetManager. It should also listen to GadgetEvents
or DashboardEvents fired by GadgetManager to update the UI.
If you want to add or remove gadgets or dashboards, you should do it through methods provided by
GadgetManager.
| Field Summary | |
|---|---|
protected EventListenerList |
listenerList
A list of event listeners for this component. |
| Constructor Summary | |
|---|---|
GadgetManager()
Creates an empty GadgetManager. |
|
| Method Summary | |
|---|---|
void |
addDashboard(Dashboard dashboard)
Adds a new dashboard. |
void |
addDashboardListener(DashboardListener l)
Adds the specified listener to receive dashboard events from this dashboard. |
void |
addGadget(Gadget gadget)
Adds a new gadget. |
void |
addGadget(Gadget gadget,
int index)
Adds a new gadget at the specified index. |
void |
addGadgetListener(GadgetListener l)
Adds the specified listener to receive gadget events from this gadget. |
GadgetComponent |
createGadgetComponent(Gadget gadget)
Creates a gadget component. |
protected void |
fireDashboardEvent(DashboardEvent e)
Fires a dashboard event. |
protected void |
fireGadgetEvent(GadgetEvent e)
Fires a gadget event. |
String |
getActiveDashboardKey()
Gets the active Dashboard key. |
KeyListener |
getCancelDragAndDropKeyListener()
Gets the key listener. |
Dashboard |
getDashboard(int index)
Gets the dashboard at the specified index. |
Dashboard |
getDashboard(String key)
Gets the dashboard by the key. |
int |
getDashboardCount()
Gets the number of dashboards. |
int |
getDashboardIndex(String key)
Gets the dashboard index. |
DashboardListener[] |
getDashboardListeners()
Returns an array of all the DashboardListeners added to this DashboardGroup with
addDashboardListener. |
String[] |
getDashboards()
Gets all the dashboards. |
MouseInputListener |
getDragAndDropMouseInputListener()
Gets the mouse input listener needed to support drag-n-drop feature of the gadget component. |
Gadget |
getGadget(String key)
Gets the gadget by the key. |
GadgetListener[] |
getGadgetListeners()
Returns an array of all the GadgetListeners added to this GadgetGroup with
addGadgetListener. |
String[] |
getGadgets()
Gets all the gadgets added to be this GadgetManager. |
String |
getVersion()
Gets an optional version string. |
void |
hideGadget(GadgetComponent gadgetComponent)
Hides the GadgetComponent. |
protected void |
initManager()
Initializes the manager. |
void |
installListeners(Component component)
Installs getDragAndDropMouseInputListener and getCancelDragAndDropKeyListener to the components. |
boolean |
isAllowDragBetweenDashboard()
Get the flag indicating if the gadget is allowed to be dropped from one dashboard to another. |
boolean |
isAllowDragOutside()
Get the flag indicating if the gadget is allowed to be dropped in the closest location upon dragged outside of the Dashboard. |
boolean |
isAllowMultipleGadgetInstances()
Get the flag indicating if the gadget manager allows multiple gadget instances. |
boolean |
isColumnResizable()
Get the flag indicating if the column is resizable. |
boolean |
isDisposeGadgetsWhenHidingDashboard()
Checks the flag whether the gadgets will be disposed when the dashborad is hidden. |
boolean |
isGadgetShown(Gadget gadget)
Check if a gadget is displayed already. |
boolean |
isGadgetShown(String key)
Check if a gadget is displayed already. |
void |
maximizeGadget(GadgetComponent component)
Maximize the designated GadgetComponent. |
void |
maximizeGadget(int column,
int row)
Maximize the GadgetComponent in designated column and row in the active dashboard. |
void |
moveDashboard(String key,
int index)
Moves an existing dashboard. |
void |
removeAllDashboards()
Removes all the dashboards. |
boolean |
removeDashboard(String key)
Removes a dashboard. |
void |
removeDashboardListener(DashboardListener l)
Removes the specified dashboard listener so that it no longer receives dashboard events. |
boolean |
removeGadget(String key)
Removes an existing gadget. |
void |
removeGadgetListener(GadgetListener l)
Removes the specified gadget listener so that it no longer receives gadget events. |
void |
restoreGadget()
Restore the maximized GadgetComponent in the active dashboard. |
void |
setActiveDashboardKey(String key)
Sets the active Dashboard by the key. |
void |
setAllowDragBetweenDashboard(boolean allowDragBetweenDashboard)
Set the flag indicating if the gadget is allowed to be dropped from one dashboard to another. |
void |
setAllowDragOutside(boolean allowDragOutside)
Set the flag indicating if the gadget is allowed to be dropped in the closest location upon dragged outside of the Dashboard. |
void |
setAllowMultipleGadgetInstances(boolean allowMultipleGadgetInstances)
Set the flag indicating if the gadget manager allows multiple gadget instances. |
void |
setColumnResizable(boolean columnResizable)
Set the flag indicating if the column is resizable. |
void |
setDisposeGadgetsWhenHidingDashboard(boolean disposeGadgetsWhenHidingDashboard)
Sets the flag whether the gadgets will be disposed when the dashborad is hidden. |
void |
setVersion(String version)
Sets version string. |
void |
showGadget(Gadget gadget)
Shows a gadget. |
void |
showGadget(Gadget gadget,
Dashboard dashboard,
int column,
int index)
Shows a gadget. |
void |
uninstallListeners(Component component)
Uninstalls getDragAndDropMouseInputListener and getCancelDragAndDropKeyListener from the components. |
protected boolean |
validateGadgetDragging(Gadget gadget,
Container targetContainer)
A validation method before gadget is dropped to a target container. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected EventListenerList listenerList
| Constructor Detail |
|---|
public GadgetManager()
GadgetManager.
| Method Detail |
|---|
protected void initManager()
public void addGadget(Gadget gadget,
int index)
gadget - a new gadget to be added.index - the gadget index.public void addGadget(Gadget gadget)
gadget - a new gadget to be added.public boolean removeGadget(String key)
key - the key of the gadget to be removed.
public void showGadget(Gadget gadget)
gadget - the Gadget to be shown.
public void showGadget(Gadget gadget,
Dashboard dashboard,
int column,
int index)
gadget - the Gadget to be showndashboard - the dashboard to display the gadgetcolumn - the column in the dashboard to display the gadget. If the column is bigger than the column count
of the dashboard, nothing will displayindex - the index in the column to display the gadget. If the index is invalid, we will just add it to
the last available positionpublic boolean isGadgetShown(String key)
key - the key of the gadget
public boolean isGadgetShown(Gadget gadget)
gadget - the gadget
public void hideGadget(GadgetComponent gadgetComponent)
gadgetComponent - the GadgetComponent to be hidden.public void maximizeGadget(GadgetComponent component)
component - the gadget component
public void maximizeGadget(int column,
int row)
column - the column indexrow - the row indexpublic void restoreGadget()
public GadgetComponent createGadgetComponent(Gadget gadget)
gadget - the Gadget to be shown.
public String getActiveDashboardKey()
public void setActiveDashboardKey(String key)
DashboardEvent.DASHBOARD_DEACTIVATED on
the previous active dashboard and fire DashboardEvent.DASHBOARD_ACTIVATED on the newly activated
dashboard. However it is up to the DashboardHolder to listen to this event and
active the corresponding dashboard (for example, we did that in DashboardTabbedPane), or ignore it if there is
only one dashboard (such as SingleDashboardHolder)..
key - the key of the Dashboard to be activated.public Gadget getGadget(String key)
key - the key of the gadget.
public String[] getGadgets()
GadgetManager.
public void addDashboard(Dashboard dashboard)
dashboard - the dashboard to be added.public boolean removeDashboard(String key)
key - the key of the dashboard to be removed.
public void moveDashboard(String key,
int index)
key - the key of the dashboard to be moved.index - the new index.public void removeAllDashboards()
public Dashboard getDashboard(String key)
key - the key of the dashboard.
public int getDashboardIndex(String key)
key - the key of the dashboard.
public Dashboard getDashboard(int index)
index - the index
public String[] getDashboards()
public int getDashboardCount()
protected boolean validateGadgetDragging(Gadget gadget,
Container targetContainer)
gadget - the dragging gadgettargetContainer - the target container
public MouseInputListener getDragAndDropMouseInputListener()
installListeners(java.awt.Component) which will get the listener and add it.
public KeyListener getCancelDragAndDropKeyListener()
public void installListeners(Component component)
component - the component where two listeners will be added.public void uninstallListeners(Component component)
component - the component where two listeners were added.public void addGadgetListener(GadgetListener l)
l - the gadget listenerpublic void removeGadgetListener(GadgetListener l)
l - the gadget listenerpublic GadgetListener[] getGadgetListeners()
GadgetListeners added to this GadgetGroup with
addGadgetListener.
GadgetListeners added or an empty array if no listeners have been addedaddGadgetListener(com.jidesoft.dashboard.GadgetListener)protected void fireGadgetEvent(GadgetEvent e)
e - the eventpublic void addDashboardListener(DashboardListener l)
l - the dashboard listenerpublic void removeDashboardListener(DashboardListener l)
l - the dashboard listenerpublic DashboardListener[] getDashboardListeners()
DashboardListeners added to this DashboardGroup with
addDashboardListener.
DashboardListeners added or an empty array if no listeners have been addedaddDashboardListener(com.jidesoft.dashboard.DashboardListener)protected void fireDashboardEvent(DashboardEvent e)
e - the eventpublic String getVersion()
public void setVersion(String version)
version - the new versionpublic boolean isDisposeGadgetsWhenHidingDashboard()
public void setDisposeGadgetsWhenHidingDashboard(boolean disposeGadgetsWhenHidingDashboard)
DashboardPersistenceUtils.load(_documentPane, the layout file saved by DashboardPersistenceUtils);
try {
_documentPane.getGadgetManager().setDisposeGadgetsWhenHidingDashboard(false);
_documentPane.getLayoutPersistence().loadLayoutData();
}
finally {
_documentPane.getGadgetManager().setDisposeGadgetsWhenHidingDashboard(true);
}
disposeGadgetsWhenHidingDashboard - true or false.public boolean isColumnResizable()
public void setColumnResizable(boolean columnResizable)
columnResizable - the flagpublic boolean isAllowDragOutside()
public void setAllowDragOutside(boolean allowDragOutside)
allowDragOutside - the flagpublic boolean isAllowDragBetweenDashboard()
public void setAllowDragBetweenDashboard(boolean allowDragBetweenDashboard)
allowDragBetweenDashboard - the flagisAllowDragBetweenDashboard()public boolean isAllowMultipleGadgetInstances()
public void setAllowMultipleGadgetInstances(boolean allowMultipleGadgetInstances)
allowMultipleGadgetInstances - the flagisAllowMultipleGadgetInstances()
|
JIDE 2.9.5 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||