Search in sources :

Example 6 with ImageFigure

use of org.eclipse.draw2d.ImageFigure in project cogtool by cogtool.

the class DesignEditorFrame method addSpeakerBox.

protected void addSpeakerBox() {
    speakerBox.setBorder(new LineBorder(ColorConstants.black, 1));
    speakerBox.setOpaque(true);
    Image speakerIconImg = getSpeakerIconImage();
    // TODO: handle getImage returning null
    org.eclipse.swt.graphics.Rectangle bds = speakerIconImg.getBounds();
    IFigure speakerImgFig = new ImageFigure(speakerIconImg);
    IFigure speakerImgToolTip = new Label(L10N.get("DEF.SpeakerText", "Speaker text"));
    speakerImgFig.setToolTip(speakerImgToolTip);
    speakerImgWidth = bds.width;
    speakerImgHeight = bds.height;
    speakerLayout.setConstraint(speakerImgFig, new Rectangle(0, 0, bds.width, bds.height));
    speakerBox.add(speakerImgFig);
    RectangleFigure speakerEastBorder = new RectangleFigure();
    speakerEastBorder.setBorder(new LineBorder(ColorConstants.black, 1));
    speakerLayout.setConstraint(speakerEastBorder, new Rectangle(speakerImgWidth, 0, SPEAKER_DIVIDER_WIDTH, speakerImgHeight));
    speakerBox.add(speakerEastBorder);
    timeWestBorder = new RectangleFigure();
    timeWestBorder.setBorder(new LineBorder(ColorConstants.black, 1));
    speakerBox.add(timeWestBorder);
    String text = frame.getSpeakerText();
    speakerText = new Label(text);
    speakerText.setLabelAlignment(PositionConstants.LEFT);
    speakerTextToolTip = new Label(text);
    if ((text != null) && !text.equals("")) {
        speakerText.setToolTip(speakerTextToolTip);
    }
    speakerBox.add(speakerText);
    divider = new RectangleFigure();
    divider.setBorder(new LineBorder(ColorConstants.black, 1));
    speakerBox.add(divider);
    double listenTimeInSecs = frame.getListenTimeInSecs();
    listenTime = new Label((listenTimeInSecs == Frame.NO_LISTEN_TIME) ? NO_LISTEN_TIME_LABEL : Double.toString(listenTimeInSecs));
    listenTime.setLabelAlignment(PositionConstants.RIGHT);
    speakerBox.add(listenTime);
    Label listenTimeToolTip = new Label(LISTEN_TIME_TOOLTIP);
    listenTime.setToolTip(listenTimeToolTip);
}
Also used : RectangleFigure(org.eclipse.draw2d.RectangleFigure) LineBorder(org.eclipse.draw2d.LineBorder) Label(org.eclipse.draw2d.Label) Rectangle(org.eclipse.draw2d.geometry.Rectangle) ImageFigure(org.eclipse.draw2d.ImageFigure) Image(org.eclipse.swt.graphics.Image) IFigure(org.eclipse.draw2d.IFigure)

Example 7 with ImageFigure

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

the class GlobalMapKeysEntityFigure method createEntityItems.

@Override
protected void createEntityItems(TableEntityElement entityElement) {
    this.globalMapNode = getEntityManager().getModel();
    expression = new ExpressionFigure();
    expression.setText(globalMapNode.getExpression());
    globalMapKey = new TextCellLabel();
    globalMapKey.setDirectEditType(DirectEditType.NODE_NAME);
    globalMapKey.setText(globalMapNode.getName());
    globalMapKey.setLabelAlignment(PositionConstants.LEFT);
    deleteImage = new ImageFigure(ImageProviderMapper.getImage(ImageInfo.DELETE));
    entityElement.add(expression);
    entityElement.add(globalMapKey);
    entityElement.add(deleteImage);
    addCheckListener();
}
Also used : ExpressionFigure(org.talend.designer.gefabstractmap.figures.ExpressionFigure) ImageFigure(org.eclipse.draw2d.ImageFigure) TextCellLabel(org.talend.designer.gefabstractmap.figures.TextCellLabel)

