Search in sources :

Example 16 with GridData

use of org.eclipse.draw2d.GridData in project netxms by netxms.

the class ObjectTooltip method addStatusChart.

/**
 * Status chart
 */
private void addStatusChart(AbstractObject object, MapLabelProvider labelProvider) {
    BirtChartFigure chart = new BirtChartFigure(BirtChartFigure.BAR_CHART, labelProvider.getColors());
    add(chart);
    GridData gd = new GridData();
    gd.horizontalSpan = 2;
    gd.horizontalAlignment = SWT.FILL;
    gd.heightHint = 180;
    gd.widthHint = 320;
    setConstraint(chart, gd);
    int[] objectCount = new int[6];
    collectData(objectCount, object);
    chart.setTitleVisible(true);
    chart.setChartTitle(Messages.get().ObjectTooltip_ChartTitle);
    chart.setLegendPosition(GraphSettings.POSITION_RIGHT);
    chart.setLegendVisible(true);
    chart.set3DModeEnabled(true);
    chart.setTransposed(false);
    chart.setTranslucent(false);
    chart.setBorder(new LineBorder());
    for (int i = 0; i <= ObjectStatus.UNKNOWN.getValue(); i++) {
        // $NON-NLS-1$
        chart.addParameter(// $NON-NLS-1$
        new GraphItem(0, 0, 0, DataType.INT32, StatusDisplayInfo.getStatusText(i), StatusDisplayInfo.getStatusText(i), "%s"), objectCount[i]);
        chart.setPaletteEntry(i, new ChartColor(StatusDisplayInfo.getStatusColor(i).getRGB()));
    }
    chart.initializationComplete();
}
Also used : ChartColor(org.netxms.ui.eclipse.charts.api.ChartColor) LineBorder(org.eclipse.draw2d.LineBorder) GridData(org.eclipse.draw2d.GridData) GraphItem(org.netxms.client.datacollection.GraphItem) BirtChartFigure(org.netxms.ui.eclipse.charts.figures.BirtChartFigure) AccessPoint(org.netxms.client.objects.AccessPoint)

Example 17 with GridData

use of org.eclipse.draw2d.GridData in project hale by halestudio.

the class CellFigure method addLabels.

