JIDE 3.5.15

com.jidesoft.pane
Class OutlookTabbedPane

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JTabbedPane
                  extended by com.jidesoft.pane.OutlookTabbedPane
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants

public class OutlookTabbedPane
extends JTabbedPane

OutlookTabbedPane is a changed version of JTabbedPane. As we all know, JTabbedPane provides a way to organize multiple panes and allows user to see one pane at a time. OutlookTabbedPane serves the same purpose. However it organizes the panes in a vertical way like as you see in Microsoft Outlook 2003.

The interface and usage of OutlookTabbedPane are the same as JTabbedPane. We even keep the name of methods to be the same so that you easily convert from JTabbedPane to OutlookTabbedPane.

See Also:
Serialized Form

Nested Class Summary
protected  class OutlookTabbedPane.AccessibleJTabbedPane
          This class implements accessibility support for the JTabbedPane class.
 class OutlookTabbedPane.MouseHandler
           
 class OutlookTabbedPane.OptionDialog
           
 class OutlookTabbedPane.OutlookButton
           
 
Nested classes/interfaces inherited from class javax.swing.JTabbedPane
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
protected  ChangeListener _selectionChangeListener
           
static String CONTEXT_MENU_ADD_REMOVE_BUTTON
           
static String CONTEXT_MENU_OPTION
           
static String CONTEXT_MENU_SHOW_FEWER_BUTTON
           
static String CONTEXT_MENU_SHOW_MORE_BUTTON
           
static String PROPERTY_BOTTOM_BUTTON_COUNT
           
 
Fields inherited from class javax.swing.JTabbedPane
changeEvent, changeListener, model, SCROLL_TAB_LAYOUT, tabPlacement, WRAP_TAB_LAYOUT
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
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
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
OutlookTabbedPane()
          Creates OutlookTabbedPane.
 
Method Summary
protected  AbstractButton createButton(Action action)
          Creates the button used by OutlookTabbedPane.
protected  int[] createCounts()
           
protected  LayoutManager createLayout()
           
protected  JPopupMenu createPopupMenu()
          Creates the popup menu that is used when user clicking on the chevron on the bottom button bar.
protected  Action createSwitchPageAction(String title, Icon icon, int index)
           
protected  String[] createTitles(Vector<String> titles)
           
protected  void customizeBottomButton(AbstractButton button)
          Customizes the button used by OutlookTabbedPane's bottom panel.
protected  void customizeButton(AbstractButton button)
          Customizes the button used by OutlookTabbedPane.
protected  void customizeOptionDialog(JDialog dialog)
          Customizes the option dialog.
protected  void displayOptionDialog()
           
protected  void fireStateChanged()
           
 AccessibleContext getAccessibleContext()
          Gets the AccessibleContext associated with this JTabbedPane.
 Color getBackgroundAt(int index)
           
 int getBottomButtonCount()
          Gets the button count on the bottom panel.
 JPanel getBottomPanel()
          Gets the panel on the bottom that has the bottom buttons and the chevron.
 int getButtonPanelHeight()
          Get the height of the button panel.
 Vector<AbstractButton> getButtons()
          Gets the buttons used by this tabbedPane in a Vector.
 Icon getDisabledIconAt(int index)
           
 int getDisplayedMnemonicIndexAt(int tabIndex)
           
 Color getForegroundAt(int index)
           
 Icon getIconAt(int index)
           
protected  ImageIcon getImageIcon(String iconName)
          Gets the image icon used by the popup menu.
 int getMnemonicAt(int tabIndex)
           
 String getOptionDialogTitle()
           
protected  String getResourceString(String key)
          Gets the localized string from resource bundle.
 String[] getTabOrder()
          Gets the tab order.
 String getTitleAt(int index)
           
 String getToolTipTextAt(int index)
           
 String getVersion()
          Gets an optional version string.
