Search in sources :

Example 1 with EntityLabel

use of org.whole.lang.ui.figures.EntityLabel in project whole by wholeplatform.

the class AbstractPart method addDecoration.

public void addDecoration(DecorationKind kind, String tooltip) {
    IFigure decorations = getFigure().getToolTip();
    if (decorations == null || !(decorations instanceof DecorationFigure))
        getFigure().setToolTip(decorations = new DecorationFigure());
    decorations.add(new EntityLabel(tooltip, getDecorationImage(kind)));
}
Also used : EntityLabel(org.whole.lang.ui.figures.EntityLabel) IFigure(org.eclipse.draw2d.IFigure)

Example 2 with EntityLabel

use of org.whole.lang.ui.figures.EntityLabel in project whole by wholeplatform.

the class SimpleEntityTreeFigure method createFeaturesOutline.

protected IFigure createFeaturesOutline(EntityDescriptor<?> ed, ActionListener linkListener) {
    int featureNum = ed.childFeatureSize();
    IFigure featuresOutline = new EntityFigure(new ColumnLayout().withAutoresizeWeight(1.0f).withMarginBottom(2).withMinorAlignment(isRightToLeft() ? Alignment.LEADING : Alignment.TRAILING));
    featureToggles = new Toggle[featureNum];
    for (int i = 0; i < featureNum; i++) {
        FeatureDescriptor fd = ed.getEntityFeatureDescriptor(i);
        EntityFigure feature = new EntityFigure(new RowLayout().withSpacing(3).withMajorAlignment(isRightToLeft() ? Alignment.LEADING : Alignment.TRAILING).withReversedChildren(isRightToLeft()));
        feature.addLabel(fd.getName());
        featureToggles[i] = createFoldingToggle(new EntityToggle(WholeImages.ROUND_EXPAND, WholeImages.ROUND_COLLAPSE), i);
        feature.add(featureToggles[i]);
        featuresOutline.add(feature);
    }
    for (int i = featureNum, size = ed.featureSize(); i < size; i++) {
        FeatureDescriptor fd = ed.getEntityFeatureDescriptor(i);
        EntityFigure feature = new EntityFigure(new RowLayout().withMarginLeft(3).withMarginRight(3).withMajorAlignment(isRightToLeft() ? Alignment.LEADING : Alignment.TRAILING).withReversedChildren(isRightToLeft()));
        EntityLabel createLabel = feature.addLabel(fd.getName(), WholeImages.LINK);
        createLabel.setTextPlacement(isRightToLeft() ? PositionConstants.EAST : PositionConstants.WEST);
        createLabel.setBorder(new MarginBorder(3));
        feature.add(new EntityButton(createLabel, linkListener, i));
        featuresOutline.add(feature);
    }
    return featuresOutline;
}
Also used : EntityFigure(org.whole.lang.ui.figures.EntityFigure) FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor) EntityButton(org.whole.lang.ui.figures.EntityButton) ColumnLayout(org.whole.lang.ui.layout.ColumnLayout) RowLayout(org.whole.lang.ui.layout.RowLayout) MarginBorder(org.eclipse.draw2d.MarginBorder) EntityToggle(org.whole.lang.ui.figures.EntityToggle) EntityLabel(org.whole.lang.ui.figures.EntityLabel) Point(org.eclipse.draw2d.geometry.Point) IFigure(org.eclipse.draw2d.IFigure)

Example 3 with EntityLabel

use of org.whole.lang.ui.figures.EntityLabel in project whole by wholeplatform.

the class OperationPart method createFigure.

@Override
public IFigure createFigure() {
    EntityLabel label = (EntityLabel) super.createFigure();
    Operation operation = getModelEntity();
    Image operationIcon = null;
    switch(operation.getValue().getOrdinal()) {
        case OperationEnum.VALIDATOR_ord:
            operationIcon = NotationImages.VALIDATE16;
            break;
        case OperationEnum.NORMALIZER_ord:
            operationIcon = NotationImages.NORMALIZE16;
            break;
        case OperationEnum.PRETTY_PRINTER_ord:
            operationIcon = NotationImages.PRETTY_PRINT16;
            break;
        case OperationEnum.INTERPRETER_ord:
            operationIcon = NotationImages.INTERPRET16;
            break;
        case OperationEnum.ARTIFACTS_GENERATOR_ord:
            operationIcon = NotationImages.GENERATE_ARTIFACTS16;
            break;
        case OperationEnum.JAVA_COMPILER_ord:
            operationIcon = NotationImages.GENERATE_JAVA16;
            break;
    }
    label.setIcon(operationIcon);
    return label;
}
Also used : EntityLabel(org.whole.lang.ui.figures.EntityLabel) Operation(org.whole.lang.workflows.model.Operation) Image(org.eclipse.swt.graphics.Image)

Example 4 with EntityLabel

use of org.whole.lang.ui.figures.EntityLabel in project whole by wholeplatform.

the class XsiCompositeElementPart method createLabel.

protected EntityLabel createLabel() {
    String tagName = MappingStrategyUtils.getElementNCName(getModelEntity());
    EntityLabel label = LabelFactory.createContent(tagName);
    label.setIcon(NotationImages.XML_TAG16);
    return label;
}
Also used : EntityLabel(org.whole.lang.ui.figures.EntityLabel)

Example 5 with EntityLabel

use of org.whole.lang.ui.figures.EntityLabel in project whole by wholeplatform.

the class SmallIdentifierTextualEntityPart method createFigure.

protected IFigure createFigure() {
    EntityLabel label = LabelFactory.createMonospaceSmall();
    label.setForegroundColor(FigureConstants.identifiersColor);
    return new TextualFigure(label);
}
Also used : TextualFigure(org.whole.lang.ui.figures.TextualFigure) EntityLabel(org.whole.lang.ui.figures.EntityLabel)

Aggregations

EntityLabel (org.whole.lang.ui.figures.EntityLabel)13 IFigure (org.eclipse.draw2d.IFigure)2 MarginBorder (org.eclipse.draw2d.MarginBorder)2 EntityFigure (org.whole.lang.ui.figures.EntityFigure)2 TextualFigure (org.whole.lang.ui.figures.TextualFigure)2 RowLayout (org.whole.lang.ui.layout.RowLayout)2 Graphics (org.eclipse.draw2d.Graphics)1 Point (org.eclipse.draw2d.geometry.Point)1 Image (org.eclipse.swt.graphics.Image)1 IEntity (org.whole.lang.model.IEntity)1 FeatureDescriptor (org.whole.lang.reflect.FeatureDescriptor)1 FeatureDescriptorEnum (org.whole.lang.reflect.FeatureDescriptorEnum)1 EntityButton (org.whole.lang.ui.figures.EntityButton)1 EntityToggle (org.whole.lang.ui.figures.EntityToggle)1 ColumnLayout (org.whole.lang.ui.layout.ColumnLayout)1 Operation (org.whole.lang.workflows.model.Operation)1