Package edu.wisc.ssec.mcidasv.ui
Class McvComponentGroup
java.lang.Object
ucar.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
- All Implemented Interfaces:
PropertyChangeListener,EventListener,Sharable
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
Nested ClassesModifier and TypeClassDescriptionprivate classHandle pop-up events for tabs. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringAction command for destroying a display.private static final StringAction command for ejecting a display from a tab.private static final StringAction command for renaming a display.private booleanWhether or not the "tab area" should be visible if there is only a single tab (defaults tofalse).private booleanWhether or not the title bar is hidden (defaults tofalse).protected static final StringPath to the "close tab" icon in the popup menu.protected static final StringPath to the "rename" icon in the popup menu.protected static final StringPath to the eject icon in the popup menu.private IntegratedDataViewerKeep a reference to avoid extraneous calls togetIdv().private booleanWhether or notinithas been called.private List<ComponentHolder> Holders that McV knows are held by this component group.private static final org.slf4j.Loggerprivate final JPopupMenuThe popup menu for the McV tabbed display interface.private intNumber of tabs that have been stored in this group.private booleanWhether or notredoLayout()needs to worry about a renamed tab.private IdvWindowReference 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, tabbedPaneFields inherited from class ucar.unidata.ui.ComponentHolder
ATTR_NAME, BORDER_NAMES, BORDERS, displayBtn, header, isRemoved, nameFld, parentFields inherited from class ucar.unidata.collab.PropertiedThing
propertiesDialog -
Constructor Summary
ConstructorsConstructorDescriptionDefault 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 contained in this group. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddComponent(ComponentHolder holder, int index) Adds a component holder to this group.createXmlNode(Document doc) Doesn't do anything for the time being...protected booleandestroyDisplay(int idx) Prompts the user to confirm removal of the component holder at indexidx.Create and return the GUI contents.protected JPopupMenuCreate theJPopupMenuthat will be displayed for a tab.private ComponentHolderejectDisplay(int idx) Remove the component holder at indexidx.intGet the index of the active tab in a group.protected intReturns the number of display components "in" this group.booleanbooleanprotected ComponentHoldergetHolderAt(int index) Returns theComponentHolderat the given position within this component group.voidgetViewManagers(List viewManagers) voidImporting 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.intindexOf(ComponentHolder holder) Returns the index ofholderwithin this component group.private voidinit()Initializes the various UI components.voidvoidmakeDynamicSkin(Element root) Basically just creates a McVCompHolder for holding a dynamic skin and sets the name of the component holder.voidCreate a new component whose type will be determined by the contents ofwhat.voidmakeSkin(int index) Handles creation of the component represented by the XML skin at the given index.makeSkinAtIndex(int index) private StringmakeWindowTitle(String title) Create a window title suitable for an application window.intquietAddComponent(ComponentHolder component) Adds a component to the end of the list of display components without forcing the IDV-land code to redraw.quietRemoveComponentAt(int index) Remove the component atindexwithout forcing the IDV-land component group to redraw.voidForces this group to layout its components.protected voidrenameDisplay(int idx) Prompt the user to change the name of the component holder at indexidx.voidUsed to set the tab associated withholderas the active tab in ourJTabbedPane.booleansetActiveIndex(int index) Make the component holder atindexactive.voidsetHideTabArea(boolean hide) voidsetHideTitleBar(boolean hide) voidsetIdv(IntegratedDataViewer newIdv) Overridden so that McV can also update its copy of the IDV reference.private booleanshouldGenerateName(ComponentHolder h, int i) Methods inherited from class ucar.unidata.idv.ui.IdvComponentGroup
addGroups, applyProperties, doDrop, dropOk, getAutoImportDisplays, getIdv, getPopupMenuItems, getPropertiesComponents, importAllDisplayControls, setAutoImportDisplays, tryToImportDisplayControl, writeSkinMethods 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, xxxxgetPropertyTabsMethods 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, showPopupMethods inherited from class ucar.unidata.collab.PropertiedThing
addPropertyChangeListener, doApplyProperties, firePropertyChange, firePropertyChange, getPropertyListeners, getPropertyTabs, isShowing, propertyChange, removePropertyChangeListener, showProperties, showPropertiesMethods 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
-
Field Details
-
logger
-
ICO_CLOSE
Path to the "close tab" icon in the popup menu.- See Also:
-
ICO_RENAME
Path to the "rename" icon in the popup menu.- See Also:
-
ICO_UNDOCK
Path to the eject icon in the popup menu.- See Also:
-
CMD_DISPLAY_DESTROY
Action command for destroying a display.- See Also:
-
CMD_DISPLAY_EJECT
Action command for ejecting a display from a tab.- See Also:
-
CMD_DISPLAY_RENAME
Action command for renaming a display.- See Also:
-
popup
The popup menu for the McV tabbed display interface. -
tabCount
Number of tabs that have been stored in this group. -
initDone
Whether or notinithas been called. -
knownHolders
Holders that McV knows are held by this component group. Used to avoid any needless work inredoLayout. -
idv
Keep a reference to avoid extraneous calls togetIdv(). -
window
Reference to the window associated with this group. -
tabRenamed
Whether or notredoLayout()needs to worry about a renamed tab. -
hideTabArea
Whether or not the "tab area" should be visible if there is only a single tab (defaults tofalse). -
hideTitleBar
Whether or not the title bar is hidden (defaults tofalse).
-
-
Constructor Details
-
McvComponentGroup
public McvComponentGroup()Default constructor for serialization. -
McvComponentGroup
A pretty typical constructor.- Parameters:
idv- The main IDV instance.name- Presumably the name of this component group?
-
McvComponentGroup
This constructor catches the window that will be contained in this group.- Parameters:
idv- The main IDV instance.name- Presumably the name of this component group?window- The window holding this component group.
-
-
Method Details
-
getHideTabArea
-
setHideTabArea
-
getHideTitleBar
-
setHideTitleBar
-
init
Initializes the various UI components. -
initWith
- Overrides:
initWithin classIdvComponentGroup
-
doMakeContents
Create and return the GUI contents. Overridden so that McV can implement the right click tab menu and draggable tabs.- Overrides:
doMakeContentsin classComponentGroup- Returns:
- GUI contents
-
importDisplayControl
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.
- Overrides:
importDisplayControlin classIdvComponentGroup- Parameters:
dc- The display control to import.
-
makeDynamicSkin
Basically just creates a McVCompHolder for holding a dynamic skin and sets the name of the component holder.- Parameters:
root- The XML skin that we'll use.
-
createXmlNode
Doesn't do anything for the time being...- Overrides:
createXmlNodein classIdvComponentGroup- Parameters:
doc-- Returns:
- XML representation of the contents of this component group.
-
makeSkin
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.
- Overrides:
makeSkinin classIdvComponentGroup- Parameters:
index- The index of the skin within the skin resource.
-
makeSkinAtIndex
-
makeNew
Create a new component whose type will be determined by the contents ofwhat.Overridden so that McV can wrap up the components in McVComponentHolders, which allow McV to map ViewManagers to ComponentHolders.
- Overrides:
makeNewin classIdvComponentGroup- Parameters:
what- String that determines what sort of component we create.
-
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.- Overrides:
redoLayoutin classComponentGroup- See Also:
-
getViewManagers
- Overrides:
getViewManagersin classIdvComponentGroup
-
addComponent
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.- Overrides:
addComponentin classComponentGroup- Parameters:
holder-index-- See Also:
-
shouldGenerateName
-
setActiveComponentHolder
Used to set the tab associated withholderas the active tab in ourJTabbedPane.- Parameters:
holder- The active component holder.
-
getActiveIndex
Get the index of the active tab in a group.- Returns:
- The index of the active component holder within this group.
-
setActiveIndex
Make the component holder atindexactive.- Parameters:
index- The index of the desired component holder.- Returns:
- True if the active component holder was set, false otherwise.
-
indexOf
Returns the index ofholderwithin this component group.- Overrides:
indexOfin classComponentGroup- Returns:
- Either the index of
holder, or-1ifComponentGroup.getDisplayComponents()returns anullList. - See Also:
-
getHolderAt
Returns theComponentHolderat the given position within this component group.- Parameters:
index- Index of theComponentHolderto return.- Returns:
ComponentHolderatindex.- See Also:
-
getActiveComponentHolder
- Returns:
- Component holder that corresponds to the selected tab.
-
setIdv
Overridden so that McV can also update its copy of the IDV reference.- Overrides:
setIdvin classIdvComponentGroup
-
makeWindowTitle
Create a window title suitable for an application window.- Parameters:
title- Window title- Returns:
- Application title plus the window title.
-
getDisplayComponentCount
Returns the number of display components "in" this group.- Returns:
- Either the
size()of theListreturned byComponentGroup.getDisplayComponents()or-1ifgetDisplayComponents()returns anullList.
-
doMakeTabMenu
Create theJPopupMenuthat will be displayed for a tab.- Returns:
- Menu initialized with tab options
-
ejectDisplay
Remove the component holder at indexidx. This method does not destroy the component holder.- Parameters:
idx- Index of the ejected component holder.- Returns:
- Component holder that was ejected.
-
renameDisplay
Prompt the user to change the name of the component holder at indexidx. Nothing happens if the user doesn't enter anything.- Parameters:
idx- Index of the component holder.
-
destroyDisplay
Prompts the user to confirm removal of the component holder at indexidx. Nothing happens if the user declines.- Parameters:
idx- Index of the component holder.- Returns:
- Either
trueif the user elected to remove,falseotherwise.
-
quietRemoveComponentAt
Remove the component atindexwithout forcing the IDV-land component group to redraw.- Parameters:
index- The index of the component to be removed.- Returns:
- The removed component.
-
quietAddComponent
Adds a component to the end of the list of display components without forcing the IDV-land code to redraw.- Parameters:
component- The component to add.- Returns:
- The index of the newly added component, or
-1ifComponentGroup.getDisplayComponents()returned a nullList.
-