Define styles used for a custom widget

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Define styles used for a custom widget

Postby fridi » Wed Jan 21, 2009 8:02 am

I have subclasses a clabel and I have implemented a special behaviour that represents something like a button with the radio style.
For my widget, I would like the SWT Designer to offer me my RADIO style.
Different widgets support different styles, but where is point to define those styles so that the designer lists the styles?
thx in advance,
Fridi
fridi
 
Posts: 6
Joined: Tue Feb 24, 2004 8:45 am
Location: Germany

Re: Define styles used for a custom widget

Postby Eric Clayberg » Wed Jan 21, 2009 2:21 pm

fridi wrote:Different widgets support different styles, but where is point to define those styles so that the designer lists the styles?

At the moment, that info is hard coded into the product because there is no Javabean spec to define that type of info.

We are working on an XML-based extension API that will allow custom SWT component providers to supply this info. For example...

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<component xmlns="http://www.instantiations.com/D2/WBPComponent">
   <description>Instances of this class are selectable user interface objects that allow the user to enter
      and modify date or time values.</description>
   <!-- CREATION -->
   <creation>
      <source><![CDATA[new org.eclipse.swt.widgets.DateTime(%parent%, org.eclipse.swt.SWT.BORDER)]]></source>
   </creation>
   <!-- CONSTRUCTORS -->
   <constructors>
      <constructor>
         <parameter type="org.eclipse.swt.widgets.Composite" parent="true"/>
         <parameter type="int" defaultSource="org.eclipse.swt.SWT.NONE">
            <editor id="style">
               <parameter name="class">org.eclipse.swt.SWT</parameter>
               <parameter name="set">BORDER</parameter>
               <parameter name="select0">type DATE DATE TIME CALENDAR</parameter>
               <parameter name="select1">format MEDIUM MEDIUM SHORT LONG</parameter>
            </editor>
         </parameter>
      </constructor>
   </constructors>
   <!-- PROPERTIES -->
   <properties-advanced names="year month day hours minutes seconds"/>
   <!-- PARAMETERS -->
   <parameters>
      <parameter name="layout.has">false</parameter>
   </parameters>
</component>
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to SWT Designer

Who is online

Users browsing this forum: No registered users and 2 guests