Search in sources :

Example 71 with CLabel

use of org.eclipse.swt.custom.CLabel in project tdi-studio-se by Talend.

the class BasicNotePropertyComposite method createControl.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.talend.designer.core.ui.editor.properties.notes.AbstractNotePropertyComposite#createControl(org.eclipse.swt
     * .widgets.Composite)
     */
@Override
public void createControl(Composite parent) {
    composite = getWidgetFactory().createFlatFormComposite(parent);
    if (composite.getLayout() instanceof FormLayout) {
        FormLayout formLayout = (FormLayout) composite.getLayout();
        formLayout.spacing = 0;
    }
    FormData data;
    //$NON-NLS-1$
    check = getWidgetFactory().createButton(composite, "", SWT.CHECK);
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
    check.setLayoutData(data);
    //$NON-NLS-1$
    CLabel labelLabel = getWidgetFactory().createCLabel(composite, Messages.getString("OpaqueNoteSection.Label"));
    data = new FormData();
    data.left = new FormAttachment(check);
    data.top = new FormAttachment(check, 0, SWT.TOP);
    labelLabel.setLayoutData(data);
    check.setSelection(note.isOpaque());
    check.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (check.getSelection() != (note.isOpaque())) {
                ChangeNoteOpacityCommand command = new ChangeNoteOpacityCommand(note, check.getSelection());
                getCommandStack().execute(command);
            }
        }
    });
    createFontsAndColorsGroups(composite);
    createAlignGroups(composite);
    createTextControl(composite);
    refresh();
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) CLabel(org.eclipse.swt.custom.CLabel) ChangeNoteOpacityCommand(org.talend.designer.core.ui.editor.cmd.ChangeNoteOpacityCommand) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 72 with CLabel

use of org.eclipse.swt.custom.CLabel in project tdi-studio-se by Talend.

the class OpaqueNotePropertySection method createControls.

@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
    super.createControls(parent, aTabbedPropertySheetPage);
    Composite composite = getWidgetFactory().createFlatFormComposite(parent);
    if (composite.getLayout() instanceof FormLayout) {
        FormLayout formLayout = (FormLayout) composite.getLayout();
        formLayout.spacing = 0;
    }
    FormData data;
    //$NON-NLS-1$
    check = getWidgetFactory().createButton(composite, "", SWT.CHECK);
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
    check.setLayoutData(data);
    //$NON-NLS-1$
    CLabel labelLabel = getWidgetFactory().createCLabel(composite, Messages.getString("OpaqueNoteSection.Label"));
    data = new FormData();
    data.left = new FormAttachment(check);
    data.top = new FormAttachment(check, 0, SWT.TOP);
    labelLabel.setLayoutData(data);
    check.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (check.getSelection() != (note.isOpaque())) {
                ChangeNoteOpacityCommand command = new ChangeNoteOpacityCommand(note, check.getSelection());
                getCommandStack().execute(command);
            }
        }
    });
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) CLabel(org.eclipse.swt.custom.CLabel) ChangeNoteOpacityCommand(org.talend.designer.core.ui.editor.cmd.ChangeNoteOpacityCommand) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 73 with CLabel

use of org.eclipse.swt.custom.CLabel in project tdi-studio-se by Talend.

the class TextNotePropertySection method createControls.

@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
    super.createControls(parent, aTabbedPropertySheetPage);
    Composite composite = getWidgetFactory().createFlatFormComposite(parent);
    FormData data;
    //$NON-NLS-1$
    text = getWidgetFactory().createText(composite, "", SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
    data = new FormData();
    data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
    // 5 lines
    data.height = 5 * text.getLineHeight();
    text.setLayoutData(data);
    //$NON-NLS-1$
    CLabel labelLabel = getWidgetFactory().createCLabel(composite, Messages.getString("TextNoteSection.Label"));
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(text, -ITabbedPropertyConstants.HSPACE);
    data.top = new FormAttachment(text, 0, SWT.TOP);
    labelLabel.setLayoutData(data);
    text.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(FocusEvent e) {
            if (!text.getText().equals(note.getText())) {
                ChangeNoteTextCommand command = new ChangeNoteTextCommand(note, text.getText());
                getCommandStack().execute(command);
            }
        }
    });
}
Also used : FormData(org.eclipse.swt.layout.FormData) CLabel(org.eclipse.swt.custom.CLabel) FocusAdapter(org.eclipse.swt.events.FocusAdapter) Composite(org.eclipse.swt.widgets.Composite) FocusEvent(org.eclipse.swt.events.FocusEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) ChangeNoteTextCommand(org.talend.designer.core.ui.editor.cmd.ChangeNoteTextCommand)

