Search in sources :

Example 16 with TableLayout

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

the class ChartCompositePart method createSeriesTable.

/**
	 * Create basic info table
	 *
	 * @param parent the parent composite
	 *
	 */
private void createSeriesTable(Composite parent) {
    final Composite comp = new Composite(parent, SWT.NONE);
    GridData gdBasic = new GridData(SWT.FILL, SWT.NONE, false, false);
    comp.setLayoutData(gdBasic);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = 0;
    layout.horizontalSpacing = 0;
    layout.marginLeft = 0;
    layout.marginRight = 0;
    layout.marginTop = 0;
    layout.marginBottom = 0;
    comp.setLayout(layout);
    final Label label = new Label(comp, SWT.CENTER);
    label.setText(Messages.tblSeriesTtl);
    seriesTableViewer = new TableViewer(comp, SWT.NO_SCROLL | SWT.BORDER);
    Table seriesTable = seriesTableViewer.getTable();
    seriesTable.setHeaderVisible(true);
    seriesTable.setLinesVisible(true);
    GridData tblSeries = new GridData(SWT.FILL, SWT.TOP, true, false);
    tblSeries.heightHint = CommonUITool.getHeightHintOfTable(seriesTable);
    seriesTable.setLayoutData(tblSeries);
    TableLayout seriesLayout = new TableLayout();
    setSeriesTableLayout(seriesLayout);
    seriesTable.setLayout(seriesLayout);
    TableColumn tblColumn = new TableColumn(seriesTable, SWT.CENTER);
    tblColumn.setText("");
    tblColumn.setResizable(false);
    for (Map.Entry<String, ShowSetting> entry : settingMap.entrySet()) {
        tblColumn = new TableColumn(seriesTable, SWT.CENTER);
        tblColumn.setText(entry.getKey());
        tblColumn.setToolTipText(entry.getKey());
        tblColumn.setResizable(false);
    }
    List<String[]> chartTblLst = new ArrayList<String[]>();
    String[] arrays = valueMap.values().toArray(new String[valueMap.size()]);
    String[] arrays2 = new String[arrays.length + 1];
    arrays2[0] = "";
    System.arraycopy(arrays, 0, arrays2, 1, arrays.length);
    chartTblLst.add(arrays2);
    ChartTableContentProvider chartTableContentProvider = new ChartTableContentProvider();
    seriesTableViewer.setContentProvider(chartTableContentProvider);
    seriesTableViewer.setLabelProvider(new ChartTableLabelProvider());
    seriesTableViewer.setInput(chartTblLst);
    int index = 0;
    for (Map.Entry<String, ShowSetting> entry : settingMap.entrySet()) {
        org.eclipse.swt.graphics.Color color = new org.eclipse.swt.graphics.Color(comp.getDisplay(), entry.getValue().getSeriesRgb());
        seriesTableViewer.getTable().getItem(0).setBackground(index + 1, color);
        index++;
    }
    seriesTable.addControlListener(new ControlAdapter() {

        public void controlResized(ControlEvent event) {
            updateTableLayout();
        }
    });
}
Also used : ControlAdapter(org.eclipse.swt.events.ControlAdapter) Label(org.eclipse.swt.widgets.Label) ArrayList(java.util.ArrayList) GridLayout(org.eclipse.swt.layout.GridLayout) TableLayout(org.eclipse.jface.viewers.TableLayout) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) ChartComposite(org.jfree.experimental.chart.swt.ChartComposite) Color(java.awt.Color) CommonUITool.trimPaintColor(com.cubrid.common.ui.spi.util.CommonUITool.trimPaintColor) TableColumn(org.eclipse.swt.widgets.TableColumn) GridData(org.eclipse.swt.layout.GridData) ControlEvent(org.eclipse.swt.events.ControlEvent) TableViewer(org.eclipse.jface.viewers.TableViewer) Map(java.util.Map) TreeMap(java.util.TreeMap)

Example 17 with TableLayout

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

the class ChartCompositePart method updateSettingSeries.

