public class McvComponentGroup extends ucar.unidata.idv.ui.IdvComponentGroup
Modifier and Type | Class and Description |
---|---|
private class |
McvComponentGroup.TabPopupListener
Handle pop-up events for tabs.
|
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
CMD_DISPLAY_DESTROY
Action command for destroying a display.
|
private static java.lang.String |
CMD_DISPLAY_EJECT
Action command for ejecting a display from a tab.
|
private static java.lang.String |
CMD_DISPLAY_RENAME
Action command for renaming a display.
|
private boolean |
hideTabArea
Whether or not the "tab area" should be visible if there is
only a single tab (defaults to
false ). |
private boolean |
hideTitleBar
Whether or not the title bar is hidden (defaults to
false ). |
protected static java.lang.String |
ICO_CLOSE
Path to the "close tab" icon in the popup menu.
|
protected static java.lang.String |
ICO_RENAME
Path to the "rename" icon in the popup menu.
|
protected static java.lang.String |
ICO_UNDOCK
Path to the eject icon in the popup menu.
|
private ucar.unidata.idv.IntegratedDataViewer |
idv
Keep a reference to avoid extraneous calls to
getIdv() . |
private boolean |
initDone
Whether or not
init has been called. |
private java.util.List<ucar.unidata.ui.ComponentHolder> |
knownHolders
Holders that McV knows are held by this component group.
|
private javax.swing.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 ucar.unidata.idv.ui.IdvWindow |
window
Reference to the window associated with this group.
|
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
Constructor and Description |
---|
McvComponentGroup()
Default constructor for serialization.
|
McvComponentGroup(ucar.unidata.idv.IntegratedDataViewer idv,
java.lang.String name)
A pretty typical constructor.
|
McvComponentGroup(ucar.unidata.idv.IntegratedDataViewer idv,
java.lang.String name,
ucar.unidata.idv.ui.IdvWindow window)
This constructor catches the window that will be contained in this group.
|
Modifier and Type | Method and Description |
---|---|
void |
addComponent(ucar.unidata.ui.ComponentHolder holder,
int index)
Adds a component holder to this group.
|
org.w3c.dom.Element |
createXmlNode(org.w3c.dom.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 . |
javax.swing.JComponent |
doMakeContents()
Create and return the GUI contents.
|
protected javax.swing.JPopupMenu |
doMakeTabMenu()
Create the
JPopupMenu that will be displayed for a tab. |
private ucar.unidata.ui.ComponentHolder |
ejectDisplay(int idx)
Remove the component holder at index
idx . |
ucar.unidata.ui.ComponentHolder |
getActiveComponentHolder() |
int |
getActiveIndex()
Get the index of the active tab in a group.
|
protected int |
getDisplayComponentCount()
Returns the number of display components "in" this group.
|
boolean |
getHideTabArea() |
boolean |
getHideTitleBar() |
protected ucar.unidata.ui.ComponentHolder |
getHolderAt(int index)
Returns the
ComponentHolder at the given position within this
component group. |
void |
getViewManagers(java.util.List viewManagers) |
void |
importDisplayControl(ucar.unidata.idv.control.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(ucar.unidata.ui.ComponentHolder holder)
Returns the index of
holder within this component group. |
private void |
init()
Initializes the various UI components.
|
void |
initWith(org.w3c.dom.Element node) |
void |
makeDynamicSkin(org.w3c.dom.Element root)
Basically just creates a McVCompHolder for holding a dynamic skin and
sets the name of the component holder.
|
void |
makeNew(java.lang.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.
|
ucar.unidata.idv.ui.IdvComponentHolder |
makeSkinAtIndex(int index) |
private java.lang.String |
makeWindowTitle(java.lang.String title)
Create a window title suitable for an application window.
|
int |
quietAddComponent(ucar.unidata.ui.ComponentHolder component)
Adds a component to the end of the list of display components without
forcing the IDV-land code to redraw.
|
ucar.unidata.ui.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(ucar.unidata.ui.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 |
setHideTabArea(boolean hide) |
void |
setHideTitleBar(boolean hide) |
void |
setIdv(ucar.unidata.idv.IntegratedDataViewer newIdv)
Overridden so that McV can also update its copy of the IDV reference.
|
private boolean |
shouldGenerateName(ucar.unidata.ui.ComponentHolder h,
int i) |
addGroups, applyProperties, doDrop, dropOk, getAutoImportDisplays, getIdv, getPopupMenuItems, getPropertiesComponents, importAllDisplayControls, setAutoImportDisplays, tryToImportDisplayControl, writeSkin
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
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
addPropertyChangeListener, doApplyProperties, firePropertyChange, firePropertyChange, getPropertyListeners, getPropertyTabs, isShowing, propertyChange, removePropertyChangeListener, showProperties, showProperties
applySharableProperties, doShare, doShare, doShareExternal, doShareInternal, getReceiveShareTime, getSharablePropertiesComponent, getShareGroup, getSharing, getUniqueId, initSharable, receiveShareData, removeSharable, setReceiveShareTime, setShareGroup, setSharing, setUniqueId, showSharableDialog
protected static final java.lang.String ICO_CLOSE
protected static final java.lang.String ICO_RENAME
protected static final java.lang.String ICO_UNDOCK
private static final java.lang.String CMD_DISPLAY_DESTROY
private static final java.lang.String CMD_DISPLAY_EJECT
private static final java.lang.String CMD_DISPLAY_RENAME
private final javax.swing.JPopupMenu popup
private int tabCount
private boolean initDone
init
has been called.private java.util.List<ucar.unidata.ui.ComponentHolder> knownHolders
redoLayout
.private ucar.unidata.idv.IntegratedDataViewer idv
getIdv()
.private ucar.unidata.idv.ui.IdvWindow window
private boolean tabRenamed
redoLayout()
needs to worry about a renamed
tab.private boolean hideTabArea
false
).private boolean hideTitleBar
false
).public McvComponentGroup()
public McvComponentGroup(ucar.unidata.idv.IntegratedDataViewer idv, java.lang.String name)
idv
- The main IDV instance.name
- Presumably the name of this component group?public McvComponentGroup(ucar.unidata.idv.IntegratedDataViewer idv, java.lang.String name, ucar.unidata.idv.ui.IdvWindow window)
idv
- The main IDV instance.name
- Presumably the name of this component group?window
- The window holding this component group.public boolean getHideTabArea()
public void setHideTabArea(boolean hide)
public boolean getHideTitleBar()
public void setHideTitleBar(boolean hide)
private void init()
public void initWith(org.w3c.dom.Element node)
initWith
in class ucar.unidata.idv.ui.IdvComponentGroup
public javax.swing.JComponent doMakeContents()
doMakeContents
in class ucar.unidata.ui.ComponentGroup
public void importDisplayControl(ucar.unidata.idv.control.DisplayControlImpl dc)
Overridden in McV so that the display control is wrapped in a McIDASVComponentHolder rather than a IdvComponentHolder.
importDisplayControl
in class ucar.unidata.idv.ui.IdvComponentGroup
dc
- The display control to import.public void makeDynamicSkin(org.w3c.dom.Element root)
root
- The XML skin that we'll use.public org.w3c.dom.Element createXmlNode(org.w3c.dom.Document doc)
createXmlNode
in class ucar.unidata.idv.ui.IdvComponentGroup
doc
- public void makeSkin(int index)
Overridden so that McV can wrap the component in a McIDASVComponentHolder.
makeSkin
in class ucar.unidata.idv.ui.IdvComponentGroup
index
- The index of the skin within the skin resource.public ucar.unidata.idv.ui.IdvComponentHolder makeSkinAtIndex(int index)
public void makeNew(java.lang.String what)
what
.
Overridden so that McV can wrap up the components in McVComponentHolders, which allow McV to map ViewManagers to ComponentHolders.
makeNew
in class ucar.unidata.idv.ui.IdvComponentGroup
what
- String that determines what sort of component we create.public void redoLayout()
redoLayout
in class ucar.unidata.ui.ComponentGroup
ComponentGroup.redoLayout()
public void getViewManagers(java.util.List viewManagers)
getViewManagers
in class ucar.unidata.idv.ui.IdvComponentGroup
public void addComponent(ucar.unidata.ui.ComponentHolder holder, int index)
addComponent
in class ucar.unidata.ui.ComponentGroup
holder
- index
- ComponentGroup.addComponent(ComponentHolder, int)
private boolean shouldGenerateName(ucar.unidata.ui.ComponentHolder h, int i)
public void setActiveComponentHolder(ucar.unidata.ui.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(ucar.unidata.ui.ComponentHolder holder)
holder
within this component group.indexOf
in class ucar.unidata.ui.ComponentGroup
holder
, or -1
if ComponentGroup.getDisplayComponents()
returns a null
List
.List.indexOf(Object)
protected ucar.unidata.ui.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 ucar.unidata.ui.ComponentHolder getActiveComponentHolder()
public void setIdv(ucar.unidata.idv.IntegratedDataViewer newIdv)
setIdv
in class ucar.unidata.idv.ui.IdvComponentGroup
private java.lang.String makeWindowTitle(java.lang.String title)
title
- Window titleprotected int getDisplayComponentCount()
size()
of the List
returned by
ComponentGroup.getDisplayComponents()
or -1
if
getDisplayComponents()
returns a null
List
.protected javax.swing.JPopupMenu doMakeTabMenu()
JPopupMenu
that will be displayed for a tab.private ucar.unidata.ui.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 ucar.unidata.ui.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(ucar.unidata.ui.ComponentHolder component)
component
- The component to add.-1
if
ComponentGroup.getDisplayComponents()
returned a null List
.