Search in sources :

Example 36 with TableLayout

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

the class ChartCompositePart method updateTableLayout.

/**
	 * Update table layout
	 */
private void updateTableLayout() {
    TableLayout seriesLayout = new TableLayout();
    setSeriesTableLayout(seriesLayout);
    seriesTableViewer.getTable().setLayout(seriesLayout);
    seriesTableViewer.getTable().layout(true);
}
Also used : TableLayout(org.eclipse.jface.viewers.TableLayout)

Example 37 with TableLayout

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

the class SchemaInfoEditorPart method createGeneralInfoTable.

/**
	 * Create the general information table
	 * 
	 */
private void createGeneralInfoTable() {
    Label colslabel = new Label(topComposite, SWT.LEFT | SWT.WRAP);
    colslabel.setText(Messages.lblGeneral);
    colslabel.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
    generalInfoTable = new Table(topComposite, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.NO_SCROLL);
    {
        GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
        generalInfoTable.setLayoutData(gridData);
        new TableColumn(generalInfoTable, SWT.LEFT);
        new TableColumn(generalInfoTable, SWT.LEFT);
        TableLayout tlayout = new TableLayout();
        tlayout.addColumnData(new ColumnWeightData(20, true));
        tlayout.addColumnData(new ColumnWeightData(100, true));
        generalInfoTable.setLayout(tlayout);
        generalInfoTable.setLinesVisible(true);
        generalInfoTable.setHeaderVisible(false);
        setTableEditor(generalInfoTable, 1);
        createContextMenu(generalInfoTable);
    }
    fillGeneralTableInfo();
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) Table(org.eclipse.swt.widgets.Table) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) TableColumn(org.eclipse.swt.widgets.TableColumn) TableLayout(org.eclipse.jface.viewers.TableLayout)

Example 38 with TableLayout

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

the class JdbcOptionComposite method createJdbcTableGroup.

/**
	 *
	 * Create JDBC table group
	 *
	 * @param composite the composite
	 */
