Search in sources :

Example 41 with CLabel

use of org.eclipse.swt.custom.CLabel in project cubrid-manager by CUBRID.

the class CopyDatabaseDialog method createDiskDescLabel.

/**
	 * Create diskDesc label
	 * 
	 * @param composite the parent composite
	 */
private void createDiskDescLabel(Composite composite) {
    diskSpaceLabel = new CLabel(composite, SWT.NONE);
    diskSpaceLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
    diskSpaceLabel.setAlignment(SWT.LEFT);
    databaseSizeLabel = new CLabel(composite, SWT.NONE);
    final GridData gdDatabaseSizeLabel = new GridData(SWT.FILL, SWT.FILL, false, false);
    databaseSizeLabel.setLayoutData(gdDatabaseSizeLabel);
    databaseSizeLabel.setAlignment(SWT.LEFT);
}
Also used : CLabel(org.eclipse.swt.custom.CLabel) GridData(org.eclipse.swt.layout.GridData)

Example 42 with CLabel

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

the class JsonTableController method createControl.

@Override
public Control createControl(final Composite parentComposite, final IElementParameter param, final int numInRow, final int nbInRow, int top, final Control lastControl) {
    this.curParameter = param;
    this.paramFieldType = param.getFieldType();
    final Composite container = parentComposite;
    JsonTableView tableEditorView = generateTableEditorView(parentComposite, param);
    final Composite mainComposite = tableEditorView.getMainComposite();
    mainComposite.setData(PARAMETER_NAME, param.getName());
    String labelDisplayName = param.getDisplayName();
    CLabel label = getWidgetFactory().createCLabel(container, labelDisplayName);
    FormData formData = new FormData();
    if (lastControl != null) {
        formData.left = new FormAttachment(lastControl, 0);
    } else {
        formData.left = new FormAttachment((((numInRow - 1) * MAX_PERCENT) / nbInRow), 0);
    }
    formData.top = new FormAttachment(0, top);
    label.setLayoutData(formData);
    formData = new FormData();
    int currentLabelWidth = STANDARD_LABEL_WIDTH;
    GC gc = new GC(label);
    Point labelSize = gc.stringExtent(param.getDisplayName());
    gc.dispose();
    if ((labelSize.x + (ITabbedPropertyConstants.HSPACE * 2)) > currentLabelWidth) {
        currentLabelWidth = labelSize.x + (ITabbedPropertyConstants.HSPACE * 2);
    }
    if (numInRow == 1) {
        if (lastControl != null) {
            formData.left = new FormAttachment(lastControl, currentLabelWidth);
        } else {
            formData.left = new FormAttachment(0, currentLabelWidth);
        }
    } else {
        formData.left = new FormAttachment(label, 0, SWT.RIGHT);
    }
    formData.right = new FormAttachment((numInRow * MAX_PERCENT) / nbInRow, 0);
    formData.top = new FormAttachment(0, top);
    int height = adjustTableHeight(tableEditorView, param);
    formData.bottom = new FormAttachment(0, top + height);
    mainComposite.setLayoutData(formData);
    hashCurControls.put(param.getName(), tableEditorView.getExtendedTableViewer().getTableViewerCreator());
    this.dynamicProperty.setCurRowSize(height + ITabbedPropertyConstants.VSPACE);
    if (isInWizard()) {
        label.setAlignment(SWT.RIGHT);
        if (lastControl != null) {
            formData.right = new FormAttachment(lastControl, 0);
        } else {
            formData.right = new FormAttachment(100, -ITabbedPropertyConstants.HSPACE);
        }
        formData.left = new FormAttachment((((nbInRow - numInRow) * MAX_PERCENT) / nbInRow), currentLabelWidth + ITabbedPropertyConstants.HSPACE);
        formData = (FormData) label.getLayoutData();
        formData.right = new FormAttachment(mainComposite, 0);
        formData.left = new FormAttachment((((nbInRow - numInRow) * MAX_PERCENT) / nbInRow), 0);
        return label;
    }
    return mainComposite;
}
Also used : CLabel(org.eclipse.swt.custom.CLabel) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) JsonTableView(org.talend.designer.core.generic.ui.JsonTableView) 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 43 with CLabel

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

