|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.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. |
static String |
PROPERTY_ALLOW_DRAG_BETWEEN_DASHBOARD
|
static String |
PROPERTY_ALLOW_DRAG_OUTSIDE
|
static String |
PROPERTY_ALLOW_MULTIPLE_GADGET_INSTANCES
|
static String |
PROPERTY_AUTO_ACTIVATE
|
static String |
PROPERTY_BATCH_PROCESSING
|
static String |
PROPERTY_COLUMN_RESIZABLE
|
static String |
PROPERTY_DISPOSE_GADGET_WHEN_HIDING_DASHBOARD
|
static String |
PROPERTY_REARRANGABLE
|
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. |
void |
addGadgets(Gadget[] gadgets)
Adds new gadgets. |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. |
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list for a specific property. |
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. |
protected void |
firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
Support for reporting bound property changes for Object properties. |
protected void |
gadgetButtonDoubleClicked(Gadget gadget)
The action to take while the gadget button is double clicked. |
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 DashboardListener s 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 GadgetListener s added to this GadgetGroup with
addGadgetListener . |
String[] |
getGadgets()
Gets all the gadgets added to be this GadgetManager . |
PropertyChangeListener[] |
getPropertyChangeListeners()
Returns an array of all the property change listeners registered on this gadget manager. |
PropertyChangeListener[] |
getPropertyChangeListeners(String propertyName)
Returns an array of all the listeners which have been associated with the named property. |
String |
getVersion()
Gets an optional version string. |
void |
hideGadget(GadgetComponent gadgetComponent)
Deprecated. replaced by hideGadgetComponent(GadgetComponent) |
void |
hideGadgetComponent(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 |
isAutoActivate()
If the dashboard should be activated when the tab is selected. |
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. |
boolean |
isRearrangable()
If the gadget components can be rearranged. |
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 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 |
removeGadgets(String[] keys)
Removes existing gadgets. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. |
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list for a specific property. |
void |
restoreGadget()
Deprecated. replaced by restoreGadgetComponent() |
void |
restoreGadgetComponent()
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 |
setAutoActivate(boolean autoActivate)
Sets the flag if the dashboard should be activated when the tab is selected. |
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 |
setRearrangable(boolean rearrangable)
Enable or disable the rearrangement of gadget components. |
void |
setVersion(String version)
Sets version string. |
void |
showGadget(Gadget gadget)
Shows a gadget. |
void |
showGadget(Gadget gadget,
Dashboard dashboard,
int index)
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. |
protected boolean |
validateGadgetDragging(Gadget gadget,
Container targetContainer,
int index)
A validation method before gadget is dropped to a target container. |
protected boolean |
validateGadgetDragging(Gadget gadget,
Container targetContainer,
int index,
boolean draggingButton)
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
public static final String PROPERTY_BATCH_PROCESSING
public static final String PROPERTY_ALLOW_DRAG_BETWEEN_DASHBOARD
public static final String PROPERTY_ALLOW_MULTIPLE_GADGET_INSTANCES
public static final String PROPERTY_ALLOW_DRAG_OUTSIDE
public static final String PROPERTY_COLUMN_RESIZABLE
public static final String PROPERTY_DISPOSE_GADGET_WHEN_HIDING_DASHBOARD
public static final String PROPERTY_REARRANGABLE
public static final String PROPERTY_AUTO_ACTIVATE
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 void addGadgets(Gadget[] gadgets)
gadgets
- new gadgets to be added.public void removeGadgets(String[] keys)
keys
- the keys of the existing gadgets to be removed.public boolean removeGadget(String key)
key
- the key of the gadget to be removed.
protected void gadgetButtonDoubleClicked(Gadget gadget)
gadget
- the gadgetpublic void showGadget(Gadget gadget)
gadget
- the Gadget to be shown.public void showGadget(Gadget gadget, Dashboard dashboard, int index)
Dashboard.isPredefinedLayoutSet()
returns true, it will replace the component at
index. If the flag returns false, it will show the gadget at column 0, row index.
gadget
- the Gadget to be showndashboard
- the dashboard to display the gadgetindex
- the index in the column to display the gadget. If the index is invalid, we will just add it to
the last available positionpublic 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
@Deprecated public void hideGadget(GadgetComponent gadgetComponent)
hideGadgetComponent(GadgetComponent)
gadgetComponent
- the GadgetComponent to be hidden.public void hideGadgetComponent(GadgetComponent gadgetComponent)
gadgetComponent
- the GadgetComponent to be hidden.@Deprecated public void maximizeGadget(GadgetComponent component)
maximizeGadgetComponent(GadgetComponent)
component
- the gadget componentpublic void maximizeGadgetComponent(GadgetComponent component)
component
- the gadget component@Deprecated public void maximizeGadget(int column, int row)
maximizeGadgetComponent(int, int)
column
- the column indexrow
- the row indexpublic void maximizeGadgetComponent(int column, int row)
column
- the column indexrow
- the row index@Deprecated public void restoreGadget()
restoreGadgetComponent()
public void restoreGadgetComponent()
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, int index, boolean draggingButton)
validateGadgetDragging(Gadget, java.awt.Container, int)
to keep backward compatibility. You could override
this method to add some widgets or checking here.
gadget
- the dragging gadgettargetContainer
- the target containerindex
- the index where the dragging gadget would be put into the target containerdraggingButton
- the flag to indicate if the gadget button is dragged or not
protected boolean validateGadgetDragging(Gadget gadget, Container targetContainer, int index)
validateGadgetDragging(Gadget, java.awt.Container)
to keep backward compatibility. You could override
this method to add some widgets or checking here.
gadget
- the dragging gadgettargetContainer
- the target containerindex
- the index where the dragging gadget would be put into the target container
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()
GadgetListener
s added to this GadgetGroup
with
addGadgetListener
.
GadgetListener
s 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()
DashboardListener
s added to this DashboardGroup
with
addDashboardListener
.
DashboardListener
s 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()
public void addPropertyChangeListener(PropertyChangeListener listener)
listener
- the property change listener to be addedremovePropertyChangeListener(java.beans.PropertyChangeListener)
,
getPropertyChangeListeners()
,
addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener listener)
listener
- the PropertyChangeListener to be removedaddPropertyChangeListener(java.beans.PropertyChangeListener)
,
getPropertyChangeListeners()
,
removePropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)
public PropertyChangeListener[] getPropertyChangeListeners()
PropertyChangeListener
s or an empty array if no property change
listeners are currently registeredaddPropertyChangeListener(java.beans.PropertyChangeListener)
,
removePropertyChangeListener(java.beans.PropertyChangeListener)
,
getPropertyChangeListeners(java.lang.String)
,
PropertyChangeSupport.getPropertyChangeListeners()
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
propertyName
- one of the property names listed abovelistener
- the property change listener to be addedremovePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
,
getPropertyChangeListeners(java.lang.String)
,
addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
PropertyChangeListener
from the listener list for a specific property.
propertyName
- a valid property namelistener
- the PropertyChangeListener to be removedaddPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
,
getPropertyChangeListeners(java.lang.String)
,
removePropertyChangeListener(java.beans.PropertyChangeListener)
public PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
propertyName
- the name of the property
PropertyChangeListener
s associated with the named property; if no such listeners
have been added or if propertyName
is null
, an empty array is returnedaddPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
,
removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
,
getPropertyChangeListeners()
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
propertyName
- the property whose value has changedoldValue
- the property's previous valuenewValue
- the property's new valuepublic boolean isRearrangable()
public void setRearrangable(boolean rearrangable)
rearrangable
- true if the gadget components can be rearranged by user.public boolean isAutoActivate()
public void setAutoActivate(boolean autoActivate)
autoActivate
- true the dashboard should be activated when the corresponding tab is selected
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |