Search in sources :

Example 21 with TableLayout

use of org.eclipse.jface.viewers.TableLayout in project translationstudio8 by heartsome.

the class WebSearchPreferencePage method createTableArea.

private Composite createTableArea(Composite parent) {
    Composite tableArea = new Composite(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout(1, false);
    gridLayout.marginWidth = 0;
    tableArea.setLayout(gridLayout);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    tableArea.setLayoutData(gridData);
    checkboxTableViewer = CheckboxTableViewer.newCheckList(tableArea, SWT.BORDER | SWT.FULL_SELECTION);
    table = checkboxTableViewer.getTable();
    table.setHeaderVisible(true);
    table.setLinesVisible(false);
    TableLayout tableLayout = new TableLayout();
    tableLayout.addColumnData(new ColumnPixelData(40));
    tableLayout.addColumnData(new ColumnWeightData(50, 50, true));
    tableLayout.addColumnData(new ColumnWeightData(70, 50, true));
    table.setLayout(tableLayout);
    GridData tableGridData = new GridData(GridData.FILL_BOTH);
    table.setLayoutData(tableGridData);
    WebSearchLableProvider webSearchLableProvider = new WebSearchLableProvider();
    webSearchLableProvider.createColumns(checkboxTableViewer);
    checkboxTableViewer.setContentProvider(new WebSearchContentProvider());
    checkboxTableViewer.setLabelProvider(webSearchLableProvider);
    checkboxTableViewer.setCheckStateProvider(new CheckProvider());
    checkboxTableViewer.addCheckStateListener(new CheckListener());
    // checkboxTableViewer.setCellEditors(new CellEditor[] { null, new TextCellEditor(table),
    // new TextCellEditor(table) });
    // checkboxTableViewer.setCellModifier(new NameModifier());
    checkboxTableViewer.setColumnProperties(new String[] { APP_PROP, NAME_PROP, URL_PROP });
    cache = WebSearchPreferencStore.getIns().getSearchConfig();
    checkboxTableViewer.setInput((Object) cache);
    return tableArea;
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) ColumnPixelData(org.eclipse.jface.viewers.ColumnPixelData) TableLayout(org.eclipse.jface.viewers.TableLayout)

Example 22 with TableLayout

use of org.eclipse.jface.viewers.TableLayout in project cubrid-manager by CUBRID.

the class InsertTableDataDialog method createAttrTable.

/**
	 * Create the table attribute table
	 */
private void createAttrTable() {
    attrTable = new Table(sashForm, SWT.BORDER | SWT.FULL_SELECTION);
    attrTable.setLayoutData(new GridData(GridData.FILL_BOTH));
    attrTable.setHeaderVisible(true);
    attrTable.setLinesVisible(true);
    TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(20, 120));
    layout.addColumnData(new ColumnWeightData(20, 120));
    layout.addColumnData(new ColumnWeightData(20, 120));
    layout.addColumnData(new ColumnWeightData(40, 160));
    attrTable.setLayout(layout);
    TableColumn[] tblColumns = new TableColumn[4];
    tblColumns[0] = new TableColumn(attrTable, SWT.NONE);
    tblColumns[0].setText(Messages.metaAttribute);
    tblColumns[1] = new TableColumn(attrTable, SWT.NONE);
    tblColumns[1].setText(Messages.metaDomain);
    tblColumns[2] = new TableColumn(attrTable, SWT.NONE);
    tblColumns[2].setText(Messages.metaConstaints);
    tblColumns[3] = new TableColumn(attrTable, SWT.NONE);
    tblColumns[3].setText(Messages.metaValue);
    TableItem item;
    for (int i = 0, n = schemaInfo.getAttributes().size(); i < n; i++) {
        DBAttribute da = (DBAttribute) schemaInfo.getAttributes().get(i);
        String type = DataType.getShownType(da.getType());
        if (type.toUpperCase(Locale.getDefault()).startsWith(DataType.DATATYPE_BLOB) || type.toUpperCase(Locale.getDefault()).startsWith(DataType.DATATYPE_CLOB)) {
            continue;
        }
        item = new TableItem(attrTable, SWT.NONE);
        item.setText(0, da.getName());
        item.setText(1, type);
        item.setText(2, getConstaintString(da));
    }
    packTable();
    tableEditor = new TableEditor(attrTable);
    tableEditor.horizontalAlignment = SWT.LEFT;
    tableEditor.grabHorizontal = true;
    attrTable.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            // Identify the selected row
            TableItem item = (TableItem) event.item;
            if (item == null) {
                return;
            }
            handleValue(item);
        }
    });
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) Table(org.eclipse.swt.widgets.Table) TableItem(org.eclipse.swt.widgets.TableItem) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TableColumn(org.eclipse.swt.widgets.TableColumn) TableEditor(org.eclipse.swt.custom.TableEditor) DBAttribute(com.cubrid.common.core.common.model.DBAttribute) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableLayout(org.eclipse.jface.viewers.TableLayout)

