Package com.portal.bas.comp
Class PIATabPane
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTabbedPane
com.portal.bas.comp.PIATabPane
- All Implemented Interfaces:
PAppComponent
,PClientComponent
,PComponent
,PViewDataChangeListener
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
,ChangeListener
,SwingConstants
A JTabbedPane component that also allows switching panels within a
particular Tab via a popup menu which can be activated on the Tab.
This provides "virtual Tabs" in the JTabbedPane. Even though there
may be only 2 or 3 tabs, it may be possible to switch to a number of
"virtual" tabs by selecing one from the popup menu.
The Tabs (and their contents) on the JTabbedPane are constructed
dynamically by parsing a colon-separated String passed to the
The code
would expect the following to be contained in one of the property files read in:
admin.foo.class=my.pkg.Comp1.class
admin.foo.label=Title 1
admin.bar.class=my.pkg.Comp2.class
admin.bar.label=Title 2
and would be broken down into one Tab named "Title 1" containing the component Comp1 and "virtual Tab" "Title 2" containing component Comp2.
This component issues a vetoable property change event before changing tabs (when a user clicks to switch tabs). Throwing a PropertyVetoException will prevent the tabs from actually switching. This is useful if you want to force the user to complete a task before leaving the current tab.
addTab()
method. This String would consist of property
'names' which when combined with the 'base' property (see the
setResourceName()
method) would be used to determine
the tab labels and Class names of the panels in the Tab.
For example:The code
setResourceName("admin");
addTab("foo:bar");
would expect the following to be contained in one of the property files read in:
admin.foo.class=my.pkg.Comp1.class
admin.foo.label=Title 1
admin.bar.class=my.pkg.Comp2.class
admin.bar.label=Title 2
and would be broken down into one Tab named "Title 1" containing the component Comp1 and "virtual Tab" "Title 2" containing component Comp2.
This component issues a vetoable property change event before changing tabs (when a user clicks to switch tabs). Throwing a PropertyVetoException will prevent the tabs from actually switching. This is useful if you want to force the user to complete a task before leaving the current tab.
- Version:
- %version: 1 % %date_modified: Fri May 26 14:25:48 2000 %
- Author:
- larrylf
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JTabbedPane
JTabbedPane.AccessibleJTabbedPane, JTabbedPane.ModelListener
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected static final String
protected static final String
protected static final String
protected PComponentDelegate
protected int
protected JPopupMenu
protected ImageIcon
protected com.portal.bas.comp.PIATabPane.MouseHandler
protected static final String
protected com.portal.bas.comp.PIATabPane.PopupHandler
static final String
protected static final String
Fields inherited from class javax.swing.JTabbedPane
changeEvent, changeListener, model, SCROLL_TAB_LAYOUT, tabPlacement, WRAP_TAB_LAYOUT
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a PIATabbedPane componentPIATabPane
(int placement) Creates a PIATabbedPane component -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTab
(String[] titles, Icon[] icons, PIAPanelGroup pg, String[] tips, String modelType, int frontPri) Adds a tab containing virtual tabsvoid
addTab
(String title, Icon icon, JComponent comp, String tip) Adds a component and tip represented by a title and/or icon, either of which can be null.void
Adds a component and tip represented by a title and/or icon, either of which can be null.get all tools for every tab in this panelRetrieves the class name of this component's controllerRetrieves the PModelHandle for this componentGet a reference to the remote component for this object.Get the base resource name used in resource lookup.getTools()
Get a list of Actions supported by the visible tab.void
insertTab
(String title, Icon icon, JComponent comp, String tip, String modType, int frontPri, int index) Inserts a component and tip represented by a title and/or icon, either of which can be null, at the given location.boolean
isLight()
Not a lightweight component as far as handling model handles goesvoid
setModelHandle
(PModelHandle data) Establishes the PModelHandle for this component.void
setResourceName
(String name) Set the base resource name used in resource lookup.void
Event handler called when tab selection changesvoid
Used to disassociate this component from its delegate (controller)void
ViewDataChangeListener override.Methods inherited from class javax.swing.JTabbedPane
add, add, add, add, add, addChangeListener, addTab, addTab, addTab, createChangeListener, fireStateChanged, getAccessibleContext, getBackgroundAt, getBoundsAt, getChangeListeners, getComponentAt, getDisabledIconAt, getDisplayedMnemonicIndexAt, getForegroundAt, getIconAt, getMnemonicAt, getModel, getSelectedComponent, getSelectedIndex, getTabComponentAt, getTabCount, getTabLayoutPolicy, getTabPlacement, getTabRunCount, getTitleAt, getToolTipText, getToolTipTextAt, getUI, getUIClassID, indexAtLocation, indexOfComponent, indexOfTab, indexOfTab, indexOfTabComponent, insertTab, isEnabledAt, paramString, remove, remove, removeAll, removeChangeListener, removeTabAt, setBackgroundAt, setComponentAt, setDisabledIconAt, setDisplayedMnemonicIndexAt, setEnabledAt, setForegroundAt, setIconAt, setMnemonicAt, setModel, setSelectedComponent, setSelectedIndex, setTabComponentAt, setTabLayoutPolicy, setTabPlacement, setTitleAt, setToolTipTextAt, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
SELECTED_INDEX
- See Also:
-
MENU_ITEMS
- See Also:
-
MENU_ICONS
- See Also:
-
MENU_TIPS
- See Also:
-
MODEL_TYPE
- See Also:
-
TO_FRONT_PRIORITY
- See Also:
-
mMenuIcon
-
mMouse
protected transient com.portal.bas.comp.PIATabPane.MouseHandler mMouse -
mPopup
protected transient com.portal.bas.comp.PIATabPane.PopupHandler mPopup -
mImpl
-
mMenu
-
mLastTab
protected transient int mLastTab -
isTracking
protected boolean isTracking
-
-
Constructor Details
-
PIATabPane
public PIATabPane()Creates a PIATabbedPane component -
PIATabPane
public PIATabPane(int placement) Creates a PIATabbedPane component
-
-
Method Details
-
unregister
Used to disassociate this component from its delegate (controller)- Specified by:
unregister
in interfacePClientComponent
- Throws:
RemoteException
-
setModelHandle
Establishes the PModelHandle for this component. All tabs that specified a type that matches the type for this model handle are handed the model handle.- Specified by:
setModelHandle
in interfacePComponent
- Parameters:
data
- The new PModelHandle from which information will be extracted.- Throws:
RemoteException
-
getModelHandle
Retrieves the PModelHandle for this component- Specified by:
getModelHandle
in interfacePComponent
- Returns:
- The PModelHandle associated with this component
- Throws:
RemoteException
-
isLight
Not a lightweight component as far as handling model handles goes- Specified by:
isLight
in interfacePComponent
- Returns:
- false
- Throws:
RemoteException
- thrown for errors
-
getControllerClassName
Retrieves the class name of this component's controller- Specified by:
getControllerClassName
in interfacePComponent
- Returns:
- "com.portal.bas.comp.PIAFieldController", the default controller for most PFieldComponents
- Throws:
RemoteException
-
getTools
Get a list of Actions supported by the visible tab.- Specified by:
getTools
in interfacePClientComponent
- Returns:
- a Vector containing Action objects for the topmost tab
-
getAllTools
get all tools for every tab in this panel- Returns:
- a vector containing the tools
-
setResourceName
Set the base resource name used in resource lookup. Basically, the resource name will be this base, followed by a dot, flowwed by the local name (label).- Specified by:
setResourceName
in interfacePClientComponent
- Parameters:
name
- The new base resource name.
-
getResourceName
Get the base resource name used in resource lookup.- Specified by:
getResourceName
in interfacePClientComponent
- Returns:
- The base resource name
-
getRemoteComponent
Get a reference to the remote component for this object. The remote component is used when interfacing with this component's controller.- Specified by:
getRemoteComponent
in interfacePAppComponent
- Returns:
- a RemoteComponent
-
viewDataChange
ViewDataChangeListener override. Called by the controller to update the field data.- Specified by:
viewDataChange
in interfacePViewDataChangeListener
- Parameters:
event
- The ViewDataChange event describing the change- Throws:
RemoteException
- thrown for errors
-
stateChanged
Event handler called when tab selection changes- Specified by:
stateChanged
in interfaceChangeListener
- Parameters:
ce
-
-
addTab
Adds a component and tip represented by a title and/or icon, either of which can be null. Cover method for insertTab().- Parameters:
title
- the title to be displayed in this tabicon
- the icon to be displayed in this tabtip
- the tooltip to be displayed for this tabcomponent
- The component to be displayed when this tab is clicked.- See Also:
-
addTab
public void addTab(String[] titles, Icon[] icons, PIAPanelGroup pg, String[] tips, String modelType, int frontPri) Adds a tab containing virtual tabs- Parameters:
modelType
- The type of storable class this tab is interested infrontPri
- The toFront priority for this tabtitle
- the array of titles to be displayed in this tabicon
- the array of icons to be displayed in this tabtip
- the array of tooltips to be displayed for this tab
-
addTab
public void addTab(String title, Icon icon, JComponent comp, String tip, String modelType, int frontPri) Adds a component and tip represented by a title and/or icon, either of which can be null. Cover method for insertTab().- Parameters:
title
- the title to be displayed in this tabicon
- the icon to be displayed in this tabtip
- the tooltip to be displayed for this tabmodelType
- The model type this component this tab wantsfrontPri
- The priority for bringing this tab to the frontcomponent
- The component to be displayed when this tab is clicked.- See Also:
-
insertTab
public void insertTab(String title, Icon icon, JComponent comp, String tip, String modType, int frontPri, int index) Inserts a component and tip represented by a title and/or icon, either of which can be null, at the given location.- Parameters:
title
- the title to be displayed in this tabicon
- the icon to be displayed in this tabtip
- the tooltip to be displayed for this tabfrontPri
- The priority for bringing this tab to the frontindex
- The location to insert the tabcomponent
- The component to be displayed when this tab is clicked.modelType
- The model type this component this tab wants- See Also:
-