/**
	 * Update setting series
	 *
	 */
public void updateSettingSeries() {
    int index = 0;
    for (Map.Entry<String, ShowSetting> entry : settingMap.entrySet()) {
        String item = entry.getKey();
        ShowSetting showSetting = entry.getValue();
        boolean checked = showSetting.isChecked();
        RGB rgb = showSetting.getSeriesRgb();
        float width = showSetting.getWidth();
        org.eclipse.swt.graphics.Color color = new org.eclipse.swt.graphics.Color(composite.getDisplay(), rgb);
        seriesTableViewer.getTable().getItem(0).setBackground(index + 1, color);
        updateSettingChart(item, checked, rgb, width);
        index++;
    }
    TableLayout seriesLayout = new TableLayout();
    setSeriesTableLayout(seriesLayout);
    seriesTableViewer.getTable().setLayout(seriesLayout);
    seriesTableViewer.getTable().layout(true);
}
Also used : Color(java.awt.Color) CommonUITool.trimPaintColor(com.cubrid.common.ui.spi.util.CommonUITool.trimPaintColor) RGB(org.eclipse.swt.graphics.RGB) Map(java.util.Map) TreeMap(java.util.TreeMap) TableLayout(org.eclipse.jface.viewers.TableLayout)

Example 18 with TableLayout

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

the class ShardEnvStatusView method createTable.

/**
	 * This method initializes table
	 * 
	 */
private void createTable() {
    tableViewer = new TableViewer(composite, SWT.FULL_SELECTION);
    tableViewer.getTable().setHeaderVisible(true);
    tableViewer.getTable().setLinesVisible(true);
    // ShardStatusSettingHelp sssh = ShardStatusSettingHelp.getInstance();
    // Map<String, Boolean> data = sssh.loadSetting(ShardsStatus.class);
    TableLayout tlayout = new TableLayout();
    // }
    for (int i = 0; i < 7; i++) {
        tlayout.addColumnData(new ColumnWeightData(0, 0, true));
    }
    makeTableColumn();
    tableViewer.setContentProvider(new SimpleContentProvider<ShardsStatus>());
    ShardEnvStatusLabelProvider shardEnvStatusLabelProvider = new ShardEnvStatusLabelProvider();
    tableViewer.setLabelProvider(shardEnvStatusLabelProvider);
    tableViewer.getTable().setLayout(tlayout);
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) ShardsStatus(com.cubrid.cubridmanager.core.shard.model.ShardsStatus) TableViewer(org.eclipse.jface.viewers.TableViewer) TableLayout(org.eclipse.jface.viewers.TableLayout)

Example 19 with TableLayout

use of org.eclipse.jface.viewers.TableLayout in project linuxtools by eclipse.

the class AbstractSTTreeViewer method createColumns.

/**
 * Create the columns in the tree.
 */
@Override
protected void createColumns() {
    Tree tree = getViewer().getTree();
    TableLayout layout = new TableLayout();
    tree.setLayout(layout);
    tree.setHeaderVisible(true);
    tree.setLinesVisible(true);
    for (int i = 0; i < getAllFields().length; i++) {
        ISTDataViewersField field = getAllFields()[i];
        TreeColumn tc = new TreeColumn(tree, field.getAlignment(), i);
        tc.setText(field.getColumnHeaderText());
        tc.setToolTipText(field.getColumnHeaderTooltip());
        tc.setImage(field.getColumnHeaderImage());
        tc.setWidth(field.getPreferredWidth());
        tc.setResizable(true);
        tc.setMoveable(true);
        tc.addSelectionListener(createHeaderListener());
        tc.setData(field);
        // defining the column label provider.
        // this has to be done after setting the column's data.
        TreeViewerColumn viewerColumn = new TreeViewerColumn(getViewer(), tc);
        viewerColumn.setLabelProvider(createColumnLabelProvider(tc));
    }
    tree.addMouseMoveListener(e -> {
        Tree tree1 = (Tree) e.widget;
        TreeItem item = tree1.getItem(new Point(e.x, e.y));
        if (item == null) {
            return;
        }
        tree1.setCursor(e.display.getSystemCursor(SWT.CURSOR_ARROW));
    });
}
Also used : TreeItem(org.eclipse.swt.widgets.TreeItem) TreeColumn(org.eclipse.swt.widgets.TreeColumn) Tree(org.eclipse.swt.widgets.Tree) Point(org.eclipse.swt.graphics.Point) TableLayout(org.eclipse.jface.viewers.TableLayout) Point(org.eclipse.swt.graphics.Point) TreeViewerColumn(org.eclipse.jface.viewers.TreeViewerColumn)