protected  Component getVisibleComponent()
           
 int[] getVisibleTabs()
          Gets the visible tabs' index.
 void insertTab(String title, Icon icon, Component component, String tip, int index)
          Overrides to insert a button for this new tab.
 boolean isChevronVisible()
           
 boolean isEnabledAt(int index)
           
 boolean isTabVisibleAt(int index)
          Checks if the tab at the specified index is visible.
 void removeTabAt(int index)
          Overrides to remove the button for the tab index.
 void setBackgroundAt(int index, Color background)
           
 void setBottomButtonCount(int bottomButtonCount)
          Sets the button count on the bottom panel.
 void setButtonPanelHeight(int buttonPanelHeight)
          Set the height of the button panel.
 void setChevronVisible(boolean visible)
           
 void setDisabledIconAt(int index, Icon disabledIcon)
           
 void setDisplayedMnemonicIndexAt(int tabIndex, int mnemonicIndex)
           
 void setEnabledAt(int index, boolean enabled)
           
 void setForegroundAt(int index, Color foreground)
           
 void setIconAt(int index, Icon icon)
           
 void setMnemonicAt(int tabIndex, int mnemonic)
           
 void setOptionDialogTitle(String optionDialogTitle)
           
 void setSelectedIndex(int index)
           
 void setTabOrder(String[] titles)
          Sets the tab order.
 void setTabVisibleAt(int index, boolean visible)
          Shows or hide the tab at the specified index.
 void setTitleAt(int index, String title)
           
 void setToolTipTextAt(int index, String toolTipText)
           
 void setVersion(String version)
          Sets version string.
protected  void setVisibleComponent(Component component)
           
 void setVisibleTabs(int[] tabs)
          Sets the visible tabs.
 void updateUI()
          Resets the UI property to a value from the current look and feel.
 
Methods inherited from class javax.swing.JTabbedPane
add, add, add, add, add, addChangeListener, addTab, addTab, addTab, createChangeListener, getBoundsAt, getChangeListeners, getComponentAt, getModel, getSelectedComponent, getSelectedIndex, getTabComponentAt, getTabCount, getTabLayoutPolicy, getTabPlacement, getTabRunCount, getToolTipText, getUI, getUIClassID, indexAtLocation, indexOfComponent, indexOfTab, indexOfTab, indexOfTabComponent, paramString, remove, remove, removeAll, removeChangeListener, setComponentAt, setModel, setSelectedComponent, setTabComponentAt, setTabLayoutPolicy, setTabPlacement, setUI
 
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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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, transferFocusBackward, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPERTY_BOTTOM_BUTTON_COUNT

public static final String PROPERTY_BOTTOM_BUTTON_COUNT
See Also:
Constant Field Values

_selectionChangeListener

protected ChangeListener _selectionChangeListener

CONTEXT_MENU_SHOW_MORE_BUTTON

public static final String CONTEXT_MENU_SHOW_MORE_BUTTON
See Also:
Constant Field Values

CONTEXT_MENU_SHOW_FEWER_BUTTON

public static final String CONTEXT_MENU_SHOW_FEWER_BUTTON
See Also:
Constant Field Values

CONTEXT_MENU_OPTION

public static final String CONTEXT_MENU_OPTION
See Also:
Constant Field Values

CONTEXT_MENU_ADD_REMOVE_BUTTON

public static final String CONTEXT_MENU_ADD_REMOVE_BUTTON
See Also:
Constant Field Values
Constructor Detail

OutlookTabbedPane

public OutlookTabbedPane()
Creates OutlookTabbedPane.

Method Detail

updateUI

public void updateUI()
Resets the UI property to a value from the current look and feel. Don't call super.updateUI() since it shouldn't use default JTabbedPane UI at all.

Overrides:
updateUI in class JTabbedPane
See Also:
JComponent.updateUI()

createLayout

protected LayoutManager createLayout()

createSwitchPageAction

protected Action createSwitchPageAction(String title,
                                        Icon icon,
                                        int index)

getButtons

public Vector<AbstractButton> getButtons()
Gets the buttons used by this tabbedPane in a Vector.

Returns:
vector of buttons.

setSelectedIndex

public void setSelectedIndex(int index)
Overrides:
setSelectedIndex in class JTabbedPane

removeTabAt

public void removeTabAt(int index)
Overrides to remove the button for the tab index. If the tab being removed is selected, it will try to select next tab unless the removed tab is the last one. If so, it will select previous tab.

Overrides:
removeTabAt in class JTabbedPane
Parameters:
index - the tab index

insertTab

public void insertTab(String title,
                      Icon icon,
                      Component component,
                      String tip,
                      int index)
Overrides to insert a button for this new tab.

Overrides:
insertTab in class JTabbedPane
Parameters:
title - the title to be displayed in this tab
icon - the icon to be displayed in this tab
component - The component to be displayed when this tab is clicked.
tip - the tooltip to be displayed for this tab
index - the position to insert this new tab

