Search in sources :

Example 96 with FormAttachment

use of org.eclipse.swt.layout.FormAttachment in project cubrid-manager by CUBRID.

the class SelectColorCombo method formDataForDropDown.

/**
	 * Build the FormData object which is used on the colored label.
	 *
	 * @return
	 */
private FormData formDataForDropDown() {
    final FormData dropDownButtonData = new FormData();
    dropDownButtonData.top = new FormAttachment(0, 0);
    dropDownButtonData.bottom = new FormAttachment(100, 0);
    dropDownButtonData.left = new FormAttachment(80, 0);
    dropDownButtonData.right = new FormAttachment(100, 0);
    return dropDownButtonData;
}
Also used : FormData(org.eclipse.swt.layout.FormData) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 97 with FormAttachment

use of org.eclipse.swt.layout.FormAttachment in project cubrid-manager by CUBRID.

the class SettingHostPage method createControl.

/* (non-Javadoc)
	 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
	 */
public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(new FormLayout());
    setControl(container);
    setDescription(Messages.descSettingHostPage);
    setPageComplete(false);
    Composite leftComposite = new Composite(container, SWT.NONE);
    leftComposite.setLayout(new GridLayout(2, false));
    FormData leftData = new FormData();
    leftData.top = new FormAttachment(0, 5);
    leftData.bottom = new FormAttachment(100, 0);
    leftData.left = new FormAttachment(0, 5);
    leftData.right = new FormAttachment(50, -5);
    leftComposite.setLayoutData(leftData);
    Label separator = new Label(container, SWT.SEPARATOR);
    FormData separatorData = new FormData();
    separatorData.top = new FormAttachment(0, 5);
    separatorData.bottom = new FormAttachment(100, -5);
    separatorData.left = new FormAttachment(50, -5);
    separatorData.right = new FormAttachment(50, 5);
    separator.setLayoutData(separatorData);
    Composite rightComposite = new Composite(container, SWT.NONE);
    rightComposite.setLayout(new GridLayout(3, false));
    FormData rightData = new FormData();
    rightData.top = new FormAttachment(0, 5);
    rightData.bottom = new FormAttachment(100, 0);
    rightData.left = new FormAttachment(50, 5);
    rightData.right = new FormAttachment(100, -5);
    rightComposite.setLayoutData(rightData);
    /*Create left widget*/
    Label hostALabel = new Label(leftComposite, SWT.None);
    hostALabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    hostALabel.setText(Messages.lblMaster);
    masterHostText = new Text(leftComposite, SWT.BORDER);
    masterHostText.setEnabled(false);
    masterHostText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    Label masterNameLabel = new Label(leftComposite, SWT.None);
    masterNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    masterNameLabel.setText(Messages.lblMasterHost);
    masterHostName = new Text(leftComposite, SWT.BORDER);
    masterHostName.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    masterHostName.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            validate();
        }
    });
    masterDBList = new org.eclipse.swt.widgets.List(leftComposite, SWT.BORDER);
    masterDBList.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 2, 1, -1, -1));
    masterDBList.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            validate();
        }
    });
    /*Create right widget*/
    Label hostBLabel = new Label(rightComposite, SWT.None);
    hostBLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    hostBLabel.setText(Messages.lblSlave);
    slaveHostCombo = new Combo(rightComposite, SWT.READ_ONLY);
    slaveHostCombo.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 2, 1, -1, -1));
    slaveHostCombo.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            selectedSlaveServer = null;
            String serverName = slaveHostCombo.getText();
            List<CubridServer> serverList = CMHostNodePersistManager.getInstance().getAllServers();
            for (CubridServer server : serverList) {
                if (serverName.equals(server.getName())) {
                    selectedSlaveServer = server;
                    break;
                }
            }
            initSlaveDBList(selectedSlaveServer);
            validate();
        }
    });
    Label slaveNameLabel = new Label(rightComposite, SWT.None);
    slaveNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    slaveNameLabel.setText(Messages.lblSlaveHost);
    slaveHostName = new Text(rightComposite, SWT.BORDER);
    slaveHostName.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 2, 1, -1, -1));
    slaveHostName.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            validate();
        }
    });
    slaveDBList = new org.eclipse.swt.widgets.List(rightComposite, SWT.BORDER);
    slaveDBList.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 3, 1, -1, -1));
    slaveDBList.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            validate();
        }
    });
    init();
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) Combo(org.eclipse.swt.widgets.Combo) CubridServer(com.cubrid.common.ui.spi.model.CubridServer) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) List(java.util.List) FormAttachment(org.eclipse.swt.layout.FormAttachment) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 98 with FormAttachment