Example 23 with TableLayout

use of org.eclipse.jface.viewers.TableLayout in project cubrid-manager by CUBRID.

the class FavoriteQueryNavigatorView method createTableGroup.

private void createTableGroup(Composite composite) {
    final String[] columnNames = new String[] { "", com.cubrid.common.ui.query.Messages.msgBatchRunSqlFile, com.cubrid.common.ui.query.Messages.msgBatchRunMemo, com.cubrid.common.ui.query.Messages.msgBatchRunRegdate };
    tv = CommonUITool.createCommonTableViewer(composite, null, columnNames, CommonUITool.createGridData(GridData.FILL_BOTH, 3, 1, -1, 200));
    tv.setInput(FavoriteQueryPersistUtil.getInstance().getListData());
    {
        TableLayout tableLayout = new TableLayout();
        tableLayout.addColumnData(new ColumnPixelData(0));
        tableLayout.addColumnData(new ColumnPixelData(209));
        tableLayout.addColumnData(new ColumnPixelData(80));
        tableLayout.addColumnData(new ColumnPixelData(118));
        tv.getTable().setLayout(tableLayout);
    }
    editor = new TableEditor(tv.getTable());
    editor.horizontalAlignment = SWT.LEFT;
    editor.grabHorizontal = true;
    tv.getTable().addSelectionListener(new SelectionListener() {

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

        public void widgetDefaultSelected(SelectionEvent e) {
            updateButtonStatus();
        }
    });
    tv.getTable().addListener(SWT.MouseUp, new Listener() {

        public void handleEvent(Event event) {
            if (event.button != 1) {
                return;
            }
            updateButtonStatus();
            Point pt = new Point(event.x, event.y);
            int newIndex = tv.getTable().getSelectionIndex();
            if (tv.getTable().getItemCount() <= newIndex || newIndex < 0) {
                return;
            }
            final TableItem item = tv.getTable().getItem(newIndex);
            if (item == null) {
                return;
            }
            Rectangle rect = item.getBounds(2);
            if (rect.contains(pt)) {
                focusCell(item, newIndex, 2);
            }
        }
    });
    tv.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            ISelection selection = event.getSelection();
            openSelectedFile(selection);
        }
    });
    createContextMenu();
}
Also used : IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) TraverseListener(org.eclipse.swt.events.TraverseListener) MenuListener(org.eclipse.swt.events.MenuListener) SelectionListener(org.eclipse.swt.events.SelectionListener) Listener(org.eclipse.swt.widgets.Listener) TableItem(org.eclipse.swt.widgets.TableItem) ColumnPixelData(org.eclipse.jface.viewers.ColumnPixelData) Rectangle(org.eclipse.swt.graphics.Rectangle) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) Point(org.eclipse.swt.graphics.Point) TableEditor(org.eclipse.swt.custom.TableEditor) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ISelection(org.eclipse.jface.viewers.ISelection) MenuEvent(org.eclipse.swt.events.MenuEvent) TraverseEvent(org.eclipse.swt.events.TraverseEvent) Event(org.eclipse.swt.widgets.Event) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableLayout(org.eclipse.jface.viewers.TableLayout) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 24 with TableLayout

use of org.eclipse.jface.viewers.TableLayout in project cubrid-manager by CUBRID.

the class SqlmapNavigatorView method createParamView.

private void createParamView(Composite parent) {
    String[] columnNames = { Messages.lblSqlmapName, Messages.lblSqlmapValue, Messages.lblSqlmapType };
    Label lblCondTitle = new Label(parent, SWT.NONE);
    lblCondTitle.setText(Messages.lblSqlmapParameters);
    paramView = CommonUITool.createCommonTableViewer(parent, null, columnNames, CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, 120));
    paramView.setColumnProperties(columnNames);
    paramView.setContentProvider(new TableContentProvider());
    paramView.setLabelProvider(new TableLabelProvider());
    TableLayout tableLayout = new TableLayout();
    tableLayout.addColumnData(new ColumnPixelData(100));
    tableLayout.addColumnData(new ColumnPixelData(80));
    tableLayout.addColumnData(new ColumnPixelData(70));
    paramView.getTable().setLayout(tableLayout);
    paramView.addDoubleClickListener(new IDoubleClickListener() {

        @SuppressWarnings("unchecked")
        public void doubleClick(DoubleClickEvent event) {
            StructuredSelection sel = (StructuredSelection) event.getSelection();
            Map<String, String> data = (Map<String, String>) sel.getFirstElement();
            modifyParam(data);
        }
    });
    Menu menu = new Menu(paramView.getTable().getShell(), SWT.POP_UP);
    paramView.getTable().setMenu(menu);
    final MenuItem addMenuItem = new MenuItem(menu, SWT.PUSH);
    addMenuItem.setText(Messages.mnuSqlmapAdd);
    addMenuItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            addParameter();
        }
    });
    final MenuItem modifyMenuItem = new MenuItem(menu, SWT.PUSH);
    modifyMenuItem.setText(Messages.mnuSqlmapModify);
    modifyMenuItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            modifyParameterByCurrentSelected();
        }
    });
    final MenuItem delMenuItem = new MenuItem(menu, SWT.PUSH);
    delMenuItem.setText(Messages.mnuSqlmapRemove);
    delMenuItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (CommonUITool.openConfirmBox(Messages.msgSqlmapRemove)) {
                removeParameterByCurrentSelected();
            }
        }
    });
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) ColumnPixelData(org.eclipse.jface.viewers.ColumnPixelData) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) MenuItem(org.eclipse.swt.widgets.MenuItem) TableLabelProvider(com.cubrid.common.ui.spi.TableLabelProvider) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) TableContentProvider(com.cubrid.common.ui.spi.TableContentProvider) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Menu(org.eclipse.swt.widgets.Menu) TableLayout(org.eclipse.jface.viewers.TableLayout) Map(java.util.Map) HashMap(java.util.HashMap)

