Search in sources :

Example 6 with GridData

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());
    }
}
Also used : GridData(org.eclipse.draw2d.GridData)

Example 7 with GridData

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);
}
Also used : GridData(org.eclipse.draw2d.GridData)

Example 8 with GridData

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());
}
Also used : RectangleFigure(org.eclipse.draw2d.RectangleFigure) GridData(org.eclipse.draw2d.GridData) StackLayout(org.eclipse.draw2d.StackLayout) SyntaxColoringLabel(org.yakindu.base.xtext.utils.gmf.figures.SyntaxColoringLabel)

Example 9 with GridData

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);
}
Also used : Cell(eu.esdihumboldt.hale.common.align.model.Cell) PlatformUI(org.eclipse.ui.PlatformUI) ALogger(de.fhg.igd.slf4jplus.ALogger) Collection(java.util.Collection) HaleUI(eu.esdihumboldt.hale.ui.HaleUI) Image(org.eclipse.swt.graphics.Image) CellFigure(eu.esdihumboldt.hale.ui.common.graph.figures.CellFigure) MouseEvent(org.eclipse.draw2d.MouseEvent) ALoggerFactory(de.fhg.igd.slf4jplus.ALoggerFactory) ResolvedTask(eu.esdihumboldt.hale.common.tasks.ResolvedTask) MouseListener(org.eclipse.draw2d.MouseListener) CommonSharedImages(eu.esdihumboldt.hale.ui.common.CommonSharedImages) CellFigureContribution(eu.esdihumboldt.hale.ui.common.graph.figures.CellFigureContribution) Collectors(java.util.stream.Collectors) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) MessageFormat(java.text.MessageFormat) TaskService(eu.esdihumboldt.hale.common.tasks.TaskService) GridData(org.eclipse.draw2d.GridData) PartInitException(org.eclipse.ui.PartInitException) Label(org.eclipse.draw2d.Label) IViewPart(org.eclipse.ui.IViewPart) IViewPart(org.eclipse.ui.IViewPart) MouseEvent(org.eclipse.draw2d.MouseEvent) TaskService(eu.esdihumboldt.hale.common.tasks.TaskService) Label(org.eclipse.draw2d.Label) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) Image(org.eclipse.swt.graphics.Image) MouseListener(org.eclipse.draw2d.MouseListener) ResolvedTask(eu.esdihumboldt.hale.common.tasks.ResolvedTask) GridData(org.eclipse.draw2d.GridData) PartInitException(org.eclipse.ui.PartInitException)

Example 10 with GridData

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

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