use of org.eclipse.swt.layout.FormAttachment in project MonjaDB by Kanatoko.

the class MConnectDialog method createDialogArea.

//--------------------------------------------------------------------------------
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    composite.setLayout(new FormLayout());
    Group connGroup = new Group(composite, SWT.SHADOW_ETCHED_OUT);
    connGroup.setText("Connection Type");
    FormData d7 = new FormData();
    d7.top = new FormAttachment(0, 10);
    d7.left = new FormAttachment(0, 10);
    d7.right = new FormAttachment(0, 285);
    d7.bottom = new FormAttachment(0, 100);
    connGroup.setLayoutData(d7);
    connGroup.setLayout(new FormLayout());
    connectionRadio1 = new Button(connGroup, SWT.RADIO);
    connectionRadio1.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
        }
    });
    FormData fd_connectionRadio1 = new FormData();
    fd_connectionRadio1.top = new FormAttachment(0, 8);
    fd_connectionRadio1.right = new FormAttachment(100, -59);
    fd_connectionRadio1.left = new FormAttachment(0, 12);
    connectionRadio1.setLayoutData(fd_connectionRadio1);
    connectionRadio1.setText("Normal");
    connectionRadio2 = new Button(connGroup, SWT.RADIO);
    FormData fd_connectionRadio2 = new FormData();
    fd_connectionRadio2.top = new FormAttachment(connectionRadio1, 5);
    fd_connectionRadio2.right = new FormAttachment(100, -59);
    fd_connectionRadio2.left = new FormAttachment(0, 12);
    connectionRadio2.setLayoutData(fd_connectionRadio2);
    connectionRadio2.setText("Via SSH");
    Group grpSshConfiguration = new Group(composite, SWT.NONE);
    grpSshConfiguration.setText("SSH Configuration");
    grpSshConfiguration.setLayout(new FormLayout());
    FormData fd_grpSshConfiguration = new FormData();
    fd_grpSshConfiguration.top = new FormAttachment(0, 10);
    fd_grpSshConfiguration.bottom = new FormAttachment(0, 250);
    fd_grpSshConfiguration.left = new FormAttachment(0, 300);
    fd_grpSshConfiguration.right = new FormAttachment(100, -10);
    grpSshConfiguration.setLayoutData(fd_grpSshConfiguration);
    Group mongoGroup = new Group(composite, SWT.NONE);
    mongoGroup.setText("MongoDB");
    mongoGroup.setLayout(new FormLayout());
    FormData fd_grpMongodb = new FormData();
    fd_grpMongodb.top = new FormAttachment(connGroup, 16);
    fd_grpMongodb.bottom = new FormAttachment(0, 250);
    fd_grpMongodb.right = new FormAttachment(grpSshConfiguration, -17);
    Label SSHLabel1 = new Label(grpSshConfiguration, SWT.NONE);
    FormData fd_SSHLabel1 = new FormData();
    fd_SSHLabel1.right = new FormAttachment(0, 236);
    fd_SSHLabel1.top = new FormAttachment(0, 10);
    fd_SSHLabel1.left = new FormAttachment(0, 18);
    SSHLabel1.setLayoutData(fd_SSHLabel1);
    SSHLabel1.setText("SSH \"user@host(:port)\"");
    sshText = new Text(grpSshConfiguration, SWT.BORDER);
    FormData fd_sshText = new FormData();
    fd_sshText.right = new FormAttachment(100, -20);
    fd_sshText.top = new FormAttachment(0, 30);
    fd_sshText.left = new FormAttachment(0, 18);
    sshText.setLayoutData(fd_sshText);
    Label lblNewLabel = new Label(grpSshConfiguration, SWT.NONE);
    FormData fd_lblNewLabel = new FormData();
    fd_lblNewLabel.right = new FormAttachment(0, 218);
    fd_lblNewLabel.top = new FormAttachment(0, 62);
    fd_lblNewLabel.left = new FormAttachment(0, 18);
    lblNewLabel.setLayoutData(fd_lblNewLabel);
    lblNewLabel.setText("SSH Private Key File");
    keyText = new Text(grpSshConfiguration, SWT.BORDER);
    FormData fd_keyText = new FormData();
    fd_keyText.right = new FormAttachment(sshText, -40, SWT.RIGHT);
    fd_keyText.top = new FormAttachment(lblNewLabel, 6);
    fd_keyText.left = new FormAttachment(SSHLabel1, 0, SWT.LEFT);
    keyText.setLayoutData(fd_keyText);
    Button btnBrowse = new Button(grpSshConfiguration, SWT.NONE);
    btnBrowse.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            String keyFileName = loadDialog.open();
            if (keyFileName != null) {
                keyText.setText(keyFileName);
            }
        }
    });
    btnBrowse.setToolTipText("Browse");
    FormData fd_btnBrowse = new FormData();
    fd_btnBrowse.left = new FormAttachment(keyText, 5);
    fd_btnBrowse.bottom = new FormAttachment(lblNewLabel, 30, SWT.BOTTOM);
    fd_btnBrowse.top = new FormAttachment(lblNewLabel, 3);
    fd_btnBrowse.right = new FormAttachment(100, -6);
    btnBrowse.setLayoutData(fd_btnBrowse);
    btnBrowse.setText("...");
    fd_grpMongodb.left = new FormAttachment(0, 10);
    mongoGroup.setLayoutData(fd_grpMongodb);
    FormData d2 = new FormData();
    d2.top = new FormAttachment(0, 15);
    d2.left = new FormAttachment(0, 8);
    Label hostLabel = new Label(mongoGroup, SWT.NONE);
    FormData fd_hostLabel = new FormData();
    fd_hostLabel.top = new FormAttachment(0, 15);
    fd_hostLabel.left = new FormAttachment(0, 10);
    hostLabel.setLayoutData(fd_hostLabel);
    hostLabel.setText("Host :");
    hostText = new Text(mongoGroup, SWT.BORDER);
    FormData fd_portText = new FormData();
    fd_portText.right = new FormAttachment(100, -20);
    fd_portText.left = new FormAttachment(hostLabel, 9);
    fd_portText.top = new FormAttachment(hostLabel, -2, SWT.TOP);
    hostText.setLayoutData(fd_portText);
    Label lblPort = new Label(mongoGroup, SWT.NONE);
    FormData fd_lblPort1 = new FormData();
    fd_lblPort1.top = new FormAttachment(hostLabel, 17);
    fd_lblPort1.left = new FormAttachment(0, 10);
    lblPort.setLayoutData(fd_lblPort1);
    lblPort.setText("Port :");
    portText = new Text(mongoGroup, SWT.BORDER);
    FormData fd_portText2 = new FormData();
    fd_portText2.top = new FormAttachment(0, 44);
    fd_portText2.right = new FormAttachment(100, -82);
    fd_portText2.left = new FormAttachment(lblPort, 12);
    portText.setLayoutData(fd_portText2);
    Label lblDatabase = new Label(mongoGroup, SWT.NONE);
    FormData fd_lblDatabase = new FormData();
    fd_lblDatabase.top = new FormAttachment(portText, 12);
    fd_lblDatabase.left = new FormAttachment(hostLabel, 0, SWT.LEFT);
    lblDatabase.setLayoutData(fd_lblDatabase);
    lblDatabase.setText("Database :");
    dbText = new Text(mongoGroup, SWT.BORDER);
    FormData fd_databaseText = new FormData();
    fd_databaseText.right = new FormAttachment(100, -50);
    fd_databaseText.top = new FormAttachment(portText, 9);
    fd_databaseText.left = new FormAttachment(lblDatabase, 13);
    dbText.setLayoutData(fd_databaseText);
    hostText.setText(prop.getProperty(CONNECT_DIALOG_HOST, "127.0.0.1"));
    dbText.setText(prop.getProperty(CONNECT_DIALOG_DB, "test"));
    portText.setText(prop.getProperty(CONNECT_DIALOG_PORT, "27017"));
    sshText.setText(prop.getProperty(CONNECT_DIALOG_SSH, ""));
    keyText.setText(prop.getProperty(CONNECT_DIALOG_SSH_KEY, getDefaultKeyLocation()));
    if (prop.getBooleanProperty(CONNECT_DIALOG_NORMAL_CONNECTION, true)) {
        connectionRadio1.setSelection(true);
    } else {
        connectionRadio2.setSelection(true);
    }
    loadDialog = new FileDialog(parent.getShell(), SWT.OPEN);
    loadDialog.setFilterPath(prop.getProperty("loadDialogPath"));
    return composite;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FileDialog(org.eclipse.swt.widgets.FileDialog) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 99 with FormAttachment

