org.openide.windows
Class CloneableOpenSupport

java.lang.Object
  |
  +--org.openide.windows.CloneableOpenSupport
Direct Known Subclasses:
CloneableEditorSupport, OpenSupport

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.


Inner 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()
          Focuses existing component to open, or if none exists creates new.
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.
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()
Focuses existing component to open, or if none exists creates new.
See Also:
OpenCookie.open()

view

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

edit

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

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()

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


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