private void addLabels(Cell cell, boolean isCompatible, String lastCompatibilityMode, boolean isInherited) {
    if (!isCompatible) {
        Label compatibilityLabel = new Label();
        Image compatibilityImage = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK);
        GridData compLabelGD = new GridData(GridData.BEGINNING, GridData.FILL, false, true);
        compatibilityLabel.setIcon(compatibilityImage);
        Label toolTipLabel = new Label();
        toolTipLabel.setText("Not compatible with " + lastCompatibilityMode + " transformation");
        compatibilityLabel.setToolTip(toolTipLabel);
        add(compatibilityLabel, compLabelGD);
    }
    if (AlignmentUtil.isTypeCell(cell)) {
        // label for displaying the transformation mode
        Image modeImage;
        switch(cell.getTransformationMode()) {
            case active:
                modeImage = CommonSharedImages.getImageRegistry().get(CommonSharedImages.IMG_MARKER_GREEN);
                break;
            case passive:
                modeImage = CommonSharedImages.getImageRegistry().get(CommonSharedImages.IMG_MARKER_YELLOW);
                break;
            case disabled:
            default:
                modeImage = CommonSharedImages.getImageRegistry().get(CommonSharedImages.IMG_MARKER_RED);
        }
        Label modeLabel = new Label(modeImage);
        Label modeToolTip = new Label(cell.getTransformationMode().displayName());
        modeLabel.setToolTip(modeToolTip);
        GridData modeGD = new GridData(GridData.CENTER, GridData.CENTER, false, false);
        add(modeLabel, modeGD);
    }
    Label mainLabel = new Label();
    GridData mainLabelGD = new GridData(GridData.FILL, GridData.FILL, true, true);
    add(mainLabel, mainLabelGD);
    setTextLabel(mainLabel);
    setIconLabel(mainLabel);
    if (isInherited) {
        Label inheritedLabel = new Label(CommonSharedImages.getImageRegistry().get(CommonSharedImages.IMG_INHERITED_ARROW_SMALL));
        Label ineritedToolTip = new Label("Relation by inheritance");
        inheritedLabel.setToolTip(ineritedToolTip);
        GridData inheritedGD = new GridData(GridData.CENTER, GridData.CENTER, false, false);
        add(inheritedLabel, inheritedGD);
    }
    Label priorityLabel = new Label();
    Image priorityImage = null;
    switch(cell.getPriority()) {
        case HIGHEST:
            priorityImage = CommonSharedImages.getImageRegistry().get(CommonSharedImages.IMG_PRIORITY_HIGHEST);
            break;
        case HIGHER:
            priorityImage = CommonSharedImages.getImageRegistry().get(CommonSharedImages.IMG_PRIORITY_HIGHER);
            break;
        case HIGH:
            priorityImage = CommonSharedImages.getImageRegistry().get(CommonSharedImages.IMG_PRIORITY_HIGH);
            break;
        case LOW:
            priorityImage = CommonSharedImages.getImageRegistry().get(CommonSharedImages.IMG_PRIORITY_LOW);
            break;
        case LOWER:
            priorityImage = CommonSharedImages.getImageRegistry().get(CommonSharedImages.IMG_PRIORITY_LOWER);
            break;
        case LOWEST:
            priorityImage = CommonSharedImages.getImageRegistry().get(CommonSharedImages.IMG_PRIORITY_LOWEST);
            break;
        case NORMAL:
        default:
            return;
    }
    priorityLabel.setIcon(priorityImage);
    if (priorityImage != null) {
        Label priorityTip = new Label("Priority: " + cell.getPriority().value());
        priorityLabel.setToolTip(priorityTip);
    }
    GridData priorityLabelGD = new GridData(GridData.CENTER, GridData.FILL, false, true);
    add(priorityLabel, priorityLabelGD);
}
Also used : Label(org.eclipse.draw2d.Label) GridData(org.eclipse.draw2d.GridData) Image(org.eclipse.swt.graphics.Image)

Example 18 with GridData

use of org.eclipse.draw2d.GridData in project archi by archimatetool.

the class CanvasStickyFigure method setUI.

@Override
protected void setUI() {
    setLayoutManager(new GridLayout());
    FlowPage flowPage = new FlowPage();
    fTextFlow = new TextFlow();
    fTextFlow.setLayoutManager(new ParagraphTextLayout(fTextFlow, ParagraphTextLayout.WORD_WRAP_HARD));
    flowPage.add(fTextFlow);
    add(flowPage, new GridData(SWT.CENTER, SWT.CENTER, true, true));
    fTextPositionDelegate = new TextPositionDelegate(this, flowPage, getDiagramModelObject());
    setIconicDelegate(new IconicDelegate(getDiagramModelObject(), MAX_ICON_SIZE));
}
Also used : GridLayout(org.eclipse.draw2d.GridLayout) FlowPage(org.eclipse.draw2d.text.FlowPage) IconicDelegate(com.archimatetool.editor.diagram.figures.IconicDelegate) GridData(org.eclipse.draw2d.GridData) TextFlow(org.eclipse.draw2d.text.TextFlow) TextPositionDelegate(com.archimatetool.editor.diagram.figures.TextPositionDelegate) ParagraphTextLayout(org.eclipse.draw2d.text.ParagraphTextLayout)

Example 19 with GridData

use of org.eclipse.draw2d.GridData in project dbeaver by serge-rider.

the class LockGraphNodeEditPart method refreshVisuals.

