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