org.openide.windows 6.5.22

org.openide.windows
Class CloneableOpenSupport

java.lang.Object
  extended by org.openide.windows.CloneableOpenSupport

public abstract class CloneableOpenSupport
extends Object

Simple support for an openable objects. Can be used either as an OpenCookie, ViewCookie, or CloseCookie, depending on which cookies the subclass implements.


Nested Class Summary
static interface CloneableOpenSupport.Env
          Abstract interface that is used by CloneableOpenSupport to talk to outside world.
 
Field Summary
protected  CloneableTopComponent.Ref allEditors
          All opened editors on this file.
protected  CloneableOpenSupport.Env env
          the environment that provides connection to outside world
 
Constructor Summary
CloneableOpenSupport(CloneableOpenSupport.Env env)
          New support for a given environment.
 
Method Summary
protected  boolean canClose()
          Should test whether all data is saved, and if not, prompt the user to save.
 boolean close()
          Closes all components.
protected  boolean close(boolean ask)
          Closes all opened windows.
protected abstract  CloneableTopComponent createCloneableTopComponent()
          A method to create a new component.
 void edit()
          Focuses existing component to view, or if none exists creates new.
protected abstract  String messageOpened()
          Message to display when an object has been opened.
protected abstract  String messageOpening()
          Message to display when an object is being opened.
 void open()
          Opens and focuses or just focuses already opened CloneableTopComponent.
protected  CloneableTopComponent openCloneableTopComponent()
          Simply open for an editor.
 void view()
          Focuses existing component to view, or if none exists creates new.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

env

protected CloneableOpenSupport.Env env
the environment that provides connection to outside world


allEditors

protected CloneableTopComponent.Ref allEditors
All opened editors on this file. Warning: Treat this field like final. Internally the instance is used as WeakListener on Env validity changes. Changing the instance in subclasses would lead to breaking of that listening, thus to errorneous behaviour.

Constructor Detail

CloneableOpenSupport

public CloneableOpenSupport(CloneableOpenSupport.Env env)
New support for a given environment.

Parameters:
env - environment to take all date from/to
Method Detail

open

public void open()
Opens and focuses or just focuses already opened CloneableTopComponent.

Note: The actual processing of this method is scheduled into AWT thread in case it is called from other than the AWT thread.

See Also:
OpenCookie, openCloneableTopComponent()

view

public void view()
Focuses existing component to view, or if none exists creates new. The default implementation simply calls open().

See Also:
ViewCookie

edit

public void edit()
Focuses existing component to view, or if none exists creates new. The default implementation simply calls open().

See Also:
EditCookie

close

public boolean close()
Closes all components.

Returns:
true if every component is successfully closed or false if the user cancelled the request
See Also:
CloseCookie

close

protected boolean close(boolean ask)
Closes all opened windows.

Parameters:
ask - true if we should ask user
Returns:
true if sucesfully closed

canClose

protected boolean canClose()
Should test whether all data is saved, and if not, prompt the user to save. The default implementation returns true.

Returns:
true if everything can be closed

openCloneableTopComponent

protected final CloneableTopComponent openCloneableTopComponent()
Simply open for an editor.


createCloneableTopComponent

protected abstract CloneableTopComponent createCloneableTopComponent()
A method to create a new component. Must be overridden in subclasses.

Returns:
the cloneable top component for this support

messageOpening

protected abstract String messageOpening()
Message to display when an object is being opened.

Returns:
the message or null if nothing should be displayed

messageOpened

protected abstract String messageOpened()
Message to display when an object has been opened.

Returns:
the message or null if nothing should be displayed

org.openide.windows 6.5.22

Built on July 11 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.