org.openide.text
Class CloneableEditor

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--org.openide.windows.TopComponent
                          |
                          +--org.openide.windows.CloneableTopComponent
                                |
                                +--org.openide.text.CloneableEditor
All Implemented Interfaces:
Accessible, Externalizable, ImageObserver, MenuContainer, Serializable, TopComponent.Cloneable
Direct Known Subclasses:
EditorSupport.Editor

public class CloneableEditor
extends CloneableTopComponent

Cloneable top component to hold the editor kit.

See Also:
Serialized Form

Inner classes inherited from class org.openide.windows.CloneableTopComponent
CloneableTopComponent.Ref
 
Inner classes inherited from class org.openide.windows.TopComponent
TopComponent.Cloneable, TopComponent.NodeName, TopComponent.Registry
 
Inner classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
Component.AccessibleAWTComponent
 
Field Summary
protected  JEditorPane pane
          editor pane
 
Fields inherited from class org.openide.windows.CloneableTopComponent
EMPTY
 
Fields inherited from class org.openide.windows.TopComponent
CLOSE_EACH, CLOSE_LAST
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
CloneableEditor()
          For externalization of subclasses only
CloneableEditor(CloneableEditorSupport support)
          Creates new editor component associated with support object.
 
Method Summary
 boolean canClose(Workspace workspace, boolean last)
          Make sure the EditorKit knows it is going bye-bye.
protected  CloneableEditorSupport cloneableEditorSupport()
          Gives access to support object under this CloneableEditor.
protected  boolean closeLast()
          When closing last view, also close the document.
protected  void componentActivated()
          Overrides superclass method.
protected  void componentDeactivated()
          Overrides superclass method.
protected  CloneableTopComponent createClonedObject()
          Called from CloneableTopComponent.clone() to actually create a new component from this one.
 HelpCtx getHelpCtx()
          Get context help for this editor pane.
 Dimension getPreferredSize()
           
 SystemAction[] getSystemActions()
          Get the system actions which will appear in the popup menu of this component.
 UndoRedo getUndoRedo()
          The undo/redo manager of the support.
 void open(Workspace workspace)
          Overrides superclass version.
 void readExternal(ObjectInput in)
          Deserialize this top component.
protected  Object readResolve()
          If this component should be discarded then return null.
 void requestFocus()
          Transfer the focus to the editor pane.
protected  void updateName()
          Updates the name of this top component according to the existence of the save cookie in ascoiated data object.
 void writeExternal(ObjectOutput out)
          Serialize this top component.
 
Methods inherited from class org.openide.windows.CloneableTopComponent
clone, cloneComponent, cloneTopComponent, getReference, setReference
 
Methods inherited from class org.openide.windows.TopComponent
close, close, closeNotify, getAccessibleContext, getActivatedNodes, getCloseOperation, getIcon, getRegistry, isOpened, isOpened, open, openNotify, requestVisible, setActivatedNodes, setCloseOperation, setIcon, setName, writeReplace
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pane

protected JEditorPane pane
editor pane
Constructor Detail

CloneableEditor

public CloneableEditor()
For externalization of subclasses only

CloneableEditor

public CloneableEditor(CloneableEditorSupport support)
Creates new editor component associated with support object.
Parameters:
support - support that holds the document and operations above it
Method Detail

cloneableEditorSupport

protected CloneableEditorSupport cloneableEditorSupport()
Gives access to support object under this CloneableEditor.
Returns:
the support object that holds the document

getHelpCtx

public HelpCtx getHelpCtx()
Get context help for this editor pane. If the registered editor kit provides a help ID in bean info according to the protocol described for InstanceSupport.findHelp(org.openide.cookies.InstanceCookie), then that it used, else general help on the editor is provided.
Overrides:
getHelpCtx in class TopComponent
Returns:
context help

canClose

public boolean canClose(Workspace workspace,
                        boolean last)
Make sure the EditorKit knows it is going bye-bye.
Overrides:
canClose in class CloneableTopComponent
Following copied from class: org.openide.windows.CloneableTopComponent
Returns:
true if there are still clone sisters left, or this was the last in its group but CloneableTopComponent.closeLast() returned true

createClonedObject

protected CloneableTopComponent createClonedObject()
Description copied from class: CloneableTopComponent
Called from CloneableTopComponent.clone() to actually create a new component from this one. The default implementation only clones the object by calling Object.clone(). Subclasses may leave this as is, assuming they have no special needs for the cloned data besides copying it from one object to the other. If they do, the superclass method should be called, and the returned object modified appropriately.
Overrides:
createClonedObject in class CloneableTopComponent
Following copied from class: org.openide.windows.CloneableTopComponent
Returns:
a copy of this object

open

public void open(Workspace workspace)
Overrides superclass version. Opens top component only if it is in valid state. (Editor top component may become invalid after deserialization).
Also tries to open all other top components which are docked in editor mode on given workspace, but not visible.
Overrides:
open in class TopComponent
Following copied from class: org.openide.windows.TopComponent
Parameters:
workspace - Workspace on which component should be opened. Parameter can be null -> means current workspace.
See Also:
TopComponent.requestFocus()

closeLast

protected boolean closeLast()
When closing last view, also close the document.
Overrides:
closeLast in class CloneableTopComponent
Returns:
true if close succeeded

getUndoRedo

public UndoRedo getUndoRedo()
The undo/redo manager of the support.
Overrides:
getUndoRedo in class TopComponent
Returns:
the undo/redo manager shared by all editors for this support

getSystemActions

public SystemAction[] getSystemActions()
Description copied from class: TopComponent
Get the system actions which will appear in the popup menu of this component.

Subclasses are encouraged to override this method to specify their own sets of actions.

Remember to call the super method when overriding and add your actions to the superclass' ones (in some order),? because the default implementation provides support for standard component actions like save, close, and clone.

Overrides:
getSystemActions in class TopComponent
Following copied from class: org.openide.windows.TopComponent
Returns:
system actions for this component

requestFocus

public void requestFocus()
Transfer the focus to the editor pane.
Overrides:
requestFocus in class TopComponent

getPreferredSize

public Dimension getPreferredSize()
Overrides:
getPreferredSize in class JComponent
Returns:
Preferred size of editor top component

componentActivated

protected void componentActivated()
Overrides superclass method. Creates bridges between cut/copy/delete actions and their system counterparts. Also substitutes original cut/copy actions to be handled system paste action correctly.
Overrides:
componentActivated in class TopComponent
See Also:
componentDeactivated()

componentDeactivated

protected void componentDeactivated()
Overrides superclass method. Removes the bridges and substituting action set in componentActivated to return it to the original state.
Overrides:
componentDeactivated in class TopComponent
See Also:
componentActivated()

updateName

protected void updateName()
Updates the name of this top component according to the existence of the save cookie in ascoiated data object. Updates tooltip also.

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Description copied from class: TopComponent
Serialize this top component. Subclasses wishing to store state must call the super method, then write to the stream.
Overrides:
writeExternal in class CloneableTopComponent
Following copied from class: org.openide.windows.TopComponent
Parameters:
out - the stream to serialize to

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Description copied from class: TopComponent
Deserialize this top component. Subclasses wishing to store state must call the super method, then read from the stream.
Overrides:
readExternal in class CloneableTopComponent
Following copied from class: org.openide.windows.TopComponent
Parameters:
in - the stream to deserialize from

readResolve

protected Object readResolve()
                      throws ObjectStreamException
If this component should be discarded then return null.


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.