org.argouml.uml.diagram.ui
Class FigEditableCompartment

java.lang.Object
  extended by FigGroup
      extended by org.argouml.uml.diagram.ui.ArgoFigGroup
          extended by org.argouml.uml.diagram.ui.FigCompartment
              extended by org.argouml.uml.diagram.ui.FigEditableCompartment
All Implemented Interfaces:
ArgoFig
Direct Known Subclasses:
FigAttributesCompartment, FigEnumLiteralsCompartment, FigExtensionPointsCompartment, FigOperationsCompartment

public abstract class FigEditableCompartment
extends FigCompartment

Presentation logic for a boxed compartment, which is common to e.g. an operations compartment and an attributes compartment.

It adds a separator line at the top of the compartment, which follows the line width and color of the parent.

This class adds the possibility to make the whole compartment invisible, and a NotationProvider is used to handle (generate and parse) the texts shown in the compartment, i.e. the compartment texts are editable by the user.

This FigGroup shall only contain its bigPort, and Figs of type FigSeparator, and CompartmentFigText.


Nested Class Summary
protected static class FigEditableCompartment.FigSeparator
          Fig representing a horizontal line separator for compartment.
 
Field Summary
 
Fields inherited from interface org.argouml.uml.diagram.ui.ArgoFig
DEBUG, DEBUG_COLOR, FILL_COLOR, INVISIBLE_LINE_COLOR, LINE_COLOR, LINE_WIDTH, ROWHEIGHT, SOLID_FILL_COLOR, STEREOHEIGHT, TEXT_COLOR, X0, Y0
 
Constructor Summary
FigEditableCompartment(int x, int y, int w, int h)
          Deprecated. for 0.27.3 by tfmorris. Use FigEditableCompartment(Object, Rectangle, DiagramSettings).
FigEditableCompartment(java.lang.Object owner, java.awt.Rectangle bounds, DiagramSettings settings)
          Construct a new FigGroup containing a "bigPort" or rectangle which encloses the entire group for use in attaching edges, etc and a separator.
 
Method Summary
 void addFig(Fig fig)
           
protected  FigSingleLineTextWithNotation createFigText(int x, int y, int w, int h, Fig aFig, NotationProvider np)
          Deprecated. for 0.27.3 by tfmorris. Subclasses must implement createFigText(Object, Rectangle, DiagramSettings, NotationProvider) which will become abstract in the future when this deprecated method is removed.
protected  FigSingleLineTextWithNotation createFigText(java.lang.Object owner, java.awt.Rectangle bounds, DiagramSettings settings, NotationProvider np)
          Factory method to create a FigSingleLineTextWithNotation which must be implemented by all subclasses.
 java.awt.Dimension getMinimumSize()
          The minimum width is the minimum width of the widest child element.
protected abstract  int getNotationType()
           
protected  FigEditableCompartment.FigSeparator getSeperatorFig()
           