Example 8 with ImageFigure

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

the class VarNodeEditPart method notifyChanged.

@Override
public void notifyChanged(Notification notification) {
    int type = notification.getEventType();
    int featureId = notification.getFeatureID(XmlmapPackage.class);
    switch(type) {
        case Notification.SET:
            switch(featureId) {
                case XmlmapPackage.VAR_NODE__EXPRESSION:
                    ((VarEntityFigure) getFigure()).getExpression().setText(((VarNode) getModel()).getExpression());
                    break;
                case XmlmapPackage.VAR_NODE__NULLABLE:
                    boolean newBoolean = notification.getNewBooleanValue();
                    ImageFigure checkImage = ((VarEntityFigure) getFigure()).getCheckImage();
                    if (newBoolean) {
                        checkImage.setImage(ImageProvider.getImage(EImage.CHECKED_ICON));
                    } else if (!newBoolean) {
                        checkImage.setImage(ImageProvider.getImage(EImage.UNCHECKED_ICON));
                    }
                    break;
                case XmlmapPackage.VAR_NODE__NAME:
                    ((VarEntityFigure) getFigure()).getVariableLabel().setText(((VarNode) getModel()).getName());
                    break;
                case XmlmapPackage.VAR_NODE__TYPE:
                    ((VarEntityFigure) getFigure()).updateVarNodeType(((VarNode) getModel()).getType(), ((VarNode) getModel()).isNullable());
                    // refreshVisuals();
                    break;
                default:
            }
        case Notification.ADD:
            switch(featureId) {
                case XmlmapPackage.VAR_NODE__INCOMING_CONNECTIONS:
                    refreshTargetConnections();
                    break;
                case XmlmapPackage.VAR_NODE__OUTGOING_CONNECTIONS:
                case XmlmapPackage.VAR_NODE__FILTER_OUT_GOING_CONNECTIONS:
                    refreshSourceConnections();
                    break;
            }
        case Notification.REMOVE:
        case Notification.REMOVE_MANY:
            switch(featureId) {
                case XmlmapPackage.VAR_NODE__INCOMING_CONNECTIONS:
                    refreshTargetConnections();
                    break;
                case XmlmapPackage.VAR_NODE__OUTGOING_CONNECTIONS:
                case XmlmapPackage.VAR_NODE__FILTER_OUT_GOING_CONNECTIONS:
                    refreshSourceConnections();
                    break;
            }
    }
}
Also used : VarEntityFigure(org.talend.designer.gefabstractmap.figures.var.VarEntityFigure) ImageFigure(org.eclipse.draw2d.ImageFigure) Point(org.eclipse.draw2d.geometry.Point)

Example 9 with ImageFigure

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

the class FilterContainer method createContent.

private void createContent() {
    FilterContainerLayout manager = new FilterContainerLayout();
    manager.setVertical(false);
    manager.setSpacing(5);
    setLayoutManager(manager);
    textArea = new FilterTextArea();
    textArea.setText(tableManager.getExpressionFilter());
    this.add(textArea);
    textArea.setOpaque(true);
    setBackgroundColor(ColorConstants.white);
    button = new ImageFigure(ImageProviderMapper.getImage(ImageInfo.FILTER_BUTTON));
    addButtonListener();
    this.add(button);
    setOpaque(true);
    setBackgroundColor(ColorConstants.yellow);
    setBorder(new MarginBorder(2));
}
Also used : MarginBorder(org.eclipse.draw2d.MarginBorder) ImageFigure(org.eclipse.draw2d.ImageFigure)

Example 10 with ImageFigure

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

the class VarEntityFigure method createVariableContainer.