Example 25 with TableLayout

use of org.eclipse.jface.viewers.TableLayout in project cubrid-manager by CUBRID.

the class BrokerDashboardViewPart method makeActions.

/**
	 * This method is to create actions at tool bar
	 * 
	 */
private void makeActions() {
    Action columnAction = new Action() {

        public void run() {
            BrokerStatusSettingDlg settingDlg = new BrokerStatusSettingDlg(null);
            ServerInfo serverInfo = brokerNode.getParent().getServerInfo();
            settingDlg.setServerInfo(serverInfo);
            settingDlg.setAppendDiag(true);
            if (settingDlg.open() == Dialog.OK) {
                refreshLayout();
            }
        }

        /**
			 * refresh table layout
			 */
        private void refreshLayout() {
            //refresh basic info table
            TableLayout basicLayout = new TableLayout();
            brokerTablePart.setBasicLayout(basicLayout);
            basicTableViewer.getTable().setLayout(basicLayout);
            basicTableViewer.getTable().layout();
            //refresh apply server table
            TableLayout asLayout = new TableLayout();
            brokerTablePart.setAsLayout(asLayout);
            asTableViewer.getTable().setLayout(asLayout);
            asTableViewer.getTable().layout();
            //refresh job queue table
            TableLayout jqLayout = new TableLayout();
            brokerTablePart.setJqLayout(jqLayout);
            jqTableViewer.getTable().setLayout(jqLayout);
            jqTableViewer.getTable().layout();
        }
    };
    columnAction.setText(Messages.columnSettingTxt);
    columnAction.setImageDescriptor(CubridManagerUIPlugin.getImageDescriptor("icons/action/setting-small.png"));
    IActionBars bars = getViewSite().getActionBars();
    IToolBarManager manager = bars.getToolBarManager();
    manager.add(columnAction);
}
Also used : Action(org.eclipse.jface.action.Action) BrokerStatusSettingDlg(com.cubrid.cubridmanager.ui.broker.editor.internal.BrokerStatusSettingDlg) IToolBarManager(org.eclipse.jface.action.IToolBarManager) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) ApplyServerInfo(com.cubrid.cubridmanager.core.broker.model.ApplyServerInfo) TableLayout(org.eclipse.jface.viewers.TableLayout) IActionBars(org.eclipse.ui.IActionBars)

Aggregations

TableLayout (org.eclipse.jface.viewers.TableLayout)46 ColumnWeightData (org.eclipse.jface.viewers.ColumnWeightData)23 GridData (org.eclipse.swt.layout.GridData)23 TableColumn (org.eclipse.swt.widgets.TableColumn)20 Table (org.eclipse.swt.widgets.Table)18 TableViewer (org.eclipse.jface.viewers.TableViewer)16 Composite (org.eclipse.swt.widgets.Composite)16 GridLayout (org.eclipse.swt.layout.GridLayout)15 Label (org.eclipse.swt.widgets.Label)10 ColumnPixelData (org.eclipse.jface.viewers.ColumnPixelData)8 TableItem (org.eclipse.swt.widgets.TableItem)8 SelectionEvent (org.eclipse.swt.events.SelectionEvent)6 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)4 BrokerEnvStatusColumn (com.cubrid.cubridmanager.ui.broker.editor.internal.BrokerEnvStatusColumn)4 Point (org.eclipse.swt.graphics.Point)4 Event (org.eclipse.swt.widgets.Event)4 Listener (org.eclipse.swt.widgets.Listener)4 Menu (org.eclipse.swt.widgets.Menu)4 CommonUITool.trimPaintColor (com.cubrid.common.ui.spi.util.CommonUITool.trimPaintColor)3 ApplyServerInfo (com.cubrid.cubridmanager.core.broker.model.ApplyServerInfo)3