Example 74 with CLabel

use of org.eclipse.swt.custom.CLabel in project tesb-studio-se by Talend.

the class RouteResourceController method createControl.

@Override
public Control createControl(final Composite subComposite, final IElementParameter param, final int numInRow, final int nbInRow, final int top, final Control lastControl) {
    this.curParameter = param;
    this.paramFieldType = param.getFieldType();
    FormData data;
    final DecoratedField dField = new DecoratedField(subComposite, SWT.BORDER | SWT.READ_ONLY, new SelectAllTextControlCreator());
    if (param.isRequired()) {
        FieldDecoration decoration = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_REQUIRED);
        dField.addFieldDecoration(decoration, SWT.RIGHT | SWT.TOP, false);
    }
    Control cLayout = dField.getLayoutControl();
    labelText = (Text) dField.getControl();
    labelText.setData(PARAMETER_NAME, param.getName());
    cLayout.setBackground(subComposite.getBackground());
    labelText.setEditable(false);
    if (elem instanceof Node) {
        labelText.setToolTipText(VARIABLE_TOOLTIP + param.getVariableName());
    }
    addDragAndDropTarget(labelText);
    CLabel labelLabel = getWidgetFactory().createCLabel(subComposite, param.getDisplayName());
    data = new FormData();
    if (lastControl != null) {
        data.left = new FormAttachment(lastControl, 0);
    } else {
        data.left = new FormAttachment(((numInRow - 1) * MAX_PERCENT) / (nbInRow + 1), 0);
    }
    data.top = new FormAttachment(0, top);
    labelLabel.setLayoutData(data);
    if (numInRow != 1) {
        labelLabel.setAlignment(SWT.RIGHT);
    }
    data = new FormData();
    int currentLabelWidth = STANDARD_LABEL_WIDTH;
    GC gc = new GC(labelLabel);
    Point labelSize = gc.stringExtent(param.getDisplayName());
    gc.dispose();
    if ((labelSize.x + ITabbedPropertyConstants.HSPACE) > currentLabelWidth) {
        currentLabelWidth = labelSize.x + ITabbedPropertyConstants.HSPACE;
    }
    if (numInRow == 1) {
        if (lastControl != null) {
            data.left = new FormAttachment(lastControl, currentLabelWidth);
        } else {
            data.left = new FormAttachment(0, currentLabelWidth);
        }
    } else {
        data.left = new FormAttachment(labelLabel, 0, SWT.RIGHT);
    }
    data.right = new FormAttachment((numInRow * MAX_PERCENT) / (nbInRow + 1), 0);
    data.top = new FormAttachment(0, top);
    cLayout.setLayoutData(data);
    Button btn;
    Point btnSize;
    //$NON-NLS-1$
    btn = getWidgetFactory().createButton(subComposite, "", SWT.PUSH);
    btnSize = btn.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    btn.setImage(ImageProvider.getImage(CoreUIPlugin.getImageDescriptor(DOTS_BUTTON)));
    btn.addSelectionListener(listenerSelection);
    btn.setData(PARAMETER_NAME, param.getName());
    btn.setEnabled(!param.isReadOnly());
    data = new FormData();
    data.left = new FormAttachment(cLayout, 0);
    data.right = new FormAttachment(cLayout, STANDARD_BUTTON_WIDTH, SWT.RIGHT);
    data.top = new FormAttachment(0, top);
    data.height = STANDARD_HEIGHT - 2;
    btn.setLayoutData(data);
    hashCurControls.put(param.getName(), labelText);
    Point initialSize = dField.getLayoutControl().computeSize(SWT.DEFAULT, SWT.DEFAULT);
    Control lastControlUsed = btn;
    lastControlUsed = addVersionCombo(subComposite, param.getChildParameters().get(EParameterName.ROUTE_RESOURCE_TYPE_VERSION.getName()), lastControlUsed, numInRow + 1, nbInRow, top);
    dynamicProperty.setCurRowSize(Math.max(initialSize.y, btnSize.y) + ITabbedPropertyConstants.VSPACE);
    return btn;
}
Also used : FormData(org.eclipse.swt.layout.FormData) CLabel(org.eclipse.swt.custom.CLabel) SelectAllTextControlCreator(org.talend.designer.core.ui.editor.properties.controllers.creator.SelectAllTextControlCreator) Control(org.eclipse.swt.widgets.Control) FieldDecoration(org.eclipse.jface.fieldassist.FieldDecoration) Button(org.eclipse.swt.widgets.Button) Node(org.talend.designer.core.ui.editor.nodes.Node) DecoratedField(org.eclipse.jface.fieldassist.DecoratedField) Point(org.eclipse.swt.graphics.Point) GC(org.eclipse.swt.graphics.GC) FormAttachment(org.eclipse.swt.layout.FormAttachment) Point(org.eclipse.swt.graphics.Point)

