Search in sources :

Example 16 with EJDevItemRendererDefinitionControl

use of org.entirej.framework.dev.renderer.definition.EJDevItemRendererDefinitionControl in project rap by entirej.

the class EJRWTRadioGroupItemRendererDefinition method getItemControl.

@Override
public EJDevItemRendererDefinitionControl getItemControl(EJDevScreenItemDisplayProperties itemDisplayProperties, Composite parent, FormToolkit toolkit) {
    String orientation = itemDisplayProperties.getBlockItemDisplayProperties().getItemRendererProperties().getStringProperty(ORIENTATION);
    boolean showBorder = itemDisplayProperties.getBlockItemDisplayProperties().getItemRendererProperties().getBooleanProperty(SHOW_BORDER, false);
    final List<Button> buttons = new ArrayList<Button>();
    group = new Composite(parent, SWT.SHADOW_NONE) {

        @Override
        public void addMouseListener(MouseListener listener) {
            super.addMouseListener(listener);
            for (Button button : buttons) {
                button.addMouseListener(listener);
            }
        }
    };
    Composite buttonParent = group;
    if (showBorder) {
        group.setLayout(new FillLayout());
        buttonParent = new Group(group, SWT.NONE);
        if (itemDisplayProperties.getLabel() != null) {
            ((Group) buttonParent).setText(itemDisplayProperties.getLabel());
        }
    }
    if (itemDisplayProperties.getHint() != null) {
        buttonParent.setToolTipText(itemDisplayProperties.getHint());
    }
    if (ORIENTATION_HORIZONTAL.equals(orientation)) {
        buttonParent.setLayout(new RowLayout(SWT.HORIZONTAL));
    } else {
        buttonParent.setLayout(new RowLayout(SWT.VERTICAL));
    }
    EJCoreFrameworkExtensionPropertyList radionButtons = itemDisplayProperties.getBlockItemDisplayProperties().getItemRendererProperties().getPropertyList(RADIO_BUTTONS);
    for (EJFrameworkExtensionPropertyListEntry entry : radionButtons.getAllListEntries()) {
        Button button = new Button(buttonParent, SWT.RADIO);
        button.setText(entry.getProperty(LABEL));
        buttons.add(button);
    }
    return new EJDevItemRendererDefinitionControl(itemDisplayProperties, group, false);
}
Also used : EJDevPropertyDefinitionGroup(org.entirej.framework.dev.properties.EJDevPropertyDefinitionGroup) Group(org.eclipse.swt.widgets.Group) EJPropertyDefinitionGroup(org.entirej.framework.core.properties.definitions.interfaces.EJPropertyDefinitionGroup) Composite(org.eclipse.swt.widgets.Composite) EJDevItemRendererDefinitionControl(org.entirej.framework.dev.renderer.definition.EJDevItemRendererDefinitionControl) ArrayList(java.util.ArrayList) FillLayout(org.eclipse.swt.layout.FillLayout) EJFrameworkExtensionPropertyListEntry(org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionPropertyListEntry) MouseListener(org.eclipse.swt.events.MouseListener) Button(org.eclipse.swt.widgets.Button) RowLayout(org.eclipse.swt.layout.RowLayout) EJCoreFrameworkExtensionPropertyList(org.entirej.framework.core.extensions.properties.EJCoreFrameworkExtensionPropertyList)

Example 17 with EJDevItemRendererDefinitionControl

use of org.entirej.framework.dev.renderer.definition.EJDevItemRendererDefinitionControl in project rap by entirej.

the class EJRWTCheckBoxRendererDefinition method getItemControl.

@Override
public EJDevItemRendererDefinitionControl getItemControl(EJDevScreenItemDisplayProperties itemDisplayProperties, Composite parent, FormToolkit toolkit) {
    String label = itemDisplayProperties.getLabel();
    Button cb = toolkit.createButton(parent, label, SWT.CHECK);
    final EJDevItemRendererDefinitionControl control = new EJDevItemRendererDefinitionControl(itemDisplayProperties, cb, false);
    cb.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            control.fireFocusGained();
        }
    });
    return control;
}
Also used : Button(org.eclipse.swt.widgets.Button) EJDevItemRendererDefinitionControl(org.entirej.framework.dev.renderer.definition.EJDevItemRendererDefinitionControl) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 18 with EJDevItemRendererDefinitionControl

use of org.entirej.framework.dev.renderer.definition.EJDevItemRendererDefinitionControl in project rap by entirej.

the class EJRWTStackedItemRendererDefinition method getItemControl.

@Override
public EJDevItemRendererDefinitionControl getItemControl(EJDevScreenItemDisplayProperties itemProperties, Composite parent, FormToolkit toolkit) {
    Text text = toolkit.createText(parent, "");
    text.setText("STACK-TEXT-MODE");
    text.setEditable(false);
    return new EJDevItemRendererDefinitionControl(itemProperties, text);
}
Also used : EJDevItemRendererDefinitionControl(org.entirej.framework.dev.renderer.definition.EJDevItemRendererDefinitionControl) Text(org.eclipse.swt.widgets.Text)

Example 19 with EJDevItemRendererDefinitionControl

use of org.entirej.framework.dev.renderer.definition.EJDevItemRendererDefinitionControl in project rap by entirej.

the class EJRWTTextItemRendererDefinition method getItemControl.

@Override
public EJDevItemRendererDefinitionControl getItemControl(EJDevScreenItemDisplayProperties itemProperties, Composite parent, FormToolkit toolkit) {
    Text text = toolkit.createText(parent, "");
    text.setEditable(false);
    return new EJDevItemRendererDefinitionControl(itemProperties, text);
}
Also used : EJDevItemRendererDefinitionControl(org.entirej.framework.dev.renderer.definition.EJDevItemRendererDefinitionControl) Text(org.eclipse.swt.widgets.Text)

Aggregations

EJDevItemRendererDefinitionControl (org.entirej.framework.dev.renderer.definition.EJDevItemRendererDefinitionControl)19 Composite (org.eclipse.swt.widgets.Composite)7 GridLayout (org.eclipse.swt.layout.GridLayout)6 Label (org.eclipse.swt.widgets.Label)5 Group (org.eclipse.swt.widgets.Group)4 Text (org.eclipse.swt.widgets.Text)4 GridData (org.eclipse.swt.layout.GridData)3 Button (org.eclipse.swt.widgets.Button)3 EJFrameworkExtensionProperties (org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties)3 EJDevBlockItemDisplayProperties (org.entirej.framework.dev.properties.interfaces.EJDevBlockItemDisplayProperties)3 EJDevScreenRendererDefinitionControl (org.entirej.framework.dev.renderer.definition.EJDevScreenRendererDefinitionControl)3 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)2 Section (org.eclipse.ui.forms.widgets.Section)2 EJPropertyDefinitionGroup (org.entirej.framework.core.properties.definitions.interfaces.EJPropertyDefinitionGroup)2 EJDevPropertyDefinitionGroup (org.entirej.framework.dev.properties.EJDevPropertyDefinitionGroup)2 EJDevItemGroupDisplayProperties (org.entirej.framework.dev.properties.interfaces.EJDevItemGroupDisplayProperties)2 EJDevScreenItemDisplayProperties (org.entirej.framework.dev.properties.interfaces.EJDevScreenItemDisplayProperties)2 ArrayList (java.util.ArrayList)1 MouseListener (org.eclipse.swt.events.MouseListener)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1