Example 20 with TableLayout

use of org.eclipse.jface.viewers.TableLayout in project yamcs-studio by yamcs.

the class CommandHistoryView method createPartControl.

@Override
public void createPartControl(Composite parent) {
    resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent);
    greenBubble = resourceManager.createImage(RCPUtils.getImageDescriptor(CommandHistoryView.class, "icons/obj16/ok.png"));
    redBubble = resourceManager.createImage(RCPUtils.getImageDescriptor(CommandHistoryView.class, "icons/obj16/nok.png"));
    grayBubble = resourceManager.createImage(RCPUtils.getImageDescriptor(CommandHistoryView.class, "icons/obj16/undef.png"));
    waitingImage = resourceManager.createImage(RCPUtils.getImageDescriptor(CommandHistoryView.class, "icons/obj16/waiting.png"));
    headerCompleteImage = resourceManager.createImage(RCPUtils.getImageDescriptor(CommandHistoryView.class, "icons/obj16/header_complete.png"));
    checkmarkImage = resourceManager.createImage(RCPUtils.getImageDescriptor(CommandHistoryView.class, "icons/obj16/checkmark.gif"));
    errorImage = resourceManager.createImage(RCPUtils.getImageDescriptor(CommandHistoryView.class, "icons/obj16/error_tsk.png"));
    prevImage = resourceManager.createImage(RCPUtils.getImageDescriptor(CommandHistoryView.class, "icons/obj16/event_prev.png"));
    nextImage = resourceManager.createImage(RCPUtils.getImageDescriptor(CommandHistoryView.class, "icons/obj16/event_next.png"));
    createActions();
    tableLayout = new TableLayout();
    tableViewer = new TableViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
    tableViewer.getTable().setLayout(tableLayout);
    tableViewer.getTable().setHeaderVisible(true);
    tableViewer.getTable().setLinesVisible(true);
    addFixedColumns();
    tableContentProvider = new CommandHistoryRecordContentProvider(tableViewer);
    tableViewer.setContentProvider(tableContentProvider);
    // ! otherwise refresh() deletes everything...
    tableViewer.setInput(tableContentProvider);
    tableViewerComparator = new CommandHistoryViewerComparator();
    tableViewer.setComparator(tableViewerComparator);
    // Register context menu. Commands are added in plugin.xml
    MenuManager menuManager = new MenuManager();
    Menu menu = menuManager.createContextMenu(tableViewer.getTable());
    tableViewer.getTable().setMenu(menu);
    getSite().registerContextMenu(menuManager, tableViewer);
    // Default action is to open Command properties
    tableViewer.getTable().addListener(SWT.MouseDoubleClick, evt -> {
        RCPUtils.runCommand(CommandHistory.CMD_COMMAND_PROPERTIES);
    });
    updateSummaryLine();
    getViewSite().setSelectionProvider(tableViewer);
    CommandingCatalogue.getInstance().addCommandHistoryListener(cmdhistEntry -> {
        Display.getDefault().asyncExec(() -> processCommandHistoryEntry(cmdhistEntry));
    });
}
Also used : LocalResourceManager(org.eclipse.jface.resource.LocalResourceManager) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Menu(org.eclipse.swt.widgets.Menu) TableLayout(org.eclipse.jface.viewers.TableLayout) TableViewer(org.eclipse.jface.viewers.TableViewer)

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