org.apache.commons.jelly.tags.swt
Class WidgetTag

java.lang.Object
  |
  +--org.apache.commons.jelly.TagSupport
        |
        +--org.apache.commons.jelly.DynaTagSupport
              |
              +--org.apache.commons.jelly.MapTagSupport
                    |
                    +--org.apache.commons.jelly.tags.core.UseBeanTag
                          |
                          +--org.apache.commons.jelly.tags.swt.WidgetTag
All Implemented Interfaces:
org.apache.commons.jelly.impl.BeanSource, org.apache.commons.jelly.DynaTag, org.apache.commons.jelly.Tag
Direct Known Subclasses:
DialogTag, MenuTag

public class WidgetTag
extends org.apache.commons.jelly.tags.core.UseBeanTag

This tag creates an SWT widget based on the parent tag, optionally declaring this widget as a variable if the var attribute is specified.

Version:
1.1
Author:
James Strachan, Christiaan ten Klooster

Field Summary
protected  org.eclipse.swt.widgets.Widget parent
           
 
Fields inherited from class org.apache.commons.jelly.TagSupport
body, context, hasTrimmed, shouldTrim
 
Constructor Summary
WidgetTag(java.lang.Class widgetClass)
           
WidgetTag(java.lang.Class widgetClass, int style)
           
 
Method Summary
protected  void attachWidgets(java.lang.Object parent, org.eclipse.swt.widgets.Widget widget)
          Provides a strategy method to allow a new child widget to be attached to its parent
protected  void clearBean()
          Sets the bean to null, to prevent it from sticking around in the event that this tag instance is cached.
protected  java.lang.Object createWidget(java.lang.Class theClass, org.eclipse.swt.widgets.Widget parent, int style)
          Factory method to create an instance of the given Widget class with the given parent and SWT style
 void doTag(org.apache.commons.jelly.XMLOutput output)
           
protected  org.eclipse.swt.graphics.Color getColor(org.eclipse.swt.widgets.Control control, java.lang.Object colorValue)
          Get a color for the control
 org.eclipse.swt.widgets.Widget getParentWidget()
           
protected  int getStyle(java.util.Map attributes)
          Creates the SWT style code for the current attributes
 org.eclipse.swt.widgets.Widget getWidget()
           
protected  java.lang.Object newInstance(java.lang.Class theClass, java.util.Map attributes, org.apache.commons.jelly.XMLOutput output)
          Factory method to create a new widget
protected  void setBeanProperties(java.lang.Object bean, java.util.Map attributes)
           
protected  void setSize(org.eclipse.swt.widgets.Control control, java.lang.Object size)
          set the size of the control
 java.lang.String toString()
           
 
Methods inherited from class org.apache.commons.jelly.tags.core.UseBeanTag
addIgnoreProperty, convertToClass, getBean, getDefaultClass, getIgnorePropertySet, isIgnoreUnknownProperties, loadClass, processBean, setBean, setIgnoreUnknownProperties, validateBeanProperties
 
Methods inherited from class org.apache.commons.jelly.MapTagSupport
createAttributes, getAttributes, setAttribute
 
Methods inherited from class org.apache.commons.jelly.DynaTagSupport
getAttributeType
 
Methods inherited from class org.apache.commons.jelly.TagSupport
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.commons.jelly.Tag
getBody, getContext, getParent, invokeBody, setBody, setContext, setParent
 

Field Detail

parent

protected org.eclipse.swt.widgets.Widget parent
Constructor Detail

WidgetTag

public WidgetTag(java.lang.Class widgetClass)

WidgetTag

public WidgetTag(java.lang.Class widgetClass,
                 int style)
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getWidget

public org.eclipse.swt.widgets.Widget getWidget()
Returns:
the visible widget, if there is one.

getParentWidget

public org.eclipse.swt.widgets.Widget getParentWidget()
Returns:
the parent widget which this widget will be added to.

doTag

public void doTag(org.apache.commons.jelly.XMLOutput output)
           throws org.apache.commons.jelly.JellyTagException
Overrides:
doTag in class org.apache.commons.jelly.tags.core.UseBeanTag

newInstance

protected java.lang.Object newInstance(java.lang.Class theClass,
                                       java.util.Map attributes,
                                       org.apache.commons.jelly.XMLOutput output)
                                throws org.apache.commons.jelly.JellyTagException
Factory method to create a new widget
Overrides:
newInstance in class org.apache.commons.jelly.tags.core.UseBeanTag

setBeanProperties

protected void setBeanProperties(java.lang.Object bean,
                                 java.util.Map attributes)
                          throws org.apache.commons.jelly.JellyTagException
Overrides:
setBeanProperties in class org.apache.commons.jelly.tags.core.UseBeanTag

getColor

protected org.eclipse.swt.graphics.Color getColor(org.eclipse.swt.widgets.Control control,
                                                  java.lang.Object colorValue)
Get a color for the control
Parameters:
control -  
colorValue -  

setSize

protected void setSize(org.eclipse.swt.widgets.Control control,
                       java.lang.Object size)
set the size of the control
Parameters:
control -  
size -  

attachWidgets

protected void attachWidgets(java.lang.Object parent,
                             org.eclipse.swt.widgets.Widget widget)
                      throws org.apache.commons.jelly.JellyTagException
Provides a strategy method to allow a new child widget to be attached to its parent
Parameters:
parent - is the parent widget which is never null
widget - is the new child widget to be attached to the parent

createWidget

protected java.lang.Object createWidget(java.lang.Class theClass,
                                        org.eclipse.swt.widgets.Widget parent,
                                        int style)
                                 throws org.apache.commons.jelly.JellyTagException
Factory method to create an instance of the given Widget class with the given parent and SWT style
Parameters:
theClass - is the type of widget to create
parent - is the parent widget
style - the SWT style code
Returns:
the new Widget

getStyle

protected int getStyle(java.util.Map attributes)
                throws org.apache.commons.jelly.JellyTagException
Creates the SWT style code for the current attributes
Returns:
the SWT style code

clearBean

protected void clearBean()
Sets the bean to null, to prevent it from sticking around in the event that this tag instance is cached. This method is called at the end of doTag.


Copyright © 2002-2004 Apache Software Foundation. All Rights Reserved.