protected Figure createVariableContainer() {
    Figure container = new Figure();
    // container.setBorder(new RowBorder());
    ToolbarLayout manager = new ToolbarLayout() {

        @Override
        public void layout(IFigure parent) {
            super.layout(parent);
            List children = parent.getChildren();
            if (children.size() == 2) {
                Figure checkImageFigure = (Figure) children.get(0);
                Figure variableFigure = (Figure) children.get(1);
                Rectangle varFigureBounds = variableFigure.getBounds().getCopy();
                int avialableWith = parent.getBounds().width - checkImageFigure.getBounds().width;
                if (avialableWith > varFigureBounds.width) {
                    varFigureBounds.width = avialableWith;
                }
                variableFigure.setBounds(varFigureBounds);
            }
        }
    };
    manager.setVertical(false);
    manager.setStretchMinorAxis(false);
    container.setLayoutManager(manager);
    // if(varNode.)
    Label nullableToolTip = new Label("Nullable");
    if (!isNullable()) {
        checkImage = new ImageFigure(ImageProvider.getImage(EImage.UNCHECKED_ICON));
    } else {
        checkImage = new ImageFigure(ImageProvider.getImage(EImage.CHECKED_ICON));
    }
    checkImage.setToolTip(nullableToolTip);
    variableLabel = new VarNodeTextLabel();
    variableLabel.setText(getVarName());
    variableLabel.setLabelAlignment(PositionConstants.LEFT);
    variableLabel.setBorder(new MarginBorder(2, 5, 2, -1));
    container.add(checkImage);
    container.add(variableLabel);
    addCheckListener();
    return container;
}
Also used : ToolbarLayout(org.eclipse.draw2d.ToolbarLayout) VarNodeTextLabel(org.talend.designer.gefabstractmap.figures.VarNodeTextLabel) MarginBorder(org.eclipse.draw2d.MarginBorder) Rectangle(org.eclipse.draw2d.geometry.Rectangle) VarNodeTextLabel(org.talend.designer.gefabstractmap.figures.VarNodeTextLabel) ComboCellLabel(org.talend.designer.gefabstractmap.figures.ComboCellLabel) Label(org.eclipse.draw2d.Label) List(java.util.List) ImageFigure(org.eclipse.draw2d.ImageFigure) IFigure(org.eclipse.draw2d.IFigure) ImageFigure(org.eclipse.draw2d.ImageFigure) TableEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableEntityFigure) Figure(org.eclipse.draw2d.Figure) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

ImageFigure (org.eclipse.draw2d.ImageFigure)10 Image (org.eclipse.swt.graphics.Image)6 ECoreImage (org.talend.commons.ui.runtime.image.ECoreImage)4 List (java.util.List)3 Figure (org.eclipse.draw2d.Figure)3 IFigure (org.eclipse.draw2d.IFigure)3 ToolbarLayout (org.eclipse.draw2d.ToolbarLayout)3 Point (org.eclipse.draw2d.geometry.Point)3 Label (org.eclipse.draw2d.Label)2 LineBorder (org.eclipse.draw2d.LineBorder)2 MarginBorder (org.eclipse.draw2d.MarginBorder)2 Rectangle (org.eclipse.draw2d.geometry.Rectangle)2 EImage (org.talend.commons.ui.runtime.image.EImage)2 SimpleHtmlFigure (org.talend.commons.ui.utils.workbench.gef.SimpleHtmlFigure)2 CogToolWorkThread (edu.cmu.cs.hcii.cogtool.CogToolWorkThread)1 DoubleSize (edu.cmu.cs.hcii.cogtool.model.DoubleSize)1 IWidget (edu.cmu.cs.hcii.cogtool.model.IWidget)1 GraphicsUtil (edu.cmu.cs.hcii.cogtool.util.GraphicsUtil)1 ThreadManager (edu.cmu.cs.hcii.cogtool.util.ThreadManager)1 ScalableFrameFigure (edu.cmu.cs.hcii.cogtool.view.ScalableFrameFigure)1