createButton

protected AbstractButton createButton(Action action)
Creates the button used by OutlookTabbedPane. Subclass can override it to create its own button. But those buttons must implement UIResource. Otherwise, a runtime IllegalArgumentException will be thrown.

Here is the default code.

 OutlookButton outlookButton = new OutlookButton(action);
 outlookButton.setName((String) action.getValue(Action.NAME));
 customizeButton(outlookButton);
 return outlookButton;
 
where OutlookButton is defined as
 public class OutlookButton extends JideButton implements UIResource {
     public OutlookButton(Action a) {
         super(a);
     }
 }
 

Parameters:
action - the AbstractAction
Returns:
button used by OutlookTabbedPane.

getButtonPanelHeight

public int getButtonPanelHeight()
Get the height of the button panel.

The default value of the panel is 30.

Returns:
the height of the button panel.

setButtonPanelHeight

public void setButtonPanelHeight(int buttonPanelHeight)
Set the height of the button panel.

Parameters:
buttonPanelHeight - the height

getMnemonicAt

public int getMnemonicAt(int tabIndex)
Overrides:
getMnemonicAt in class JTabbedPane

setMnemonicAt

public void setMnemonicAt(int tabIndex,
                          int mnemonic)
Overrides:
setMnemonicAt in class JTabbedPane

getDisplayedMnemonicIndexAt

public int getDisplayedMnemonicIndexAt(int tabIndex)
Overrides:
getDisplayedMnemonicIndexAt in class JTabbedPane

setDisplayedMnemonicIndexAt

public void setDisplayedMnemonicIndexAt(int tabIndex,
                                        int mnemonicIndex)
Overrides:
setDisplayedMnemonicIndexAt in class JTabbedPane

setTitleAt

public void setTitleAt(int index,
                       String title)
Overrides:
setTitleAt in class JTabbedPane

getTitleAt

public String getTitleAt(int index)
Overrides:
getTitleAt in class JTabbedPane

getIconAt

public Icon getIconAt(int index)
Overrides:
getIconAt in class JTabbedPane

setIconAt

public void setIconAt(int index,
                      Icon icon)
Overrides:
setIconAt in class JTabbedPane

getDisabledIconAt

public Icon getDisabledIconAt(int index)
Overrides:
getDisabledIconAt in class JTabbedPane

setDisabledIconAt

public void setDisabledIconAt(int index,
                              Icon disabledIcon)
Overrides:
setDisabledIconAt in class JTabbedPane

getToolTipTextAt

public String getToolTipTextAt(int index)
Overrides:
getToolTipTextAt in class JTabbedPane

setToolTipTextAt

public void setToolTipTextAt(int index,
                             String toolTipText)
Overrides:
setToolTipTextAt in class JTabbedPane

isEnabledAt

public boolean isEnabledAt(int index)
Overrides:
isEnabledAt in class JTabbedPane

setEnabledAt

public void setEnabledAt(int index,
                         boolean enabled)
Overrides:
setEnabledAt in class JTabbedPane

setForegroundAt

public void setForegroundAt(int index,
                            Color foreground)
Overrides:
setForegroundAt in class JTabbedPane

getForegroundAt

public Color getForegroundAt(int index)
Overrides:
getForegroundAt in class JTabbedPane

setBackgroundAt

public void setBackgroundAt(int index,
                            Color background)
Overrides:
setBackgroundAt in class JTabbedPane

getBackgroundAt

public Color getBackgroundAt(int index)
Overrides:
getBackgroundAt in class JTabbedPane

getBottomPanel

public JPanel getBottomPanel()
Gets the panel on the bottom that has the bottom buttons and the chevron.

Returns:
the bottom panel.

getResourceString

protected String getResourceString(String key)
Gets the localized string from resource bundle. Subclass can override it to provide its own string. Available keys are defined in pane.properties that begin with "OutlookTabbedPane.".

Parameters:
key - the key to the resource.
Returns:
the localized string.

createPopupMenu

protected JPopupMenu createPopupMenu()
Creates the popup menu that is used when user clicking on the chevron on the bottom button bar. You can override this method to customize this popup menu. The menu items all have their name which are defined as constants such as CONTEXT_MENU_SHOW_MORE_BUTTON, CONTEXT_MENU_SHOW_FEWER_BUTTON, CONTEXT_MENU_OPTION, CONTEXT_MENU_ADD_REMOVE_BUTTON. So you can iterate through the menu items and look up by name to find out which one to add/remove/modify.

