Search in sources :

Example 16 with ExpandItem

use of org.eclipse.swt.widgets.ExpandItem in project cubrid-manager by CUBRID.

the class DBSpaceLabelProvider method createServerStatusItem.

private void createServerStatusItem(ExpandBar bar, int index) {
    /* Server information */
    ExpandItem serverInfoItem = new ExpandItem(bar, SWT.NONE, index);
    serverInfoItem.setText(Messages.titleSystemInfo);
    Composite serverComposite = new Composite(bar, SWT.None);
    serverComposite.setLayout(new FillLayout());
    serverTableViewer = new TableViewer(serverComposite, SWT.BORDER | SWT.FULL_SELECTION);
    serverTableViewer.getTable().setHeaderVisible(true);
    serverTableViewer.getTable().setLinesVisible(true);
    serverTableViewer.setContentProvider(new TableContentProvider());
    serverTableViewer.setLabelProvider(new ServerStatusLabelProvider());
    TableColumn cpuTypeColumn = new TableColumn(serverTableViewer.getTable(), SWT.LEFT);
    cpuTypeColumn.setText(Messages.columnType);
    cpuTypeColumn.setToolTipText(Messages.columnType);
    cpuTypeColumn.setWidth(90);
    TableColumn memoryColumn = new TableColumn(serverTableViewer.getTable(), SWT.LEFT);
    memoryColumn.setText(Messages.columnMemmory);
    memoryColumn.setToolTipText(Messages.columnMemmory);
    memoryColumn.setWidth(120);
    TableColumn freespaceColumn = new TableColumn(serverTableViewer.getTable(), SWT.LEFT);
    freespaceColumn.setText(Messages.columnFreespace);
    freespaceColumn.setToolTipText(Messages.tipFreespace);
    freespaceColumn.setWidth(100);
    TableColumn cpuColumn = new TableColumn(serverTableViewer.getTable(), SWT.LEFT);
    cpuColumn.setText(Messages.columnCpu);
    cpuColumn.setToolTipText(Messages.columnCpu);
    cpuColumn.setWidth(80);
    TableColumn tpsColumn = new TableColumn(serverTableViewer.getTable(), SWT.LEFT);
    tpsColumn.setText(Messages.columnTps);
    tpsColumn.setToolTipText(Messages.tipTps);
    tpsColumn.setWidth(100);
    TableColumn qpsColumn = new TableColumn(serverTableViewer.getTable(), SWT.LEFT);
    qpsColumn.setText(Messages.columnQps);
    qpsColumn.setToolTipText(Messages.tipQps);
    qpsColumn.setWidth(100);
    serverInfoItem.setHeight(80);
    serverInfoItem.setExpanded(true);
    serverInfoItem.setControl(serverComposite);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ExpandItem(org.eclipse.swt.widgets.ExpandItem) TableContentProvider(com.cubrid.common.ui.spi.TableContentProvider) FillLayout(org.eclipse.swt.layout.FillLayout) TableViewer(org.eclipse.jface.viewers.TableViewer) TableColumn(org.eclipse.swt.widgets.TableColumn)

Example 17 with ExpandItem

use of org.eclipse.swt.widgets.ExpandItem in project tdi-studio-se by Talend.

the class MultiSchemasUI method init.

public void init() {
    uiParent.setLayout(new GridLayout());
    Composite composite = new Composite(uiParent, SWT.NONE);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setLayout(new FillLayout());
    ExpandBar bar = new ExpandBar(composite, SWT.V_SCROLL);
    final Composite fileGroup = new Composite(bar, SWT.NONE);
    createFileGroup(fileGroup);
    final ExpandItem settingItem = new ExpandItem(bar, SWT.NONE, 0);
    settingItem.setText(ExternalMultiSchemasUIProperties.SETTINGS_LABEL);
    settingItem.setHeight(fileGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
    settingItem.setControl(fileGroup);
    settingItem.setExpanded(true);
    allContentForm = new SashForm(bar, SWT.NONE);
    createViewers(allContentForm);
    final ExpandItem previewItem = new ExpandItem(bar, SWT.NONE, 1);
    previewItem.setText(ExternalMultiSchemasUIProperties.PREVIEW_LABEL);
    previewItem.setHeight(allContentForm.computeSize(SWT.DEFAULT, SWT.DEFAULT).y + 100);
    previewItem.setControl(allContentForm);
    previewItem.setExpanded(true);
    bar.addExpandListener(new ExpandListener() {

        public void itemExpanded(ExpandEvent e) {
            if (e.item != null && e.item instanceof ExpandItem) {
                if (((ExpandItem) e.item).getText().equals(ExternalMultiSchemasUIProperties.PREVIEW_LABEL)) {
                    if (settingItem.getExpanded()) {
                        previewItem.setHeight(allContentForm.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
                    } else {
                        previewItem.setHeight(allContentForm.computeSize(SWT.DEFAULT, SWT.DEFAULT).y + fileGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
                    }
                } else if (((ExpandItem) e.item).getText().equals(ExternalMultiSchemasUIProperties.SETTINGS_LABEL)) {
                    settingItem.setHeight(fileGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
                }
            }
        }

        public void itemCollapsed(ExpandEvent e) {
            if (e.item != null && e.item instanceof ExpandItem) {
                if (((ExpandItem) e.item).getText().equals(ExternalMultiSchemasUIProperties.PREVIEW_LABEL)) {
                // settingItem.setHeight(allContentForm.computeSize(SWT.DEFAULT, SWT.DEFAULT).y
                // + fileGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
                } else if (((ExpandItem) e.item).getText().equals(ExternalMultiSchemasUIProperties.SETTINGS_LABEL)) {
                    previewItem.setHeight(allContentForm.computeSize(SWT.DEFAULT, SWT.DEFAULT).y + fileGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
                }
            }
        }
    });
    initFieldValues();
    // listener
    addFieldListeners();
    addButtonListeners();
    addFieldsListenersGroupFileSettings();
    addFieldsListenersGroupsEscapeChar();
    // preview
    refreshPreview();
    checkDialog();
    // reload
    reloadSchemaDataFromNode();
}
Also used : SashForm(org.eclipse.swt.custom.SashForm) GridLayout(org.eclipse.swt.layout.GridLayout) ExpandBar(org.eclipse.swt.widgets.ExpandBar) Composite(org.eclipse.swt.widgets.Composite) CommandStackForComposite(org.talend.commons.ui.command.CommandStackForComposite) ExpandItem(org.eclipse.swt.widgets.ExpandItem) GridData(org.eclipse.swt.layout.GridData) ExpandEvent(org.eclipse.swt.events.ExpandEvent) FillLayout(org.eclipse.swt.layout.FillLayout) ExpandListener(org.eclipse.swt.events.ExpandListener)

Example 18 with ExpandItem

use of org.eclipse.swt.widgets.ExpandItem in project meclipse by flaper87.

the class CollectionEditor method createExpander.

public void createExpander(final ExpandBar bar, Map<String, Object> o, CollectionType collType) {
    // First item
    final Composite composite = new Composite(bar, SWT.FILL);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginLeft = layout.marginTop = layout.marginRight = layout.marginBottom = 10;
    composite.setLayout(layout);
    final ExpandItem expandItem = new ExpandItem(bar, SWT.NONE, 0);
    for (Object key : o.keySet()) {
        if (key == "_id" || key == "_ns")
            continue;
        Label keyLabel = new Label(composite, SWT.FILL);
        keyLabel.setText(key.toString());
        Label valueLabel = new Label(composite, SWT.WRAP);
        Object value = o.get(key);
        valueLabel.setText(String.valueOf(value));
    }
    Object value;
    switch(collType) {
        case SYSINDEX:
            value = o.get("ns").toString() + "." + o.get("name").toString();
            break;
        default:
            value = o.get("_id");
            break;
    }
    expandItem.setText(String.valueOf(value));
    expandItem.setControl(composite);
    expandItem.setHeight(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ExpandItem(org.eclipse.swt.widgets.ExpandItem) Label(org.eclipse.swt.widgets.Label) DBObject(com.mongodb.DBObject)

Aggregations

ExpandItem (org.eclipse.swt.widgets.ExpandItem)18 Composite (org.eclipse.swt.widgets.Composite)12 FillLayout (org.eclipse.swt.layout.FillLayout)10 TableViewer (org.eclipse.jface.viewers.TableViewer)7 TableContentProvider (com.cubrid.common.ui.spi.TableContentProvider)6 ExpandBar (org.eclipse.swt.widgets.ExpandBar)5 TableLabelProvider (com.cubrid.common.ui.spi.TableLabelProvider)4 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)4 Test (org.junit.Test)4 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 GridData (org.eclipse.swt.layout.GridData)3 Menu (org.eclipse.swt.widgets.Menu)3 MenuItem (org.eclipse.swt.widgets.MenuItem)3 TableColumn (org.eclipse.swt.widgets.TableColumn)3 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)2 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)2 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)2 MenuEvent (org.eclipse.swt.events.MenuEvent)2 MenuListener (org.eclipse.swt.events.MenuListener)2