use of org.eclipse.draw2d.GridData in project statecharts by Yakindu.
the class StateEditPart method refreshCompartmentLayout.
private void refreshCompartmentLayout() {
if (getTextCompartment().isCollapsed()) {
getPrimaryShape().setConstraint(getPrimaryShape().getTextCompartmentPane(), getCollapsedData());
} else {
GridData expandedData = getExpandedData();
if (figureCompartmentVisible())
expandedData.grabExcessVerticalSpace = false;
getPrimaryShape().setConstraint(getPrimaryShape().getTextCompartmentPane(), expandedData);
}
if (!figureCompartmentVisible()) {
getPrimaryShape().setConstraint(getPrimaryShape().getFigureCompartmentPane(), getCollapsedData());
} else {
getPrimaryShape().setConstraint(getPrimaryShape().getFigureCompartmentPane(), getExpandedData());
}
}
use of org.eclipse.draw2d.GridData in project statecharts by Yakindu.
the class StateTextCompartmentEditPart method addChildVisual.
@Override
protected void addChildVisual(EditPart childEditPart, int index) {
if (childEditPart instanceof StateTextCompartmentExpressionEditPart) {
GridData data = GridDataFactory.fillDefaults().grab(true, true).getData();
getContentPane().add(((StateTextCompartmentExpressionEditPart) childEditPart).getFigure(), data);
} else
super.addChildVisual(childEditPart, index);
}
use of org.eclipse.draw2d.GridData in project statecharts by Yakindu.
the class RegionFigure method createContents.
private void createContents() {
nameLabel = new SyntaxColoringLabel();
GridData data = GridDataFactory.fillDefaults().grab(true, false).getData();
data.horizontalIndent = 5;
nameLabel.setTextPlacement(PositionConstants.WEST);
this.add(nameLabel, data);
/**
* Compartment container *
*/
compartmentPane = new RectangleFigure();
compartmentPane.setOutline(false);
compartmentPane.setLayoutManager(new StackLayout());
compartmentPane.setFill(false);
this.add(compartmentPane, GridDataFactory.fillDefaults().grab(true, true).getData());
}
use of org.eclipse.draw2d.GridData in project hale by halestudio.
the class CellFigureTaskLabelContribution method contribute.
// private TaskServiceListener taskServiceListener;
@Override
public void contribute(CellFigure figure, Cell cell) {
TaskService taskService = HaleUI.getServiceProvider().getService(TaskService.class);
Collection<ResolvedTask<Cell>> tasks = taskService.getTasks(cell).stream().map(t -> taskService.resolveTask(t)).collect(Collectors.toList());
tasks = tasks.stream().filter(t -> t.isOpen()).collect(Collectors.toList());
if (tasks.isEmpty()) {
return;
}
Label tasksLabel = new Label();
Image tasksImage = null;
tasksImage = CommonSharedImages.getImageRegistry().get(CommonSharedImages.IMG_TASKS);
tasksLabel.setIcon(tasksImage);
tasksLabel.addMouseListener(new MouseListener() {
@Override
public void mouseReleased(MouseEvent me) {
try {
IViewPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(TaskTreeView.ID);
// the alignment/mapping view
if (part instanceof TaskTreeView) {
((TaskTreeView) part).update(new StructuredSelection(cell));
}
me.consume();
} catch (PartInitException e) {
log.error("Error creating task view", e);
}
}
@Override
public void mousePressed(MouseEvent me) {
// ignore
}
@Override
public void mouseDoubleClicked(MouseEvent me) {
// ignore
}
});
if (tasksImage != null) {
Label priorityTip = new Label(MessageFormat.format("There {0} {1} open tasks for this cell. Please refer to the Tasks view for details.", (tasks.size() == 1) ? "is" : "are", tasks.size()));
tasksLabel.setToolTip(priorityTip);
}
GridData tasksLabelGD = new GridData(GridData.CENTER, GridData.FILL, false, true);
figure.add(tasksLabel, tasksLabelGD);
}
use of org.eclipse.draw2d.GridData in project dbeaver by dbeaver.
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);
}
Aggregations