Returns:
the popup menu.

displayOptionDialog

protected void displayOptionDialog()

customizeOptionDialog

protected void customizeOptionDialog(JDialog dialog)
Customizes the option dialog. Subclass can override this method customize the dialog.

Parameters:
dialog - the option dialog

createCounts

protected int[] createCounts()

customizeButton

protected void customizeButton(AbstractButton button)
Customizes the button used by OutlookTabbedPane. Subclass can override it to customize the button.

Parameters:
button - the button used by OutlookTabbedPane

customizeBottomButton

protected void customizeBottomButton(AbstractButton button)
Customizes the button used by OutlookTabbedPane's bottom panel. Subclass can override it to customize the button.

Parameters:
button - the button used by OutlookTabbedPane

getOptionDialogTitle

public String getOptionDialogTitle()

setOptionDialogTitle

public void setOptionDialogTitle(String optionDialogTitle)

getVisibleTabs

public int[] getVisibleTabs()
Gets the visible tabs' index.

Returns:
the visible tabs' index.

setVisibleTabs

public void setVisibleTabs(int[] tabs)
Sets the visible tabs.

Parameters:
tabs - the tab indices that will be visible.

isTabVisibleAt

public boolean isTabVisibleAt(int index)
Checks if the tab at the specified index is visible.

Parameters:
index - the tab index.
Returns:
true if the tab is visible. Otherwise false.

setTabVisibleAt

public void setTabVisibleAt(int index,
                            boolean visible)
Shows or hide the tab at the specified index. Different from removeTabAt which removes the tab completely, setTabVisible to false simply hides the tab. You can still access the tab using methods such as get/setTitleAt, get/setIconAt etc. You can use this method to show/hide tab programmatically. User also can show/hide the tabs by selecting "Options" menu item on the bottom of the tabbed pane.

Parameters:
index - the tab index.
visible - true to set the tab visible and false to set the tab invisible.

fireStateChanged

protected void fireStateChanged()
Overrides:
fireStateChanged in class JTabbedPane

createTitles

protected String[] createTitles(Vector<String> titles)

getTabOrder

public String[] getTabOrder()
Gets the tab order.

Returns:
the tab order. It contains an string array of all tab titles in the order they are displayed.

setTabOrder

public void setTabOrder(String[] titles)
Sets the tab order.

Parameters:
titles - an string array of all tab titles in the order that they will be displayed.
Throws:
IllegalArgumentException - if the title in the titles array doesn't exist in the tabbed pane.

getBottomButtonCount

public int getBottomButtonCount()
Gets the button count on the bottom panel.

Returns:
the button count on the bottom panel.

setBottomButtonCount

public void setBottomButtonCount(int bottomButtonCount)
Sets the button count on the bottom panel. This is a bound property. PROPERTY_BOTTOM_BUTTON_COUNT property change event will be fired when the value changes.

Parameters:
bottomButtonCount - the button count on the bottom panel.

getVersion

public String getVersion()
Gets an optional version string.

Returns:
version string.

setVersion

public void setVersion(String version)
Sets version string.

Parameters:
version - the version of the saved layout.

setChevronVisible

public void setChevronVisible(boolean visible)

isChevronVisible

public boolean isChevronVisible()

getVisibleComponent

protected Component getVisibleComponent()

setVisibleComponent

protected void setVisibleComponent(Component component)

getImageIcon

protected ImageIcon getImageIcon(String iconName)
Gets the image icon used by the popup menu.

Parameters:
iconName - the location of the icon relative to OutlookTabbedPane class location. You can also think it as the name of the icon when you override this method and use another way to create the image icons to be used.
Returns:
the image icon.

getAccessibleContext

public AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this JTabbedPane. For tabbed panes, the AccessibleContext takes the form of an AccessibleJTabbedPane. A new AccessibleJTabbedPane instance is created if necessary.

Specified by:
getAccessibleContext in interface Accessible
Overrides:
getAccessibleContext in class JTabbedPane
Returns:
an AccessibleJTabbedPane that serves as the AccessibleContext of this JTabbedPane

JIDE 3.5.15