cz.cuni.pogamut.shed.widget
Class ShedWidget

Package class diagram package ShedWidget
java.lang.Object
  extended by org.netbeans.api.visual.widget.Widget
      extended by cz.cuni.pogamut.shed.widget.ShedWidget
Type Parameters:
T - Type of element this widget is attached to.
All Implemented Interfaces:
IPresentedWidget, Accessible, org.netbeans.api.visual.action.PopupMenuProvider
Direct Known Subclasses:
ShedCollapseWidget, ShedSenseWidget

public class ShedWidget
extends org.netbeans.api.visual.widget.Widget
implements org.netbeans.api.visual.action.PopupMenuProvider, IPresentedWidget

Ancestor of all widgets in the ShedScene. It provides common infrastructure and helper methods for all widgets, e.g. drag and drop, display name ect.

The widget is painted as colored rectangle with text drawn over it. * If size of widget is too small, the text will be truncated (three dots will be appended to the truncated text) so it fits.

The origin of the widget ([0, 0]) is at the top left corner.

Author:
HonzaH

Nested Class Summary
static class ShedWidget.Variable
          Structure holding info about variable shown in the widget.
 
Nested classes/interfaces inherited from class org.netbeans.api.visual.widget.Widget
org.netbeans.api.visual.widget.Widget.Dependency
 
Field Summary
protected  IPresenter actionProvider
          Provider of actions for this widget, menu, accept and others.
protected  Color borderColor
          Color of the border
protected  Color color
          Color of the widget
protected static int height
          Default height of ShedWidget.
protected static int width
          Default width of ShedWidget.
 
Method Summary
 void addBreakpoint(boolean single)
          Show strip at the right side of the widget
protected  Rectangle calculateClientArea()
           
 String getDisplayName()
          Get display name of the widget
 JPopupMenu getPopupMenu(org.netbeans.api.visual.widget.Widget widget, Point localLocation)
          Return menu associated with the widget (will be used as context menu).
 IPresenter getPresenter()
          Get presenter of the widget.
protected  void paintWidget()
           
 void removeBreakpoint()
          Remove colored strip on the right side of widget that was representing the breakpoint.
 void setActiveIntensity(int percent)
          Set intensity of red border, if 0, border will have color of widget, if 100, border will be bright red.
 void setDisplayName(String newDisplayName)
           
 void setError(List<ShedWidget.Variable> newMissing)
          Set list of lines that will be shown in red bold font under presentVars lines.
 void setPresent(List<ShedWidget.Variable> newPresent)
          Set list of lines that will be shown in bold font under title.
 void setPresenter(IPresenter newPresenter)
          Set new presenter of the widget.
 void setUnused(List<ShedWidget.Variable> newUnused)
          Set list of lines that will be shown in italic font under errorVars lines.
 String toString()
           
 
Methods inherited from class org.netbeans.api.visual.widget.Widget
addChild, addChild, addChild, addChild, addChildren, addDependency, bringToBack, bringToFront, 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, 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, wait, wait, wait
 

Field Detail

color

protected Color color
Color of the widget


borderColor

protected Color borderColor
Color of the border


actionProvider

protected IPresenter actionProvider
Provider of actions for this widget, menu, accept and others.


width

protected static final int width
Default width of ShedWidget.

See Also:
Constant Field Values

height

protected static final int height
Default height of ShedWidget.

See Also:
Constant Field Values
Method Detail

getDisplayName

public final String getDisplayName()
Get display name of the widget

Returns:
display name

setDisplayName

public final void setDisplayName(String newDisplayName)

setPresent

public final void setPresent(List<ShedWidget.Variable> newPresent)
Set list of lines that will be shown in bold font under title.

Parameters:
newPresent - New list representations of presentVars variables

setError

public final void setError(List<ShedWidget.Variable> newMissing)
Set list of lines that will be shown in red bold font under presentVars lines.

Parameters:
newMissing - New list representations of presentVars variables

setUnused

public final void setUnused(List<ShedWidget.Variable> newUnused)
Set list of lines that will be shown in italic font under errorVars lines.

Parameters:
newUnused - New list representations of errorVars variables

setActiveIntensity

public void setActiveIntensity(int percent)
Set intensity of red border, if 0, border will have color of widget, if 100, border will be bright red. Used to show which elements of plan are being executed.

Parameters:
percent - Intensity in percents, 0-100

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)
Set new presenter of the widget. Upon creation of the widget, it should be null.

Parameters:
newPresenter - New presenter.

addBreakpoint

public void addBreakpoint(boolean single)
Show strip at the right side of the widget

Since:
What color, dark red or light red

removeBreakpoint

public void removeBreakpoint()
Remove colored strip on the right side of widget that was representing the breakpoint.


getPopupMenu

public final JPopupMenu getPopupMenu(org.netbeans.api.visual.widget.Widget widget,
                                     Point localLocation)
Return menu associated with the widget (will be used as context menu).

Specified by:
getPopupMenu in interface org.netbeans.api.visual.action.PopupMenuProvider
Parameters:
widget - widget on which the popup menu is requested (always this)
localLocation - Where was popup menu invoked, if null, invoked by keyboard
Returns:
Created menu or null, if no actions from #getMenuActions() .

calculateClientArea

protected Rectangle calculateClientArea()
Overrides:
calculateClientArea in class org.netbeans.api.visual.widget.Widget

paintWidget

protected void paintWidget()
Overrides:
paintWidget in class org.netbeans.api.visual.widget.Widget

toString

public String toString()
Overrides:
toString in class Object


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