Search in sources :

Example 1 with GridData

use of org.eclipse.draw2d.GridData in project tdi-studio-se by Talend.

the class StatsAndLogsView method createEmptyPartControl.

/**
     * Creates a empty composite if no job opened.
     * 
     * @param parent
     */
private void createEmptyPartControl(Composite parent) {
    if (parent != null && !parent.isDisposed()) {
        Control[] children = parent.getChildren();
        for (Control control : children) {
            control.dispose();
        }
    }
    Composite alertComposite = new Composite(parent, SWT.NONE);
    alertComposite.setLayout(new GridLayout());
    alertComposite.setLayoutData(new GridData());
    Text alertText = new Text(alertComposite, SWT.NONE);
    //$NON-NLS-1$
    alertText.setText(Messages.getString("StatsAndLogsView.dataNotAvailable"));
    alertText.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    parent.layout();
}
Also used : Control(org.eclipse.swt.widgets.Control) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.draw2d.GridData) Text(org.eclipse.swt.widgets.Text)

Example 2 with GridData

use of org.eclipse.draw2d.GridData in project cubrid-manager by CUBRID.

the class GraphPlanTooltipFigure method addKeyValueItem.

public void addKeyValueItem(String key, String value) {
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.horizontalSpacing = 5;
    layout.verticalSpacing = 0;
    layout.makeColumnsEqualWidth = true;
    Label namelbl = new Label();
    namelbl.setFont(bolderFont);
    namelbl.setTextAlignment(PositionConstants.LEFT);
    namelbl.setText(key);
    GridData nameData = new GridData(SWT.NONE);
    nameData.grabExcessHorizontalSpace = true;
    nameData.horizontalSpan = 0;
    getKeyValueCompartment().add(namelbl, nameData);
    Label valueLbl = new Label();
    valueLbl.setFont(normalFont);
    valueLbl.setTextAlignment(PositionConstants.RIGHT);
    valueLbl.setText(value);
    GridData valueData = new GridData(SWT.NONE);
    valueData.grabExcessHorizontalSpace = true;
    valueData.horizontalSpan = 0;
    getKeyValueCompartment().add(valueLbl, valueData);
    updateMap(key + value, keyValueFigures, namelbl, valueLbl);
}
Also used : GridLayout(org.eclipse.draw2d.GridLayout) Label(org.eclipse.draw2d.Label) GridData(org.eclipse.draw2d.GridData)

Example 3 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 4 with GridData

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

the class TextPositionDelegate method updateTextPosition.

public void updateTextPosition() {
    int textPosition = SWT.CENTER;
    switch(fTextPositionObject.getTextPosition()) {
        case ITextPosition.TEXT_POSITION_TOP:
            textPosition = SWT.TOP;
            break;
        case ITextPosition.TEXT_POSITION_CENTRE:
            textPosition = SWT.CENTER;
            break;
        case ITextPosition.TEXT_POSITION_BOTTOM:
            textPosition = SWT.BOTTOM;
            break;
        default:
            break;
    }
    int textAlignment = SWT.CENTER;
    if (fTextPositionObject instanceof ITextAlignment) {
        switch(((ITextAlignment) fTextPositionObject).getTextAlignment()) {
            case ITextAlignment.TEXT_ALIGNMENT_LEFT:
                textAlignment = SWT.LEFT;
                break;
            case ITextAlignment.TEXT_ALIGNMENT_CENTER:
                textAlignment = SWT.CENTER;
                break;
            case ITextAlignment.TEXT_ALIGNMENT_RIGHT:
                textAlignment = SWT.RIGHT;
                break;
            default:
                break;
        }
    }
    GridData gd = new GridData(textAlignment, textPosition, true, true);
    fParentFigure.setConstraint(fChildFigure, gd);
}
Also used : ITextAlignment(com.archimatetool.model.ITextAlignment) GridData(org.eclipse.draw2d.GridData)

Example 5 with GridData

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

the class AbstractTextControlContainerFigure method createTextFlowControl.

protected TextFlow createTextFlowControl(Locator textLocator) {
    TextFlow textFlow = new TextFlow();
    int wordWrapStyle = Preferences.STORE.getInt(IPreferenceConstants.ARCHIMATE_FIGURE_WORD_WRAP_STYLE);
    textFlow.setLayoutManager(new ParagraphTextLayout(textFlow, wordWrapStyle));
    BlockFlow block = new BlockFlow();
    block.add(textFlow);
    FlowPage page = new FlowPage();
    page.add(block);
    Figure textWrapperFigure = new Figure();
    GridLayout layout = new GridLayout();
    layout.marginWidth = getTextControlMarginWidth();
    layout.marginHeight = 5;
    textWrapperFigure.setLayoutManager(layout);
    GridData gd = new GridData(SWT.CENTER, SWT.TOP, true, true);
    textWrapperFigure.add(page, gd);
    if (getDiagramModelObject() instanceof ITextPosition) {
        fTextPositionDelegate = new TextPositionDelegate(textWrapperFigure, page, (ITextPosition) getDiagramModelObject());
    }
    add(textWrapperFigure, textLocator);
    return textFlow;
}
Also used : FlowPage(org.eclipse.draw2d.text.FlowPage) GridLayout(org.eclipse.draw2d.GridLayout) ITextPosition(com.archimatetool.model.ITextPosition) BlockFlow(org.eclipse.draw2d.text.BlockFlow) GridData(org.eclipse.draw2d.GridData) TextFlow(org.eclipse.draw2d.text.TextFlow) ParagraphTextLayout(org.eclipse.draw2d.text.ParagraphTextLayout) IFigure(org.eclipse.draw2d.IFigure) Figure(org.eclipse.draw2d.Figure)

Aggregations

GridData (org.eclipse.draw2d.GridData)20 GridLayout (org.eclipse.draw2d.GridLayout)6 IFigure (org.eclipse.draw2d.IFigure)4 BlockFlow (org.eclipse.draw2d.text.BlockFlow)4 FlowPage (org.eclipse.draw2d.text.FlowPage)4 ParagraphTextLayout (org.eclipse.draw2d.text.ParagraphTextLayout)4 TextFlow (org.eclipse.draw2d.text.TextFlow)4 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 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 ALogger (de.fhg.igd.slf4jplus.ALogger)1