use of org.eclipse.swt.layout.FormAttachment in project MonjaDB by Kanatoko.

the class MPasswordDialog method createDialogArea.

//--------------------------------------------------------------------------------
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    composite.setLayout(new FormLayout());
    Group group1 = new Group(composite, SWT.SHADOW_ETCHED_OUT);
    FormData d7 = new FormData();
    d7.top = new FormAttachment(0, 6);
    d7.left = new FormAttachment(0, 3);
    d7.right = new FormAttachment(100, -3);
    d7.bottom = new FormAttachment(100, -3);
    group1.setLayoutData(d7);
    group1.setLayout(new FormLayout());
    Label passwdLabel = new Label(group1, SWT.NONE);
    passwdLabel.setText("Password :");
    FormData fd_passwdLabel = new FormData();
    fd_passwdLabel.top = new FormAttachment(0, 15);
    fd_passwdLabel.left = new FormAttachment(0, 8);
    passwdLabel.setLayoutData(fd_passwdLabel);
    passwordTExt = new Text(group1, SWT.BORDER | SWT.PASSWORD);
    FormData d1 = new FormData();
    d1.top = new FormAttachment(passwdLabel, -2, SWT.TOP);
    d1.left = new FormAttachment(passwdLabel, 10, SWT.RIGHT);
    d1.right = new FormAttachment(passwdLabel, 200, SWT.RIGHT);
    //d1.bottom = new FormAttachment( 100, -5 );
    passwordTExt.setLayoutData(d1);
    Composite composite_1 = new Composite(group1, SWT.NONE);
    composite_1.setLayout(new FormLayout());
    FormData fd_composite_1 = new FormData();
    fd_composite_1.right = new FormAttachment(passwordTExt, 20, SWT.RIGHT);
    fd_composite_1.bottom = new FormAttachment(0, 50);
    fd_composite_1.top = new FormAttachment(0, 3);
    fd_composite_1.left = new FormAttachment(passwordTExt, 14);
    composite_1.setLayoutData(fd_composite_1);
    return composite;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 100 with FormAttachment

