public class SwtMetawidget
extends org.eclipse.swt.widgets.Composite
Modifier and Type | Class and Description |
---|---|
protected class |
SwtMetawidget.Pipeline |
Constructor and Description |
---|
SwtMetawidget(org.eclipse.swt.widgets.Composite parent,
int style) |
Modifier and Type | Method and Description |
---|---|
void |
addInspectionResultProcessor(InspectionResultProcessor<SwtMetawidget> inspectionResultProcessor) |
void |
addWidgetProcessor(WidgetProcessor<org.eclipse.swt.widgets.Control,SwtMetawidget> widgetProcessor) |
protected void |
buildWidgets() |
protected void |
endBuild() |
org.eclipse.swt.widgets.Control[] |
getChildren() |
<T extends org.eclipse.swt.widgets.Control> |
getControl(String... names)
Finds the Control with the given name.
|
org.eclipse.swt.widgets.Composite |
getCurrentLayoutComposite()
This method is public for use by WidgetBuilders to attach Controls to the current Composite
as defined by the Layout.
|
protected String |
getDefaultConfiguration() |
Facet |
getFacet(String name) |
String |
getInspectionPath() |
String |
getLabelString(Map<String,String> attributes)
Returns a label for the given set of attributes.
|
org.eclipse.swt.widgets.Layout |
getLayout() |
String |
getLocalizedKey(String key) |
int |
getMaximumInspectionDepth() |
<T> T |
getToInspect()
Gets the Object being inspected.
|
<T> T |
getValue(String... names)
Gets the value from the Control with the given name.
|
String |
getValueProperty(org.eclipse.swt.widgets.Control control)
Returns the property used to get/set the value of the control.
|
<T> T |
getWidgetProcessor(Class<T> widgetProcessorClass) |
protected void |
initNestedMetawidget(SwtMetawidget nestedMetawidget,
Map<String,String> attributes) |
String |
inspect(Object toInspect,
String type,
String... names)
Useful for WidgetBuilders to perform nested inspections (eg.
|
protected void |
invalidateInspection()
Invalidates the current inspection result (if any) and invalidates the widgets.
|
protected void |
invalidateWidgets()
Invalidates the widgets.
|
boolean |
isReadOnly() |
protected void |
layoutWidget(org.eclipse.swt.widgets.Control control,
String elementName,
Map<String,String> attributes) |
protected SwtMetawidget.Pipeline |
newPipeline()
Instantiate the Pipeline used by this Metawidget.
|
void |
removeInspectionResultProcessor(InspectionResultProcessor<SwtMetawidget> inspectionResultProcessor) |
void |
removeWidgetProcessor(WidgetProcessor<org.eclipse.swt.widgets.Control,SwtMetawidget> widgetProcessor) |
void |
setBundle(ResourceBundle bundle) |
void |
setConfig(String config) |
void |
setInspectionResultProcessors(InspectionResultProcessor<SwtMetawidget>... inspectionResultProcessors) |
void |
setInspector(Inspector inspector) |
void |
setMaximumInspectionDepth(int maximumInspectionDepth) |
void |
setMetawidgetLayout(Layout<org.eclipse.swt.widgets.Control,org.eclipse.swt.widgets.Composite,SwtMetawidget> layout)
Set the layout for this Metawidget.
|
void |
setPath(String path)
Sets the path to be inspected.
|
void |
setReadOnly(boolean readOnly) |
void |
setToInspect(Object toInspect)
Sets the Object to inspect.
|
void |
setValue(Object value,
String... names)
Sets the Control with the given name to the specified value.
|
void |
setWidgetBuilder(WidgetBuilder<org.eclipse.swt.widgets.Control,SwtMetawidget> widgetBuilder) |
void |
setWidgetProcessors(WidgetProcessor<org.eclipse.swt.widgets.Control,SwtMetawidget>... widgetProcessors) |
void |
updateToInspectWithoutInvalidate(Object toInspect)
Updates the Object to inspect, without invalidating the previous inspection results.
|
changed, checkSubclass, computeSize, drawBackground, getBackgroundMode, getClientArea, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
computeTrim, getBorderWidth, getHorizontalBar, getVerticalBar
addControlListener, addDragDetectListener, addFocusListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getRegion, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setRegion, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
public SwtMetawidget(org.eclipse.swt.widgets.Composite parent, int style)
public void setToInspect(Object toInspect)
If setPath
has not been set, or points to a previous
setToInspect
, sets it to point to the given Object.
public void updateToInspectWithoutInvalidate(Object toInspect)
This is an internal API exposed for WidgetProcessor rebinding support. Clients should not call it directly.
public <T> T getToInspect()
Exposed for binding implementations.
Person p = getToInspect()
)public void setPath(String path)
public String getInspectionPath()
public void setConfig(String config)
public void setInspector(Inspector inspector)
public String inspect(Object toInspect, String type, String... names)
public void addInspectionResultProcessor(InspectionResultProcessor<SwtMetawidget> inspectionResultProcessor)
public void removeInspectionResultProcessor(InspectionResultProcessor<SwtMetawidget> inspectionResultProcessor)
public void setInspectionResultProcessors(InspectionResultProcessor<SwtMetawidget>... inspectionResultProcessors)
public void setWidgetBuilder(WidgetBuilder<org.eclipse.swt.widgets.Control,SwtMetawidget> widgetBuilder)
public void addWidgetProcessor(WidgetProcessor<org.eclipse.swt.widgets.Control,SwtMetawidget> widgetProcessor)
public void removeWidgetProcessor(WidgetProcessor<org.eclipse.swt.widgets.Control,SwtMetawidget> widgetProcessor)
public void setWidgetProcessors(WidgetProcessor<org.eclipse.swt.widgets.Control,SwtMetawidget>... widgetProcessors)
public <T> T getWidgetProcessor(Class<T> widgetProcessorClass)
public void setMetawidgetLayout(Layout<org.eclipse.swt.widgets.Control,org.eclipse.swt.widgets.Composite,SwtMetawidget> layout)
Named setMetawidgetLayout
, rather than the usual setLayout
, because
SWT already defines a setLayout
. Overloading SWT's setLayout
was
considered cute, but ultimately confusing and dangerous. For example, what should
setLayout( null )
do?
public void setBundle(ResourceBundle bundle)
public String getLabelString(Map<String,String> attributes)
The label is determined using the following algorithm:
public String getLocalizedKey(String key)
public boolean isReadOnly()
public void setReadOnly(boolean readOnly)
public int getMaximumInspectionDepth()
public void setMaximumInspectionDepth(int maximumInspectionDepth)
public <T> T getValue(String... names)
The value is returned as it was stored in the Control (eg. String for JTextField) so may need some conversion before being reapplied to the object being inspected. This obviously requires knowledge of which Control SwtMetawidget created, which is not ideal, so clients may prefer to use a binding WidgetProcessor instead.
String s = getValue(names)
)public void setValue(Object value, String... names)
Clients must ensure the value is of the correct type to suit the Control (eg. String for JTextField). This obviously requires knowledge of which Control SwtMetawidget created, which is not ideal, so clients may prefer to use a binding WidgetProcessor instead.
public String getValueProperty(org.eclipse.swt.widgets.Control control)
If the control is not known, returns null
. Does not throw an Exception, as we
want to fail gracefully if, say, someone tries to bind to a JPanel.
public <T extends org.eclipse.swt.widgets.Control> T getControl(String... names)
public org.eclipse.swt.widgets.Composite getCurrentLayoutComposite()
public org.eclipse.swt.widgets.Layout getLayout()
getLayout
in class org.eclipse.swt.widgets.Composite
public org.eclipse.swt.widgets.Control[] getChildren()
getChildren
in class org.eclipse.swt.widgets.Composite
protected SwtMetawidget.Pipeline newPipeline()
Subclasses wishing to use their own Pipeline should override this method to instantiate their version.
protected String getDefaultConfiguration()
protected void invalidateInspection()
As an optimisation we only invalidate the widgets, not the entire inspection result, for some operations (such as adding/removing stubs, changing read-only etc.)
protected void invalidateWidgets()
protected void buildWidgets()
protected void layoutWidget(org.eclipse.swt.widgets.Control control, String elementName, Map<String,String> attributes)
elementName
- XML node name of the business field. Typically 'entity', 'property' or 'action'.
Never nullprotected void endBuild()
protected void initNestedMetawidget(SwtMetawidget nestedMetawidget, Map<String,String> attributes)
Copyright © 2015. All Rights Reserved.