org.jext
Class JextTabbedPane

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 org.jext.JextTabbedPane
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ChangeListener, javax.swing.SwingConstants

public class JextTabbedPane
extends javax.swing.JTabbedPane
implements javax.swing.event.ChangeListener

A tabbed pane which can display indexed titles. As a matter of fact, if a tab is added with a name which already exists, JextTabbedPane will add an index under the form '(x)' at the end of the name. When all tabs of the same name are closed, indexes are counted over from 0.

Author:
Romain Guy
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JTabbedPane
javax.swing.JTabbedPane.AccessibleJTabbedPane, javax.swing.JTabbedPane.ModelListener
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
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
JextTabbedPane(JextFrame parent)
          Creates a new tabbed pane and register a change listener which will be used to update Jext infos concerning text areas.
 
Method Summary
 void addTab(java.lang.String title, java.awt.Component component)
          Overrides default addTab(String, Component) method.
protected  void finalize()
          Patch -> Memory management improvements : it may help the garbage collector.
static javax.swing.JPopupMenu getPopupMenu()
          Returns JextTabbedPane popup menu.
 void nextTab()
          Selects the next tab in the list.
 void previousTab()
          Selects the previous tab in the list.
 void removeAll()
          Removes any installed component from this tabbed pane.
 void removeTabAt(int index)
          Overrides default removeTabAt(int) method.
 void setCleanIcon(JextTextArea textArea)
          When a text area is saved (or simply cleaned in case of open or new), this method is used to display the 'clean' icon in the tab which holds the text area.
 void setDirtyIcon(JextTextArea textArea)
          When a text area is modified this method is used to display the 'dirty' icon in the tab which holds the text area.
 void setTitleAt(int index, java.lang.String title)
          Overrides default setTitleAt(int, String) method.
 void stateChanged(javax.swing.event.ChangeEvent evt)
          When a tab is selected, and if content of the tab is a JextTextArea, we update infos displayed by Jext and notify Jext listeners.
 
Methods inherited from class javax.swing.JTabbedPane
add, add, add, add, add, addChangeListener, 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, removeChangeListener, setBackgroundAt, setComponentAt, setDisabledIconAt, setDisplayedMnemonicIndexAt, setEnabledAt, setForegroundAt, setIconAt, setMnemonicAt, setModel, setSelectedComponent, setSelectedIndex, setTabComponentAt, setTabLayoutPolicy, setTabPlacement, 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, 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, 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, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JextTabbedPane

public JextTabbedPane(JextFrame parent)
Creates a new tabbed pane and register a change listener which will be used to update Jext infos concerning text areas.

Parameters:
parent - The parent window
Method Detail

getPopupMenu

public static javax.swing.JPopupMenu getPopupMenu()
Returns JextTabbedPane popup menu. This is needed to update look and feel when user changed it.


setCleanIcon

public void setCleanIcon(JextTextArea textArea)
When a text area is saved (or simply cleaned in case of open or new), this method is used to display the 'clean' icon in the tab which holds the text area.

Parameters:
textArea - The text area which was cleaned

setDirtyIcon

public void setDirtyIcon(JextTextArea textArea)
When a text area is modified this method is used to display the 'dirty' icon in the tab which holds the text area.

Parameters:
textArea - The text area which was modified

addTab

public void addTab(java.lang.String title,
                   java.awt.Component component)
Overrides default addTab(String, Component) method. This method register the title if it hasn't been displayed yet to be able to index next titles of same name. Then, super.addTab(String, Component) is called.

Overrides:
addTab in class javax.swing.JTabbedPane
Parameters:
title - Title of the new tab
component - Content of the new tab

removeTabAt

public void removeTabAt(int index)
Overrides default removeTabAt(int) method. This method checks if no other tab among the remaining ones has got the same name. In this case, the title is unregistered from the indexed titles list.

Overrides:
removeTabAt in class javax.swing.JTabbedPane
Parameters:
index - Removes the tab at index

setTitleAt

public void setTitleAt(int index,
                       java.lang.String title)
Overrides default setTitleAt(int, String) method. Before setting the new title, the new title is registered in the indexed titles list. Then, we call super.setTitleAt(int, String) method but specifying an indexed title.

Overrides:
setTitleAt in class javax.swing.JTabbedPane
Parameters:
index - The index of tab to be re-titled
title - The new title

nextTab

public void nextTab()
Selects the next tab in the list. If current selected tab is the last one, then the first one is selected.


previousTab

public void previousTab()
Selects the previous tab in the list. If current selected tab is the first one, then the last one is selected.


removeAll

public void removeAll()
Removes any installed component from this tabbed pane. Also resets the titles list.

Overrides:
removeAll in class javax.swing.JTabbedPane

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent evt)
When a tab is selected, and if content of the tab is a JextTextArea, we update infos displayed by Jext and notify Jext listeners.

Specified by:
stateChanged in interface javax.swing.event.ChangeListener

finalize

protected void finalize()
                 throws java.lang.Throwable
Patch -> Memory management improvements : it may help the garbage collector. -> Author : Julien Ponge (julien@izforge.com) -> Date : 23, May 2001

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable


Copyright ? 2002 Romain Guy.