use of org.eclipse.swt.layout.FormAttachment in project MonjaDB by Kanatoko.

the class MPromptDialog method createDialogArea.

//--------------------------------------------------------------------------------
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    composite.setLayout(new FormLayout());
    Group group1 = new Group(composite, SWT.SHADOW_ETCHED_OUT);
    FormData d7 = new FormData();
    d7.top = new FormAttachment(0, 6);
    d7.left = new FormAttachment(0, 3);
    d7.right = new FormAttachment(100, -3);
    d7.bottom = new FormAttachment(100, -3);
    group1.setLayoutData(d7);
    group1.setLayout(new FormLayout());
    Label passwdLabel = new Label(group1, SWT.NONE);
    passwdLabel.setText(labelText);
    FormData fd_passwdLabel = new FormData();
    fd_passwdLabel.top = new FormAttachment(0, 15);
    fd_passwdLabel.left = new FormAttachment(0, 8);
    passwdLabel.setLayoutData(fd_passwdLabel);
    text = new Text(group1, SWT.BORDER);
    FormData d1 = new FormData();
    d1.top = new FormAttachment(passwdLabel, -2, SWT.TOP);
    d1.left = new FormAttachment(passwdLabel, 10, SWT.RIGHT);
    d1.right = new FormAttachment(passwdLabel, 200, SWT.RIGHT);
    //d1.bottom = new FormAttachment( 100, -5 );
    text.setLayoutData(d1);
    text.setText(defaultValue);
    Composite composite_1 = new Composite(group1, SWT.NONE);
    composite_1.setLayout(new FormLayout());
    FormData fd_composite_1 = new FormData();
    fd_composite_1.right = new FormAttachment(text, 20, SWT.RIGHT);
    fd_composite_1.bottom = new FormAttachment(0, 50);
    fd_composite_1.top = new FormAttachment(0, 3);
    fd_composite_1.left = new FormAttachment(text, 14);
    composite_1.setLayoutData(fd_composite_1);
    return composite;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Aggregations

FormAttachment (org.eclipse.swt.layout.FormAttachment)253 FormData (org.eclipse.swt.layout.FormData)245 Composite (org.eclipse.swt.widgets.Composite)97 Point (org.eclipse.swt.graphics.Point)96 Button (org.eclipse.swt.widgets.Button)95 FormLayout (org.eclipse.swt.layout.FormLayout)93 Control (org.eclipse.swt.widgets.Control)64 Label (org.eclipse.swt.widgets.Label)59 CLabel (org.eclipse.swt.custom.CLabel)56 SelectionEvent (org.eclipse.swt.events.SelectionEvent)55 Node (org.talend.designer.core.ui.editor.nodes.Node)49 Text (org.eclipse.swt.widgets.Text)48 GC (org.eclipse.swt.graphics.GC)46 SelectionListener (org.eclipse.swt.events.SelectionListener)37 DecoratedField (org.eclipse.jface.fieldassist.DecoratedField)36 GridData (org.eclipse.swt.layout.GridData)36 FieldDecoration (org.eclipse.jface.fieldassist.FieldDecoration)34 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)32 GridLayout (org.eclipse.swt.layout.GridLayout)32 Group (org.eclipse.swt.widgets.Group)29