cz.cuni.pogamut.posh.widget
Class PoshWidget<T extends cz.cuni.amis.pogamut.sposh.elements.PoshElement>

Package class diagram package PoshWidget
java.lang.Object
  extended by org.netbeans.api.visual.widget.Widget
      extended by cz.cuni.pogamut.posh.widget.PoshWidget<T>
All Implemented Interfaces:
cz.cuni.amis.pogamut.sposh.elements.PoshElementListener, PropertyChangeListener, EventListener, Accessible, org.netbeans.api.visual.action.PopupMenuProvider
Direct Known Subclasses:
SimpleBasicWidget

public abstract class PoshWidget<T extends cz.cuni.amis.pogamut.sposh.elements.PoshElement>
extends org.netbeans.api.visual.widget.Widget
implements cz.cuni.amis.pogamut.sposh.elements.PoshElementListener, org.netbeans.api.visual.action.PopupMenuProvider

This widget is for displaying two lines of text with two differents fonts surrounded with border. Basic widget for representation of one element of posh tree What should I put here(in abstract sense)?

Author:
Honza

Nested Class Summary
protected static class PoshWidget.PropertyNode
          Small class that is used to show properties of element in the properties window.
 
Nested classes/interfaces inherited from class org.netbeans.api.visual.widget.Widget
org.netbeans.api.visual.widget.Widget.Dependency
 
Field Summary
 int height
           
protected  PoshWidget.PropertyNode propertyNode
           
 int width
           
 
Constructor Summary
protected PoshWidget(PoshScene scene, T node, PoshWidget<? extends cz.cuni.amis.pogamut.sposh.elements.PoshElement> parentWidget, String displayName)
          Create a widget representing PoshElement.
 
Method Summary
protected  Rectangle calculateClientArea()
           
protected  PoshWidget.PropertyNode createPropertiesNode()
           
protected  org.openide.nodes.Sheet createSheet()
          Create Node.Sheet for poroperties of this widget.
protected  void doRepaint()
           
protected abstract  void elementPropertyChange(PropertyChangeEvent evt)
          This is a method that is supposed to handle property changes of the lap element.
protected abstract  List<AbstractAcceptAction> getAcceptProviders()
          Return list of acceptors that will do something when proper Transferable is dropped on the widget.
 List<PoshWidget<? extends cz.cuni.amis.pogamut.sposh.elements.PoshElement>> getChildNodes()
          Get children of this node.
 String getCommentText()
          Return text of comment, actual type of PoshElement this widget represents.
 org.netbeans.api.visual.widget.ConnectionWidget getConnection()
          Set ConnectionWidget that connects this PoshWidget to its parent.
 T getDataNode()
          Get associated PoshElement
 String getHeadlineText()
          Get actual text of headline.
 PoshWidget<? extends cz.cuni.amis.pogamut.sposh.elements.PoshElement> getParent()
          Get parent widget
abstract  JPopupMenu getPopupMenu(org.netbeans.api.visual.widget.Widget arg0, Point arg1)
          Return menu associated with the widget (will be used as context menu).
 PoshScene getPoshScene()
          Return PoshScene the widget is in.
protected  org.openide.nodes.Node getPropertiesNode()
          Return Node that contains properties associated with the widget.
 PoshWidget<? extends cz.cuni.amis.pogamut.sposh.elements.PoshElement> getRootWidget()
          Get root widget of the tree this widget belongs to.
