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

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

public abstract class SimpleBasicWidget<T extends cz.cuni.amis.pogamut.sposh.elements.PoshElement>
extends PoshWidget<T>

Basic widget for KidView. Events are handled individually in methods addChildWidget deleteWidgetFromScene moveChildWidget

Author:
HonzaH

Nested Class Summary
 
Nested classes/interfaces inherited from class cz.cuni.pogamut.posh.widget.PoshWidget
PoshWidget.PropertyNode
 
Nested classes/interfaces inherited from class org.netbeans.api.visual.widget.Widget
org.netbeans.api.visual.widget.Widget.Dependency
 
Field Summary
 
Fields inherited from class cz.cuni.pogamut.posh.widget.PoshWidget
height, propertyNode, width
 
Constructor Summary
protected SimpleBasicWidget(PoshScene poshScene, T dataNode, PoshWidget<? extends cz.cuni.amis.pogamut.sposh.elements.PoshElement> parent, String name)
           
 
Method Summary
protected abstract  void addChildWidget(cz.cuni.amis.pogamut.sposh.elements.PoshElement dataNode)
          This is called when node is added as child
protected  void addTriggeredActionWidgets(int index, cz.cuni.amis.pogamut.sposh.elements.TriggeredAction dataNode)
          Add correct widget that is going to represent triggered action (competence, action pattern or action) to the place of the tree.
protected  void addTriggeredActionWidgets(cz.cuni.amis.pogamut.sposh.elements.TriggeredAction dataNode)
          Add correct widget that is going to represent triggered action (competence, action pattern or action) to the place of the tree.
protected  void changeTriggeredActionWidgets(cz.cuni.amis.pogamut.sposh.elements.TriggeredAction ta)
          Take this widget, remove it and on the original place where this widget was place proper representaion of trigggered action (by addTriggeredActionWidgets)
protected abstract  List<AbstractMenuAction> createMenuActions()
          Create actions for context menu.
protected  void deleteWidgetFromScene(cz.cuni.amis.pogamut.sposh.elements.PoshElement dataNode)
          Common function for deleting widget from scene
protected  PoshWidget getAssociatedWidget(List<PoshWidget<? extends cz.cuni.amis.pogamut.sposh.elements.PoshElement>> list, cz.cuni.amis.pogamut.sposh.elements.PoshElement dataNode)
          Get widget from the list that has dataNodeas associated node.
protected  int getIndexOfElement(List list, Object element)
          Get indexof element in the list that has same reference as the passed object.
 JPopupMenu getPopupMenu(org.netbeans.api.visual.widget.Widget arg0, Point arg1)
          Return menu associated with the widget (will be used as context menu).
protected  void moveChildWidget(cz.cuni.amis.pogamut.sposh.elements.PoshElement movedChildDN)
          Key functionm that is called when dataNode is moved Since KidView closely resembles PoshPlan structure, just one function for all should be enough.
protected  void moveChildWidgetNode(int from, int to)
          Move element in getChildNodes()
 void nodeChanged(cz.cuni.amis.pogamut.sposh.PoshTreeEvent event, cz.cuni.amis.pogamut.sposh.elements.PoshElement dataNode)
           
 
Methods inherited from class cz.cuni.pogamut.posh.widget.PoshWidget
calculateClientArea, createPropertiesNode, createSheet, doRepaint, elementPropertyChange, getAcceptProviders, getChildNodes, getCommentText, getConnection, getDataNode, getHeadlineText, getParent, getPoshScene, getPropertiesNode, getRootWidget, getType, isAncestor, isCollapsed, paintWidget, propertyChange, select, setCollapsed, setCommentText, setHeadlineText, toString, updateSources
 
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
 

Constructor Detail

SimpleBasicWidget

protected SimpleBasicWidget(PoshScene poshScene,
                            T dataNode,
                            PoshWidget<? extends cz.cuni.amis.pogamut.sposh.elements.PoshElement> parent,
                            String name)
Method Detail

nodeChanged