the class NameAndLabelsReferenceController 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;
    CLabel labelLabel = getWidgetFactory().createCLabel(subComposite, param.getDisplayName());
    FormData data = new FormData();
    if (lastControl != null) {
        data.left = new FormAttachment(lastControl, 0);
    } else {
        data.left = new FormAttachment((((numInRow - 1) * MAX_PERCENT) / nbInRow), 0);
    }
    data.top = new FormAttachment(0, top);
    labelLabel.setLayoutData(data);
    if (numInRow != 1) {
        labelLabel.setAlignment(SWT.RIGHT);
    }
    //$NON-NLS-1$
    Button btnEdit = getWidgetFactory().createButton(subComposite, "", SWT.PUSH);
    btnEdit.setImage(ImageProvider.getImage(CoreUIPlugin.getImageDescriptor(DOTS_BUTTON)));
    data = new FormData();
    data.left = new FormAttachment(((numInRow * MAX_PERCENT) / nbInRow), -STANDARD_BUTTON_WIDTH);
    data.right = new FormAttachment(((numInRow * MAX_PERCENT) / nbInRow), 0);
    data.top = new FormAttachment(labelLabel, 0, SWT.CENTER);
    data.height = STANDARD_HEIGHT - 2;
    btnEdit.setLayoutData(data);
    btnEdit.setData(NAME, MODULE);
    btnEdit.setData(PARAM_OBJ, param);
    btnEdit.setData(PARAMETER_NAME, param.getName());
    btnEdit.setEnabled(!param.isRepositoryValueUsed());
    // btnEdit.setEnabled(!param.isReadOnly());
    btnEdit.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Command cmd = createCommand((Button) e.getSource());
            executeCommand(cmd);
        }
    });
    DecoratedField dField = new DecoratedField(subComposite, SWT.BORDER, new SelectAllTextControlCreator());
    if (param.isRequired()) {
        FieldDecoration decoration = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_REQUIRED);
        dField.addFieldDecoration(decoration, SWT.RIGHT | SWT.TOP, false);
    }
    if (param.isRepositoryValueUsed()) {
        FieldDecoration decoration = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
        //$NON-NLS-1$
        decoration.setDescription(Messages.getString("FileController.decoration.description"));
        dField.addFieldDecoration(decoration, SWT.RIGHT | SWT.BOTTOM, false);
    }
    Control cLayout = dField.getLayoutControl();
    Text moduleText = (Text) dField.getControl();
    moduleText.setData(PARAMETER_NAME, param.getName());
    moduleText.setEditable(false);
    cLayout.setBackground(subComposite.getBackground());
    addDragAndDropTarget(moduleText);
    if (elem instanceof Node) {
        moduleText.setToolTipText(VARIABLE_TOOLTIP + param.getVariableName());
    }
    hashCurControls.put(param.getName(), moduleText);
    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(btnEdit, 0);
    data.top = new FormAttachment(labelLabel, 0, SWT.CENTER);
    cLayout.setLayoutData(data);
    Point initialSize = dField.getLayoutControl().computeSize(SWT.DEFAULT, SWT.DEFAULT);
    dynamicProperty.setCurRowSize(initialSize.y + ITabbedPropertyConstants.VSPACE);
    return btnEdit;
}
Also used : CLabel(org.eclipse.swt.custom.CLabel) FormData(org.eclipse.swt.layout.FormData) FieldDecoration(org.eclipse.jface.fieldassist.FieldDecoration) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Node(org.talend.designer.core.ui.editor.nodes.Node) Text(org.eclipse.swt.widgets.Text) DecoratedField(org.eclipse.jface.fieldassist.DecoratedField) Point(org.eclipse.swt.graphics.Point) Point(org.eclipse.swt.graphics.Point) SelectAllTextControlCreator(org.talend.designer.core.ui.editor.properties.controllers.creator.SelectAllTextControlCreator) Control(org.eclipse.swt.widgets.Control) Button(org.eclipse.swt.widgets.Button) Command(org.eclipse.gef.commands.Command) PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GC(org.eclipse.swt.graphics.GC) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 44 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 45 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)

Aggregations

CLabel (org.eclipse.swt.custom.CLabel)82 Point (org.eclipse.swt.graphics.Point)56 FormAttachment (org.eclipse.swt.layout.FormAttachment)56 FormData (org.eclipse.swt.layout.FormData)56 GC (org.eclipse.swt.graphics.GC)43 Node (org.talend.designer.core.ui.editor.nodes.Node)42 Control (org.eclipse.swt.widgets.Control)37 Button (org.eclipse.swt.widgets.Button)31 DecoratedField (org.eclipse.jface.fieldassist.DecoratedField)29 FieldDecoration (org.eclipse.jface.fieldassist.FieldDecoration)28 Composite (org.eclipse.swt.widgets.Composite)27 CCombo (org.eclipse.swt.custom.CCombo)17 GridData (org.eclipse.swt.layout.GridData)14 INode (org.talend.core.model.process.INode)13 GridLayout (org.eclipse.swt.layout.GridLayout)12 Text (org.eclipse.swt.widgets.Text)12 SelectAllTextControlCreator (org.talend.designer.core.ui.editor.properties.controllers.creator.SelectAllTextControlCreator)12 SelectionEvent (org.eclipse.swt.events.SelectionEvent)11 Label (org.eclipse.swt.widgets.Label)11 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)9