private void createJdbcTableGroup(Composite composite) {
    final String[] columnNameArr = new String[] { Messages.tblColJdbcAttrName, Messages.tblColJdbcAttrValue };
    jdbcInfoTv = CommonUITool.createCommonTableViewer(composite, null, columnNameArr, CommonUITool.createGridData(GridData.FILL_BOTH, 3, 1, -1, 150));
    jdbcInfoTv.setInput(jdbcListData);
    TableLayout tableLayout = new TableLayout();
    jdbcInfoTv.getTable().setLayout(tableLayout);
    tableLayout.addColumnData(new ColumnWeightData(35, true));
    tableLayout.addColumnData(new ColumnWeightData(65, true));
    editor = new TableEditor(jdbcInfoTv.getTable());
    editor.horizontalAlignment = SWT.LEFT;
    editor.grabHorizontal = true;
    jdbcInfoTv.getTable().addListener(SWT.MouseUp, new Listener() {

        public void handleEvent(Event event) {
            if (event.button != 1) {
                return;
            }
            Point pt = new Point(event.x, event.y);
            int newIndex = jdbcInfoTv.getTable().getSelectionIndex();
            if (jdbcInfoTv.getTable().getItemCount() <= newIndex || newIndex < 0) {
                return;
            }
            final TableItem item = jdbcInfoTv.getTable().getItem(newIndex);
            if (item == null) {
                return;
            }
            for (int i = 0; i < 2; i++) {
                Rectangle rect = item.getBounds(i);
                if (rect.contains(pt)) {
                    focusCell(item, newIndex, i);
                    break;
                }
            }
        }
    });
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) Listener(org.eclipse.swt.widgets.Listener) TraverseListener(org.eclipse.swt.events.TraverseListener) MouseListener(org.eclipse.swt.events.MouseListener) TableItem(org.eclipse.swt.widgets.TableItem) Rectangle(org.eclipse.swt.graphics.Rectangle) Event(org.eclipse.swt.widgets.Event) TraverseEvent(org.eclipse.swt.events.TraverseEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Point(org.eclipse.swt.graphics.Point) TableLayout(org.eclipse.jface.viewers.TableLayout) TableEditor(org.eclipse.swt.custom.TableEditor)

Example 39 with TableLayout

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

the class JdbcManageComposite method createJdbcTableGroup.

/**
	 * 
	 * Create JDBC table group
	 * 
	 * @param composite the composite
	 */
private void createJdbcTableGroup(Composite composite) {
    final String[] columnNameArr = new String[] { Messages.tblColDriverVersion, Messages.tblColJarPath };
    TableViewerSorter sorter = new TableViewerSorter();
    sorter.setColumnComparator(0, new Comparator<Object>() {

        public int compare(Object o1, Object o2) {
            if (o1 instanceof String && o2 instanceof String) {
                String s1 = (String) o1;
                String s2 = (String) o2;
                String[] version1Tokens = s1.substring(s1.lastIndexOf('-') + 1).split("\\.");
                String[] version2Tokens = s2.substring(s2.lastIndexOf('-') + 1).split("\\.");
                int size = Math.min(version1Tokens.length, version2Tokens.length);
                for (int i = 0; i < size; i++) {
                    Integer first = Integer.parseInt(version1Tokens[i]);
                    Integer second = Integer.parseInt(version2Tokens[i]);
                    if (first != second) {
                        return first - second;
                    }
                }
                return version1Tokens.length - version2Tokens.length;
            } else {
                return 0;
            }
        }
    });
    sorter.setAsc(false);
    jdbcInfoTv = CommonUITool.createCommonTableViewer(composite, sorter, columnNameArr, CommonUITool.createGridData(GridData.FILL_BOTH, 3, 1, -1, 200));
    jdbcInfoTv.setInput(jdbcListData);
    jdbcInfoTv.getTable().setSortColumn(jdbcInfoTv.getTable().getColumn(0));
    jdbcInfoTv.getTable().setSortDirection(sorter.isAsc() ? SWT.UP : SWT.DOWN);
    TableLayout tableLayout = new TableLayout();
    jdbcInfoTv.getTable().setLayout(tableLayout);
    tableLayout.addColumnData(new ColumnWeightData(35, true));
    tableLayout.addColumnData(new ColumnWeightData(65, true));
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) TableViewerSorter(com.cubrid.common.ui.spi.TableViewerSorter) TableLayout(org.eclipse.jface.viewers.TableLayout)

Example 40 with TableLayout

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

the class SetReplicationParamComp method createReplicationParamComp.

/**
	 * 
	 * Create replication parameter editor composite
	 * 
	 * @param parent Composite
	 * @return replParaGroup
	 */
public Control createReplicationParamComp(Composite parent) {
    Group replParaGroup = new Group(parent, SWT.NONE);
    replParaGroup.setText(Messages.grpReplParaSetting);
    replParaGroup.setLayout(new GridLayout());
    replParaGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
    columnNameArrs = new String[] { Messages.repparm0tblColumnParameterName, Messages.repparm0tblColumnValueType, Messages.repparm0tblColumnParameterValue };
    replicationParamTableViewer = CommonUITool.createCommonTableViewer(replParaGroup, null, columnNameArrs, CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, 200));
    replicationParamTable = replicationParamTableViewer.getTable();
    TableLayout tlayout = new TableLayout();
    tlayout.addColumnData(new ColumnWeightData(50, 50, true));
    tlayout.addColumnData(new ColumnWeightData(50, 50, true));
    tlayout.addColumnData(new ColumnWeightData(50, 50, true));
    replicationParamTable.setLayout(tlayout);
    linkEditorForTable();
    replicationParamTableViewer.setInput(replicationParamList);
    for (int i = 0; i < replicationParamTable.getColumnCount(); i++) {
        replicationParamTable.getColumn(i).pack();
    }
    return replParaGroup;
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) TableLayout(org.eclipse.jface.viewers.TableLayout)

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