protected abstract  PoshNodeType getType()
          Get type of widget, in this case type of PoshElement
 boolean isAncestor(PoshWidget ancestorWidget)
          Is passed ancestorWidget in path from this widget to the root?
 boolean isCollapsed()
          Is this node collapsed (children won't be seen)
protected  void paintWidget()
           
 void propertyChange(PropertyChangeEvent evt)
          Listener for changes of node properties (e.g.
 void select(org.netbeans.api.visual.widget.Widget arg0, Point arg1, boolean arg2)
          What should I do if I am selected(=left clicked)? In this case, change Properties widow to properties of associated DataNode
 void setCollapsed(boolean newCollapsedState)
          Collapse or uncollapse the tree
protected  void setCommentText(String text)
           
 void setHeadlineText(String text)
          Set text that should appear in headline.
 String toString()
           
protected  void updateSources()
          Update sources according to the state of the lap tree.
 
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
 
Methods inherited from interface cz.cuni.amis.pogamut.sposh.elements.PoshElementListener
nodeChanged
 

Field Detail

propertyNode

protected PoshWidget.PropertyNode propertyNode

width

public final int width
See Also:
Constant Field Values

height

public final int height
See Also:
Constant Field Values
Constructor Detail

PoshWidget

protected PoshWidget(PoshScene scene,
                     T node,
                     PoshWidget<? extends cz.cuni.amis.pogamut.sposh.elements.PoshElement> parentWidget,
                     String displayName)
Create a widget representing PoshElement.

Parameters:
scene -
node - associated data node of this widget. never null.
parentWidget - Parent widget of this widget (parent node), can be null, if it is root of tree representation of POSH plan.
Method Detail

propertyChange

public final void propertyChange(PropertyChangeEvent evt)
Listener for changes of node properties (e.g. name). It is overriden, because after the node will change its property, I want to update sources. Use elementPropertyChange(java.beans.PropertyChangeEvent) instead.

Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
evt - description of a change in the node

elementPropertyChange

protected abstract void elementPropertyChange(PropertyChangeEvent evt)
This is a method that is supposed to handle property changes of the lap element.

Parameters:
evt - description of change

updateSources

protected final void updateSources()
Update sources according to the state of the lap tree.


getRootWidget

public final PoshWidget<? extends cz.cuni.amis.pogamut.sposh.elements.PoshElement> getRootWidget()
Get root widget of the tree this widget belongs to.

Returns:
root, not necessaryly same PoshPlan.

getChildNodes

public final List<PoshWidget<? extends cz.cuni.amis.pogamut.sposh.elements.PoshElement>> getChildNodes()
Get children of this node.

Returns:
children of the node. Never null.

getHeadlineText

public String getHeadlineText()
Get actual text of headline. It should be same as the text from getName, but if name is too long, shorten it and append "..."

Returns:
text of the headline label

getCommentText

public String getCommentText()
Return text of comment, actual type of PoshElement this widget represents. If it is too long, it will be shortened to fit the width of PoshWidget.

Returns:
text of the comment label

setCommentText

protected final void setCommentText(String text)

isAncestor

public boolean isAncestor(PoshWidget ancestorWidget)
Is passed ancestorWidget in path from this widget to the root?

Parameters:
ancestorWidget - widget that
Returns:
true if this widget is offspring of ancestorWidget

setHeadlineText

public final void setHeadlineText(String text)
Set text that should appear in headline.

Parameters:
text - Text that should be shown in headline

getAcceptProviders

protected abstract List<AbstractAcceptAction> getAcceptProviders()
Return list of acceptors that will do something when proper Transferable is dropped on the widget.

Returns:
List of DnD accepting providers. Never null.

getType

protected abstract PoshNodeType getType()
Get type of widget, in this case type of PoshElement

Returns:
type of PoshElement this Widget represents.

getPopupMenu

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

Specified by:
getPopupMenu in interface org.netbeans.api.visual.action.PopupMenuProvider
Parameters:
arg0 - ignored
arg1 - ignored
Returns:
Menu, never null

getDataNode

public T getDataNode()
Get associated PoshElement

Returns:
associated data node

getPoshScene

public PoshScene getPoshScene()
Return PoshScene the widget is in.

Returns:
PoshScene this widget belongs to

getParent

public PoshWidget<? extends cz.cuni.amis.pogamut.sposh.elements.PoshElement> getParent()
Get parent widget

Returns:
widget that is parent or null, if this widget is root

createSheet

protected org.openide.nodes.Sheet createSheet()
Create Node.Sheet for poroperties of this widget.

Returns:

getPropertiesNode

protected final org.openide.nodes.Node getPropertiesNode()
Return Node that contains properties associated with the widget. In most cases it s getDataNode, but it is useful to override when widget represent more than one datanode

Returns:
node that has the properties we want to show in Properties widow

createPropertiesNode

protected PoshWidget.PropertyNode createPropertiesNode()

select

public void select(org.netbeans.api.visual.widget.Widget arg0,
                   Point arg1,
                   boolean arg2)
What should I do if I am selected(=left clicked)? In this case, change Properties widow to properties of associated DataNode


getConnection

public final org.netbeans.api.visual.widget.ConnectionWidget getConnection()
Set ConnectionWidget that connects this PoshWidget to its parent.

Returns:
can be null, if connection hasn't been set yet.

toString

public String toString()
Overrides:
toString in class Object

isCollapsed

public boolean isCollapsed()
Is this node collapsed (children won't be seen)

Returns:
True if this node is collapsed

setCollapsed

public void setCollapsed(boolean newCollapsedState)
Collapse or uncollapse the tree


doRepaint

protected void doRepaint()

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


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