public final void nodeChanged(cz.cuni.amis.pogamut.sposh.PoshTreeEvent event,
                              cz.cuni.amis.pogamut.sposh.elements.PoshElement dataNode)

addChildWidget

protected abstract void addChildWidget(cz.cuni.amis.pogamut.sposh.elements.PoshElement dataNode)
This is called when node is added as child

Parameters:
dataNode -

moveChildWidget

protected void moveChildWidget(cz.cuni.amis.pogamut.sposh.elements.PoshElement movedChildDN)
Key functionm that is called when dataNode is moved Since KidView closely resembles PoshPlan structure, just one function for all should be enough. We don't know what or where was it moved.

Parameters:
movedChildDN - data node that was moved in POSH plan.

deleteWidgetFromScene

protected void deleteWidgetFromScene(cz.cuni.amis.pogamut.sposh.elements.PoshElement dataNode)
Common function for deleting widget from scene


createMenuActions

protected abstract List<AbstractMenuAction> createMenuActions()
Create actions for context menu.

Returns:
not null, list of actions for context menu

getPopupMenu

public final JPopupMenu getPopupMenu(org.netbeans.api.visual.widget.Widget arg0,
                                     Point arg1)
Description copied from class: PoshWidget
Return menu associated with the widget (will be used as context menu).

Specified by:
getPopupMenu in interface org.netbeans.api.visual.action.PopupMenuProvider
Specified by:
getPopupMenu in class PoshWidget<T extends cz.cuni.amis.pogamut.sposh.elements.PoshElement>
Parameters:
arg0 - ignored
arg1 - ignored
Returns:
Menu, never null

addTriggeredActionWidgets

protected void addTriggeredActionWidgets(cz.cuni.amis.pogamut.sposh.elements.TriggeredAction dataNode)
Add correct widget that is going to represent triggered action (competence, action pattern or action) to the place of the tree. This doesn't add one widget, but it determines what is dataNode representing (C, AP or action) and adds all widgets of that representaion to the tree. Action has only one widget,but other two can be intervened and can create a really big new subtree instead of just one widget. Add this new subtree to the last place of your children. *

Parameters:
dataNode - triggered widget

addTriggeredActionWidgets

protected void addTriggeredActionWidgets(int index,
                                         cz.cuni.amis.pogamut.sposh.elements.TriggeredAction dataNode)
Add correct widget that is going to represent triggered action (competence, action pattern or action) to the place of the tree. This doesn't add one widget, but it determines what is dataNode representing (C, AP or action) and adds all widgets of that representaion to the tree. Action has only one widget,but other two can be intervened and can create a really big new subtree instead of just one widget.

Parameters:
dataNode - triggered widget

changeTriggeredActionWidgets

protected void changeTriggeredActionWidgets(cz.cuni.amis.pogamut.sposh.elements.TriggeredAction ta)
Take this widget, remove it and on the original place where this widget was place proper representaion of trigggered action (by addTriggeredActionWidgets)

Parameters:
ta - triggered action we are adding to place of this widget.

getIndexOfElement

protected final int getIndexOfElement(List list,
                                      Object element)
Get indexof element in the list that has same reference as the passed object. Throw runtimeexception if object is not in the list.

Parameters:
list - List in which we are looking.
element - object we are looking for in the list.
Returns:
index of object in the list

getAssociatedWidget

protected final PoshWidget getAssociatedWidget(List<PoshWidget<? extends cz.cuni.amis.pogamut.sposh.elements.PoshElement>> list,
                                               cz.cuni.amis.pogamut.sposh.elements.PoshElement dataNode)
Get widget from the list that has dataNodeas associated node. Throw runtime exception if no such widget found.

Parameters:
list -
dataNode -
Returns:
widget that is in the list and that is associated with dataNode

moveChildWidgetNode

protected final void moveChildWidgetNode(int from,
                                         int to)
Move element in getChildNodes()

Parameters:
from - index in the list of children the child is moved from
to - index in the list of children the child is moved to


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