@Override
protected void refreshVisuals() {
    LockGraphNode node = (LockGraphNode) getModel();
    LockGraph lgraph = (LockGraph) ((LockGraphEditPart) getParent()).getModel();
    LockGraphNodeFigure nodeFigure = (LockGraphNodeFigure) getFigure();
    LockGraphEditPart graph = (LockGraphEditPart) getParent();
    GridData gridData = new GridData(55, 30);
    gridData.horizontalAlignment = GridData.CENTER;
    gridData.verticalAlignment = GridData.CENTER;
    gridData.verticalSpan = 10;
    gridData.grabExcessHorizontalSpace = true;
    gridData.grabExcessVerticalSpace = true;
    int span = lgraph.getMaxWidth() / node.getSpan();
    int spanMod = lgraph.getMaxWidth() % node.getSpan();
    gridData.horizontalSpan = 0;
    if (span > 1 && node.getLevelPosition() != LockGraphNode.LevelPosition.RIGHT) {
        gridData.horizontalSpan = span;
    } else if (spanMod > 0 && node.getLevelPosition() == LockGraphNode.LevelPosition.RIGHT) {
        gridData.horizontalSpan = span + spanMod;
    }
    graph.setLayoutConstraint(this, nodeFigure, gridData);
}
Also used : LockGraph(org.jkiss.dbeaver.model.impl.admin.locks.LockGraph) GridData(org.eclipse.draw2d.GridData) LockGraphNode(org.jkiss.dbeaver.model.impl.admin.locks.LockGraphNode)

Example 20 with GridData

use of org.eclipse.draw2d.GridData in project statecharts by Yakindu.

the class StatechartTextFigure method createContents.

private void createContents() {
    name = new SyntaxColoringLabel();
    name.setLayoutManager(new StackLayout());
    GridData data = GridDataFactory.fillDefaults().align(GridData.CENTER, GridData.CENTER).grab(true, false).getData();
    this.add(name, data);
    // Text compartment
    compartment = new Figure();
    this.add(compartment, GridDataFactory.fillDefaults().grab(true, true).getData());
}
Also used : StackLayout(org.eclipse.draw2d.StackLayout) GridData(org.eclipse.draw2d.GridData) SyntaxColoringLabel(org.yakindu.base.xtext.utils.gmf.figures.SyntaxColoringLabel) Figure(org.eclipse.draw2d.Figure) RectangleFigure(org.eclipse.draw2d.RectangleFigure)

Aggregations

GridData (org.eclipse.draw2d.GridData)20 GridLayout (org.eclipse.draw2d.GridLayout)6 IFigure (org.eclipse.draw2d.IFigure)4 FlowPage (org.eclipse.draw2d.text.FlowPage)4 ParagraphTextLayout (org.eclipse.draw2d.text.ParagraphTextLayout)4 TextFlow (org.eclipse.draw2d.text.TextFlow)4 IconicDelegate (com.archimatetool.editor.diagram.figures.IconicDelegate)3 TextPositionDelegate (com.archimatetool.editor.diagram.figures.TextPositionDelegate)3 Figure (org.eclipse.draw2d.Figure)3 Label (org.eclipse.draw2d.Label)3 RectangleFigure (org.eclipse.draw2d.RectangleFigure)2 StackLayout (org.eclipse.draw2d.StackLayout)2 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)2 AbstractContainerFigure (com.archimatetool.editor.diagram.figures.AbstractContainerFigure)1 ITextFigure (com.archimatetool.editor.diagram.figures.ITextFigure)1 ITextAlignment (com.archimatetool.model.ITextAlignment)1 ITextPosition (com.archimatetool.model.ITextPosition)1 PortletColumnElement (com.liferay.ide.layouttpl.core.model.PortletColumnElement)1 ColumnFigure (com.liferay.ide.layouttpl.ui.draw2d.ColumnFigure)1 PortletLayoutPanel (com.liferay.ide.layouttpl.ui.draw2d.PortletLayoutPanel)1