|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.netbeans.api.visual.widget.Widget
cz.cuni.pogamut.shed.widget.ShedWidget
T - Type of element this widget is attached to.public class ShedWidget
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.
| 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 IPresenter |
actionProvider
Provider of actions for this widget, menu, accept and others. |
protected Color |
color
Color of the widget |
protected static Font |
font
Font used to display text on the widget |
protected static int |
height
Default height of ShedWidget. |
protected static int |
textOfs
Distance between left border of the widget and first letter of the text |
protected static int |
width
Default width of ShedWidget. |
| Method Summary | |
|---|---|
protected void |
drawString(Graphics2D g,
Font font,
Color color,
String text)
Draw vertically centered string at TextWidget#textOfs that will
fit into the widget. |
String |
getDisplayName()
Get display name of the widget |
protected String |
getFittingString(String text,
FontMetrics metrics,
int maxWidth)
Get string that will be shorter than maxWidth. |
protected Action[] |
getMenuActions()
Get(create) list of actions for the context menu 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. |
ShedScene |
getShedScene()
Method wrapping Widget.getScene() to avoid casting every time. |
protected void |
paintWidget()
|
void |
setDisplayName(String newDisplayName)
|
void |
setPresenter(IPresenter newPresenter)
Set new presenter of the widget. |
String |
toString()
|
| 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, 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 |
|---|
protected static final int textOfs
protected Color color
protected IPresenter actionProvider
protected static final int width
ShedWidget.
protected static final int height
ShedWidget.
protected static final Font font
| Method Detail |
|---|
public final String getDisplayName()
public final void setDisplayName(String newDisplayName)
public ShedScene getShedScene()
Widget.getScene() to avoid casting every time.
public final JPopupMenu getPopupMenu(org.netbeans.api.visual.widget.Widget widget,
Point localLocation)
getPopupMenu in interface org.netbeans.api.visual.action.PopupMenuProviderwidget - widget on which the popup menu is requested (always this)localLocation - Where was popup menu invoked, if null, invoked by
keyboard
getMenuActions().protected final Action[] getMenuActions()
public final IPresenter getPresenter()
IPresentedWidget
getPresenter in interface IPresentedWidgetpublic final void setPresenter(IPresenter newPresenter)
newPresenter - New presenter.protected void paintWidget()
paintWidget in class org.netbeans.api.visual.widget.Widget
protected final void drawString(Graphics2D g,
Font font,
Color color,
String text)
TextWidget#textOfs that will
fit into the widget. If text is too long, truncate it and add ellipsis
(three dots) at the end.
g - context used to drawfont - font which should be used to computecolor - what color should text havetext - text to draw.
protected final String getFittingString(String text,
FontMetrics metrics,
int maxWidth)
text - Text we want to fit into maxWidthmetrics - font metrics to measure length of stringsmaxWidth - maximal length the returned string can fit into.
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||