cz.cuni.pogamut.shed.widget
Class AbstractShedEnvelope<T extends org.netbeans.api.visual.widget.Widget>

Package class diagram package AbstractShedEnvelope
java.lang.Object
  extended by org.netbeans.api.visual.widget.Widget
      extended by cz.cuni.pogamut.shed.widget.AbstractShedEnvelope<T>
Type Parameters:
T - Type of children the envelope will contain.
All Implemented Interfaces:
IPresentedWidget, IShedEnvelope<T>, Accessible
Direct Known Subclasses:
ShedActionsEnvelope, ShedChoicesEnvelope, ShedDrivesEnvelope, ShedTriggerEnvelope

public abstract class AbstractShedEnvelope<T extends org.netbeans.api.visual.widget.Widget>
extends org.netbeans.api.visual.widget.Widget
implements IShedEnvelope<T>, IPresentedWidget

Envelope that should contain multiple widgets of same type (e.g. drives, choices, senses...).

Author:
Honza

Nested Class Summary
 
Nested classes/interfaces inherited from class org.netbeans.api.visual.widget.Widget
org.netbeans.api.visual.widget.Widget.Dependency
 
Field Summary
protected  ShedScene scene
           
 
Constructor Summary
protected AbstractShedEnvelope(ShedScene scene)
           
 
Method Summary
 void add(T newWidget)
          Add widget to the envelope behind the last element
 void add(T newWidget, int position)
          Add widget at specified position.
 T getChild(int position)
          Typed Wrapper for Widget.getChildren().List.get(int).
 IPresenter getPresenter()
          Get presenter of the widget.
 void move(int absoluteIndex, T movedWidget)
          Move the widget relative to the other widgets.
 int numberOfChildren()
          Get number of children, used for type safe looping.
 void remove(T removedWidget)
          Remove widget and its branch from the scene.
 void setPresenter(IPresenter newPresenter)
           
protected abstract  void updateChildrenPositions()
          Method called when child widget is added/moved/deleted.
 
Methods inherited from class org.netbeans.api.visual.widget.Widget
addChild, addChild, addChild, addChild, addChildren, addDependency, bringToBack, bringToFront, calculateClientArea, convertLocalToScene, convertLocalToScene, convertSceneToLocal, convertSceneToLocal, createActions, equals, getAccessibleContext, getActions, getActions, getBackground, getBorder, getBounds, getChildConstraint, getChildren, getClientArea, getCursor, getCursorAt, getDependencies, getFont, getForeground, getGraphics, getLayout, getLocation, getLookup, getMaximumSize, getMinimumSize, getParentWidget, getPreferredBounds, getPreferredLocation, getPreferredSize, getResourceTable, getScene, getState, getToolTipText, hashCode, isCheckClipping, isEnabled, isHitAt, isOpaque, isPreferredBoundsSet, isRepaintRequiredForRevalidating, isValidated, isVisible, notifyAdded, notifyBackgroundChanged, notifyFontChanged, notifyForegroundChanged, notifyRemoved, notifyStateChanged, paint, paintBackground, paintBorder, paintChildren, paintWidget, removeChild, removeChildren, removeChildren, removeDependency, removeFromParent, repaint, resolveBounds, revalidate, revalidate, setAccessibleContext, setBackground, setBackgroundFromResource, setBorder, setBorder, setCheckClipping, setChildConstraint, setCursor, setEnabled, setFont, setFontFromResource, setForeground, setForegroundFromResource, setLayout, setMaximumSize, setMinimumSize, setOpaque, setPreferredBounds, setPreferredLocation, setPreferredSize, setResourceTable, setState, setToolTipText, setVisible, updateResources
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scene

protected final ShedScene scene
Constructor Detail

AbstractShedEnvelope

protected AbstractShedEnvelope(ShedScene scene)
Method Detail

updateChildrenPositions

protected abstract void updateChildrenPositions()
Method called when child widget is added/moved/deleted. Its job is to make sure that children are correctly positioned. What it does depend on layout of the envelope. In many cases, there is no need to do anything, but e.g. absolute layout would require to manually update position of children. Use Widget.setPreferredLocation(java.awt.Point).


add

public final void add(T newWidget,
                      int position)
Add widget at specified position.

Specified by:
add in interface IShedEnvelope<T extends org.netbeans.api.visual.widget.Widget>
Parameters:
newWidget -
position -

add

public final void add(T newWidget)
Add widget to the envelope behind the last element

Parameters:
newWidget - Widget that wll be added to the envelope at the last place

move

public final void move(int absoluteIndex,
                       T movedWidget)
Description copied from interface: IShedEnvelope
Move the widget relative to the other widgets.

Specified by:
move in interface IShedEnvelope<T extends org.netbeans.api.visual.widget.Widget>
movedWidget - widget to move

remove

public final void remove(T removedWidget)
Remove widget and its branch from the scene.

Specified by:
remove in interface IShedEnvelope<T extends org.netbeans.api.visual.widget.Widget>
Parameters:
removedWidget - Branch to remove

getChild

public final T getChild(int position)
Typed Wrapper for Widget.getChildren().List.get(int). Get child at specified position and return it.

Parameters:
position - position of the child we want.
Returns:
Properly typed child.

numberOfChildren

public final int numberOfChildren()
Get number of children, used for type safe looping.


getPresenter

public final IPresenter getPresenter()
Description copied from interface: IPresentedWidget
Get presenter of the widget.

Specified by:
getPresenter in interface IPresentedWidget

setPresenter

public final void setPresenter(IPresenter newPresenter)


Copyright © 2015 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.