Example 75 with CLabel

use of org.eclipse.swt.custom.CLabel in project tdi-studio-se by Talend.

the class PurposeStatusSection method createControls.

@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
    super.createControls(parent, aTabbedPropertySheetPage);
    Composite composite = getWidgetFactory().createFlatFormComposite(parent);
    FormData data;
    //$NON-NLS-1$
    purposeText = getWidgetFactory().createText(composite, "");
    data = new FormData();
    data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH);
    data.right = new FormAttachment(70, 0);
    data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
    purposeText.setLayoutData(data);
    addFocusListener(purposeText);
    //$NON-NLS-1$
    CLabel purposeLabel = getWidgetFactory().createCLabel(composite, Messages.getString("PurposeStatusSection.purposeLabel"));
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(purposeText, -ITabbedPropertyConstants.HSPACE);
    data.top = new FormAttachment(purposeText, 0, SWT.CENTER);
    purposeLabel.setLayoutData(data);
    //$NON-NLS-1$
    statusText = getWidgetFactory().createCCombo(composite, SWT.READ_ONLY | SWT.BORDER);
    data = new FormData();
    data.left = new FormAttachment(purposeText, STANDARD_LABEL_WIDTH);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
    statusText.setLayoutData(data);
    addFocusListener(statusText);
    // addComboFieldListeners(statusText, new ModifyListener() {
    // public void modifyText(ModifyEvent e) {
    // if (enableListener)
    // needSave = true;
    // }}, true);
    //$NON-NLS-1$
    CLabel statusLabel = getWidgetFactory().createCLabel(composite, Messages.getString("PurposeStatusSection.statusLabel"));
    data = new FormData();
    data.left = new FormAttachment(purposeText, ITabbedPropertyConstants.HSPACE * 3);
    data.right = new FormAttachment(statusText, -ITabbedPropertyConstants.HSPACE);
    data.top = new FormAttachment(statusText, 0, SWT.CENTER);
    statusLabel.setLayoutData(data);
    addFocusListenerToChildren(composite);
}
Also used : FormData(org.eclipse.swt.layout.FormData) CLabel(org.eclipse.swt.custom.CLabel) Composite(org.eclipse.swt.widgets.Composite) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Aggregations

CLabel (org.eclipse.swt.custom.CLabel)75 FormAttachment (org.eclipse.swt.layout.FormAttachment)56 FormData (org.eclipse.swt.layout.FormData)56 Point (org.eclipse.swt.graphics.Point)53 GC (org.eclipse.swt.graphics.GC)42 Node (org.talend.designer.core.ui.editor.nodes.Node)42 Control (org.eclipse.swt.widgets.Control)36 DecoratedField (org.eclipse.jface.fieldassist.DecoratedField)29 FieldDecoration (org.eclipse.jface.fieldassist.FieldDecoration)28 Button (org.eclipse.swt.widgets.Button)28 Composite (org.eclipse.swt.widgets.Composite)26 CCombo (org.eclipse.swt.custom.CCombo)15 INode (org.talend.core.model.process.INode)13 SelectAllTextControlCreator (org.talend.designer.core.ui.editor.properties.controllers.creator.SelectAllTextControlCreator)12 GridData (org.eclipse.swt.layout.GridData)11 SelectionEvent (org.eclipse.swt.events.SelectionEvent)10 GridLayout (org.eclipse.swt.layout.GridLayout)10 Text (org.eclipse.swt.widgets.Text)10 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)8 IElementParameter (org.talend.core.model.process.IElementParameter)6