protected abstract  java.util.Collection getUmlCollection()
           
 Fig makeExternalSeparatorFig()
          Create an external Fig as separator line.
 void populate()
          Fills the Fig by adding all figs within.
 void setExternalSeparatorFigBounds(java.awt.Rectangle r)
          Set new bounds for the external separator line (if it exists).
 void setFillColor(java.awt.Color col)
           
 void setFilled(boolean f)
           
 void setLineColor(java.awt.Color col)
           
 void setLineWidth(int w)
           
 void setVisible(boolean visible)
          If a boxed compartment is set to invisible then remove all its children.
 java.awt.Dimension updateFigGroupSize(int x, int y, int w, int h, boolean checkSize, int rowHeight)
          Returns the new size of the FigGroup (e.g.
 
Methods inherited from class org.argouml.uml.diagram.ui.FigCompartment
createModelElement, getBigPort, getCompartmentType, getFilled, getName, isFilled, setBoundsImpl
 
Methods inherited from class org.argouml.uml.diagram.ui.ArgoFigGroup
getProject, getSettings, renderingChanged, setOwner, setProject, setSettings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FigEditableCompartment

@Deprecated
public FigEditableCompartment(int x,
                                         int y,
                                         int w,
                                         int h)
Deprecated. for 0.27.3 by tfmorris. Use FigEditableCompartment(Object, Rectangle, DiagramSettings).

The constructor.

Two figs are added to this FigGroup: The bigPort (i.e. a box that encloses all compartments), and a separator.

Parameters:
x - x
y - y
w - width
h - height

FigEditableCompartment

public FigEditableCompartment(java.lang.Object owner,
                              java.awt.Rectangle bounds,
                              DiagramSettings settings)
Construct a new FigGroup containing a "bigPort" or rectangle which encloses the entire group for use in attaching edges, etc and a separator.

NOTE: Subclasses should call populate() when they are fully constructed.

Parameters:
owner - owning UML element
bounds - bounding rectangle of fig
settings - render settings
Method Detail

getSeperatorFig

protected FigEditableCompartment.FigSeparator getSeperatorFig()
Returns:
separator figure

setVisible

public void setVisible(boolean visible)
If a boxed compartment is set to invisible then remove all its children. This is to save on resources and increase efficiency as multiple figs need not exist and be resized, moved etc if they are not visible. If a compartment is later made visible then its child figs are rebuilt from the model.


addFig

public void addFig(Fig fig)

getUmlCollection

protected abstract java.util.Collection getUmlCollection()
Returns:
the collection of UML objects on which this compartment is based

getNotationType

protected abstract int getNotationType()
Returns:
the type of the notationProvider used to handle the text in the compartment

populate

public void populate()
Fills the Fig by adding all figs within.

Specified by:
populate in class FigCompartment

createFigText

@Deprecated
protected FigSingleLineTextWithNotation createFigText(int x,
                                                                 int y,
                                                                 int w,
                                                                 int h,
                                                                 Fig aFig,
                                                                 NotationProvider np)
Deprecated. for 0.27.3 by tfmorris. Subclasses must implement createFigText(Object, Rectangle, DiagramSettings, NotationProvider) which will become abstract in the future when this deprecated method is removed.

Returns:
null

createFigText

protected FigSingleLineTextWithNotation createFigText(java.lang.Object owner,
                                                      java.awt.Rectangle bounds,
                                                      DiagramSettings settings,
                                                      NotationProvider np)
Factory method to create a FigSingleLineTextWithNotation which must be implemented by all subclasses. It will become abstract after the release of 0.28 to enforce this requirement.

Parameters:
owner - owning UML element
bounds - position and size
settings - render settings
np - notation provider
Returns:
a FigSingleLineText which can be used to display the text.

updateFigGroupSize

public java.awt.Dimension updateFigGroupSize(int x,
                                             int y,
                                             int w,
                                             int h,
                                             boolean checkSize,
                                             int rowHeight)
Returns the new size of the FigGroup (e.g. attributes or operations) after calculation new bounds for all sub-figs, considering their minimal sizes; FigGroup need not be displayed; no update event is fired.

This method has side effects that are sometimes used.

Parameters:
x - x
y - y
w - w
h - h
Returns:
the new dimension

getMinimumSize

public java.awt.Dimension getMinimumSize()
The minimum width is the minimum width of the widest child element. The minimum height is the total minimum height of all child figs but no less than MINIMUM_HEIGHT pixels.

Overrides:
getMinimumSize in class FigCompartment
Returns:
the minimum width

setLineColor

public void setLineColor(java.awt.Color col)

setLineWidth

public void setLineWidth(int w)
Overrides:
setLineWidth in class FigCompartment

setFillColor

public void setFillColor(java.awt.Color col)

setFilled

public void setFilled(boolean f)
Overrides:
setFilled in class FigCompartment

setExternalSeparatorFigBounds

public void setExternalSeparatorFigBounds(java.awt.Rectangle r)
Set new bounds for the external separator line (if it exists).

Parameters:
r - the new bounds

makeExternalSeparatorFig

public Fig makeExternalSeparatorFig()
Create an external Fig as separator line.

Returns:
the separator Fig


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook