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();
}
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);
}
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));
}
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);
}
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());
}
Aggregations