|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectucar.unidata.collab.SharableImpl
ucar.unidata.collab.PropertiedThing
ucar.unidata.ui.ComponentHolder
ucar.unidata.ui.ComponentGroup
ucar.unidata.idv.ui.IdvComponentGroup
edu.wisc.ssec.mcidasv.ui.McvComponentGroup
public class McvComponentGroup
Extends the IDV component groups so that we can intercept clicks for Bruce's tab popup menu and handle drag and drop. It also intercepts ViewManager creation in order to wrap components in McIDASVComponentHolders rather than IdvComponentHolders. Doing this allows us to associate ViewManagers back to their ComponentHolders, and this functionality is taken advantage of to form the hierarchical names seen in the McIDASVViewPanel.
Nested Class Summary | |
---|---|
private class |
McvComponentGroup.TabPopupListener
Handle pop-up events for tabs. |
Field Summary | |
---|---|
private static String |
CMD_DISPLAY_DESTROY
Action command for destroying a display. |
private static String |
CMD_DISPLAY_EJECT
Action command for ejecting a display from a tab. |
private static String |
CMD_DISPLAY_RENAME
Action command for renaming a display. |
protected static String |
ICO_CLOSE
Path to the "close tab" icon in the popup menu. |
protected static String |
ICO_RENAME
Path to the "rename" icon in the popup menu. |
protected static String |
ICO_UNDOCK
Path to the eject icon in the popup menu. |
private IntegratedDataViewer |
idv
Keep a reference to avoid extraneous calls to getIdv(). |
private boolean |
initDone
Whether or not init has been called. |
private List<ComponentHolder> |
knownHolders
Holders that McV knows are held by this component group. |
private JPopupMenu |
popup
The popup menu for the McV tabbed display interface. |
private int |
tabCount
Number of tabs that have been stored in this group. |
private boolean |
tabRenamed
Whether or not redoLayout() needs to worry about a renamed
tab. |
private IdvWindow |
window
Reference to the window associated with this group. |
Fields inherited from class ucar.unidata.ui.ComponentGroup |
---|
container, LAYOUT_BORDER, LAYOUT_DESKTOP, LAYOUT_GRAPH, LAYOUT_GRID, LAYOUT_GRIDBAG, LAYOUT_HSPLIT, LAYOUT_LIST, LAYOUT_MENU, LAYOUT_NAMES, LAYOUT_TABS, LAYOUT_TREE, LAYOUT_VSPLIT, LAYOUTS, outerContainer, tabbedPane |
Fields inherited from class ucar.unidata.ui.ComponentHolder |
---|
ATTR_NAME, BORDER_NAMES, BORDERS, displayBtn, header, isRemoved, nameFld, parent |
Fields inherited from class ucar.unidata.collab.PropertiedThing |
---|
propertiesDialog |
Constructor Summary | |
---|---|
McvComponentGroup()
Default constructor for serialization. |
|
McvComponentGroup(IntegratedDataViewer idv,
String name)
A pretty typical constructor. |
|
McvComponentGroup(IntegratedDataViewer idv,
String name,
IdvWindow window)
This constructor catches the window that will be contain this group. |
Method Summary | |
---|---|
void |
addComponent(ComponentHolder holder,
int index)
Adds a component holder to this group. |
Element |
createXmlNode(Document doc)
Doesn't do anything for the time being... |
protected boolean |
destroyDisplay(int idx)
Prompts the user to confirm removal of the component holder at index idx . |
JComponent |
doMakeContents()
Create and return the GUI contents. |
protected JPopupMenu |
doMakeTabMenu()
Create the JPopupMenu that will be displayed for a tab. |
private ComponentHolder |
ejectDisplay(int idx)
Remove the component holder at index idx . |
ComponentHolder |
getActiveComponentHolder()
|
int |
getActiveIndex()
|
protected int |
getDisplayComponentCount()
Returns the number of display components "in" this group. |
protected ComponentHolder |
getHolderAt(int index)
Returns the ComponentHolder at the given position within this
component group. |
void |
getViewManagers(List viewManagers)
|
void |
importDisplayControl(DisplayControlImpl dc)
Importing a display control entails adding the control to the component group and informing the UI that the control is no longer in its own window. |
int |
indexOf(ComponentHolder holder)
Returns the index of holder within this component group. |
private void |
init()
Initializes the various UI components. |
void |
makeDynamicSkin(Element root)
Basically just creates a McVCompHolder for holding a dynamic skin and sets the name of the component holder. |
void |
makeNew(String what)
Create a new component whose type will be determined by the contents of what . |
void |
makeSkin(int index)
Handles creation of the component represented by the XML skin at the given index. |
IdvComponentHolder |
makeSkinAtIndex(int index)
|
private String |
makeWindowTitle(String title)
Create a window title suitable for an application window. |
int |
quietAddComponent(ComponentHolder component)
Adds a component to the end of the list of display components without forcing the IDV-land code to redraw. |
ComponentHolder |
quietRemoveComponentAt(int index)
Remove the component at index without forcing the IDV-land
component group to redraw. |
void |
redoLayout()
Forces this group to layout its components. |
protected void |
renameDisplay(int idx)
Prompt the user to change the name of the component holder at index idx . |
void |
setActiveComponentHolder(ComponentHolder holder)
Used to set the tab associated with holder as the active tab
in our JTabbedPane . |
boolean |
setActiveIndex(int index)
Make the component holder at index active. |
void |
setIdv(IntegratedDataViewer newIdv)
Overridden so that McV can also update its copy of the IDV reference. |
private boolean |
shouldGenerateName(ComponentHolder h,
int i)
|
Methods inherited from class ucar.unidata.idv.ui.IdvComponentGroup |
---|
addGroups, applyProperties, doDrop, dropOk, getAutoImportDisplays, getIdv, getPopupMenuItems, getPropertiesComponents, importAllDisplayControls, initWith, setAutoImportDisplays, tryToImportDisplayControl, writeSkin |
Methods inherited from class ucar.unidata.ui.ComponentGroup |
---|
addComponent, doRemove, editLayout, findComponentsWithType, getDisplayComponents, getGridColumns, getIconified, getLastPosition, getLayout, getNumColumns, getNumRows, getTypeName, isAncestor, main, makeTree, print, removeComponent, setDisplayComponents, setGridColumns, setIconified, setLastPosition, setLayout, setNumColumns, setNumRows, setRowsColumns, setState, subtreeChanged, toString, wrapContents, xxxxgetPropertyTabs |
Methods inherited from class ucar.unidata.ui.ComponentHolder |
---|
clearContents, doMakeHeader, getBeingShown, getBorder, getBorderLayoutLocation, getCategory, getContents, getHierachicalName, getIcon, getInternalFrame, getInternalFrameShown, getLayoutRect, getName, getParent, getRoot, getShowHeader, removeDisplayComponent, setBorder, setBorder, setBorderLayoutLocation, setCategory, setInternalFrameShown, setLayoutRect, setName, setParent, setShowHeader, showPopup |
Methods inherited from class ucar.unidata.collab.PropertiedThing |
---|
addPropertyChangeListener, doApplyProperties, firePropertyChange, firePropertyChange, getPropertyListeners, getPropertyTabs, isShowing, propertyChange, removePropertyChangeListener, showProperties, showProperties |
Methods inherited from class ucar.unidata.collab.SharableImpl |
---|
applySharableProperties, doShare, doShare, doShareExternal, doShareInternal, getReceiveShareTime, getSharablePropertiesComponent, getShareGroup, getSharing, getUniqueId, initSharable, receiveShareData, removeSharable, setReceiveShareTime, setShareGroup, setSharing, setUniqueId, showSharableDialog |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final String ICO_CLOSE
protected static final String ICO_RENAME
protected static final String ICO_UNDOCK
private static final String CMD_DISPLAY_DESTROY
private static final String CMD_DISPLAY_EJECT
private static final String CMD_DISPLAY_RENAME
private final JPopupMenu popup
private int tabCount
private boolean initDone
init
has been called.
private List<ComponentHolder> knownHolders
redoLayout
.
private IntegratedDataViewer idv
private IdvWindow window
private boolean tabRenamed
redoLayout()
needs to worry about a renamed
tab.
Constructor Detail |
---|
public McvComponentGroup()
public McvComponentGroup(IntegratedDataViewer idv, String name)
idv
- The main IDV instance.name
- Presumably the name of this component group?public McvComponentGroup(IntegratedDataViewer idv, String name, IdvWindow window)
idv
- The main IDV instance.name
- Presumably the name of this component group?window
- The window holding this component group.Method Detail |
---|
private void init()
public JComponent doMakeContents()
doMakeContents
in class ComponentGroup
public void importDisplayControl(DisplayControlImpl dc)
Importing a display control entails adding the control to the component group and informing the UI that the control is no longer in its own window.
Overridden in McV so that the display control is wrapped in a McIDASVComponentHolder rather than a IdvComponentHolder.
importDisplayControl
in class IdvComponentGroup
dc
- The display control to import.public void makeDynamicSkin(Element root)
root
- The XML skin that we'll use.public Element createXmlNode(Document doc)
createXmlNode
in class IdvComponentGroup
doc
-
public void makeSkin(int index)
Handles creation of the component represented by the XML skin at the given index.
Overridden so that McV can wrap the component in a McIDASVComponentHolder.
makeSkin
in class IdvComponentGroup
index
- The index of the skin within the skin resource.public IdvComponentHolder makeSkinAtIndex(int index)
public void makeNew(String what)
Create a new component whose type will be determined by the contents of
what
.
Overridden so that McV can wrap up the components in McVComponentHolders, which allow McV to map ViewManagers to ComponentHolders.
makeNew
in class IdvComponentGroup
what
- String that determines what sort of component we create.public void redoLayout()
Forces this group to layout its components. Extended because the IDV was doing extra work that McIDAS-V doesn't need, such as dealing with layouts other than LAYOUT_TABS and needlessly reinitializing the group's container.
redoLayout
in class ComponentGroup
ComponentGroup.redoLayout()
public void getViewManagers(List viewManagers)
getViewManagers
in class IdvComponentGroup
public void addComponent(ComponentHolder holder, int index)
Adds a component holder to this group. Extended so that the added holder becomes the active tab, and the component is explicitly set to visible in an effort to fix that heavyweight/lightweight component problem.
addComponent
in class ComponentGroup
holder
- index
- ComponentGroup.addComponent(ComponentHolder, int)
private boolean shouldGenerateName(ComponentHolder h, int i)
public void setActiveComponentHolder(ComponentHolder holder)
holder
as the active tab
in our JTabbedPane
.
holder
- The active component holder.public int getActiveIndex()
public boolean setActiveIndex(int index)
index
active.
index
- The index of the desired component holder.
public int indexOf(ComponentHolder holder)
holder
within this component group.
indexOf
in class ComponentGroup
holder
, or -1
if ComponentGroup.getDisplayComponents()
returns a null
List
.List.indexOf(Object)
protected ComponentHolder getHolderAt(int index)
ComponentHolder
at the given position within this
component group.
index
- Index of the ComponentHolder
to return.
ComponentHolder
at index
.List.get(int)
public ComponentHolder getActiveComponentHolder()
public void setIdv(IntegratedDataViewer newIdv)
setIdv
in class IdvComponentGroup
private String makeWindowTitle(String title)
title
- Window title
protected int getDisplayComponentCount()
size()
of the List
returned by
ComponentGroup.getDisplayComponents()
or -1
if
getDisplayComponents()
returns a null
List
.protected JPopupMenu doMakeTabMenu()
private ComponentHolder ejectDisplay(int idx)
idx
. This method does
not destroy the component holder.
idx
- Index of the ejected component holder.
protected void renameDisplay(int idx)
idx
. Nothing happens if the user doesn't enter anything.
idx
- Index of the component holder.protected boolean destroyDisplay(int idx)
idx
. Nothing happens if the user declines.
idx
- Index of the component holder.
true
if the user elected to remove,
false
otherwise.public ComponentHolder quietRemoveComponentAt(int index)
index
without forcing the IDV-land
component group to redraw.
index
- The index of the component to be removed.
public int quietAddComponent(ComponentHolder component)
component
- The component to add.
-1
if
ComponentGroup.getDisplayComponents()
returned a null List
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |