public ColumnTitleFigure(MapperTablePart xmlTreePart) { this.xmlTreePart = xmlTreePart; AbstractInOutTree xmlTree = (AbstractInOutTree) xmlTreePart.getModel(); if (xmlTree instanceof InputXmlTree) { InputXmlTree inputTree = (InputXmlTree) xmlTree; if (inputTree.isLookup()) { Label expression = new Label(); expression.setText("Exp.key"); expression.setBorder(new MarginBorder(3, 10, 3, -1)); expression.setLabelAlignment(PositionConstants.LEFT); this.add(expression); } } else { Label expression = new Label(); expression.setText("Expression"); expression.setBorder(new MarginBorder(3, 10, 3, -1)); expression.setLabelAlignment(PositionConstants.LEFT); this.add(expression); } Label column1 = new Label(); column1.setText("Column"); column1.setBorder(new MarginBorder(3, 10, 3, -1)); column1.setLabelAlignment(PositionConstants.LEFT); this.add(column1); setLayoutManager(new ColumnTitleLayout()); setBackgroundColor(ColorConstants.menuBackground); setOpaque(true); }
public void propertyChange(PropertyChangeEvent evt) { SyncMessageConnectionFigure figure = (SyncMessageConnectionFigure) getFigure(); Label label = figure.getLabel(); SyncMessageModel model = (SyncMessageModel) getModel(); if (evt.getPropertyName().equals(MessageModel.P_NAME)) { label.setText(model.getOrder() + "." + model.getName()); } if (evt.getPropertyName().equals(SyncMessageModel.P_ORDER)) { label.setText(model.getOrder() + "." + model.getName()); } if (evt.getPropertyName().equals(SyncMessageModel.P_DIRECTION)) { figure.locateLabel(model.isDirection()); } super.propertyChange(evt); }
private String abbreviateLabel(Label label, String labelText, int currentLength) { label.setText(labelText); if (label.getFont() == null) { label.setFont(Display.getDefault().getSystemFont()); } if (label.getTextBounds().width > MAX_LABEL_WIDTH) { String shorterLabelText = ""; shorterLabelText = StringUtils.abbreviateMiddle(label.getText(), LABEL_TEXT_SEPARATOR, currentLength); currentLength--; label.setText(shorterLabelText); abbreviateLabel(label, shorterLabelText, currentLength); } return label.getText(); }
/** @generated */ protected void setLabelTextHelper(IFigure figure, String text) { if (figure instanceof WrappingLabel) { ((WrappingLabel) figure).setText(text); } else { ((Label) figure).setText(text); } }
/** * Sets the name. * * @param name the new name */ @Override public void setName(String name) { text.setText(name); textFigure.setSize(width, 10); text.setSize(width, 10); text.setLocation(getLocation()); textFigure.setLocation(getLocation()); }
@Override public void setText(String text) { this.text = text; if (textLabel != null) { textLabel.setText(text); adjustSize(); } }
/** * Set the label that displays the text. * * @param textLabel the label to display the text, may be the same as the icon label or <code>null * </code> to ignore the text * @see #setIconLabel(Label) */ public void setTextLabel(Label textLabel) { this.textLabel = textLabel; textLabel.setFont(getFont()); if (text != null) { textLabel.setText(text); } }
private void doUpdateFigure(Connection connection) { if (connection == null || this.isDisposed()) { return; } Shape connectionShape = (Shape) connection; connectionShape.setLineStyle(getLineStyle()); if (this.getText() != null || this.getImage() != null) { if (this.getImage() != null) { this.connectionLabel.setIcon(this.getImage()); } if (this.getText() != null) { this.connectionLabel.setText(this.getText()); } this.connectionLabel.setFont(this.getFont()); } if (highlighted) { connectionShape.setForegroundColor(getHighlightColor()); connectionShape.setLineWidth(getLineWidth() * 2); } else { connectionShape.setForegroundColor(getLineColor()); connectionShape.setLineWidth(getLineWidth()); } if (connection instanceof PolylineArcConnection) { PolylineArcConnection arcConnection = (PolylineArcConnection) connection; arcConnection.setDepth(curveDepth); } if (connectionFigure != null) { applyConnectionRouter(connectionFigure); } if ((connectionStyle & ZestStyles.CONNECTIONS_DIRECTED) > 0) { PolygonDecoration decoration = new PolygonDecoration(); if (getLineWidth() < 3) { decoration.setScale(9, 3); } else { double logLineWith = getLineWidth() / 2.0; decoration.setScale(7 * logLineWith, 3 * logLineWith); } ((PolylineConnection) connection).setTargetDecoration(decoration); } IFigure toolTip; if (this.getTooltip() == null && getText() != null && getText().length() > 0 && hasCustomTooltip == false) { toolTip = new Label(); ((Label) toolTip).setText(getText()); } else { toolTip = this.getTooltip(); } connection.setToolTip(toolTip); }
/** @generated NOT */ protected void setLabelTextHelper(IFigure figure, String text) { int posDot = -1; int posDouble = -1; posDot = text.lastIndexOf("."); posDouble = text.indexOf(":"); if (posDot > -1 && posDouble > -1) { String first = text.substring(0, posDouble + 1); String second = text.substring(posDot + 1); text = first + second; } if (figure instanceof WrappingLabel) { ((WrappingLabel) figure).setText(text); } else { ((Label) figure).setText(text); } }
/** @generated NOT */ private void createContents() { fFigureInputPortNameFigure = new Label(); fFigureInputPortNameFigure.setText("<...>"); this.add(fFigureInputPortNameFigure); rect = new RoundedRectangle(); rect.setSize(20, 20); rect.setFill(true); rect.setLineWidth(2); rect.setForegroundColor(ColorConstants.black); rect.setBackgroundColor(ColorConstants.white); this.add(rect); }
private void updateConnection() { label.setText(getText() != null ? getText() : ""); connectionFigure.setLineStyle(getConnectionStyle()); connectionFigure.setForegroundColor(getLineColor()); connectionFigure.setLineWidth(getLineWidth()); PolygonDecoration decoration = new PolygonDecoration(); if (getLineWidth() < 3) { decoration.setScale(9, 3); } else { double logLineWith = getLineWidth() / 2.0; decoration.setScale(7 * logLineWith, 3 * logLineWith); } connectionFigure.setTargetDecoration(decoration); }
private void setTabFigureProperty(int index, TabProperty tabProperty, final Object newValue) { Label label = getTabFigure().getTabLabel(index); switch (tabProperty) { case TITLE: label.setText((String) newValue); updateTabAreaSize(); break; case FONT: label.setFont(((OPIFont) newValue).getSWTFont()); updateTabAreaSize(); break; case BACKCOLOR: getTabFigure().setTabColor(index, ((OPIColor) newValue).getSWTColor()); break; case FORECOLOR: label.setForegroundColor( CustomMediaFactory.getInstance().getColor(((OPIColor) newValue).getRGBValue())); break; case ENABLED: getTabFigure().setTabEnabled(index, (Boolean) newValue); break; case ICON_PATH: getTabFigure() .setIconPath( index, getWidgetModel().toAbsolutePath((IPath) newValue), new IJobErrorHandler() { public void handleError(Exception e) { String message = "Failed to load image from " + newValue + "\n" + e; Activator.getLogger().log(Level.WARNING, message, e); ConsoleService.getInstance().writeError(message); } }); break; default: break; } }
public ComboBox() { super(); setOpaque(true); setLayoutManager(new BorderLayout()); setBackgroundColor(VisualEditorPlugin.getDefault().getColorManager().getAirColor()); label = new Label(); label.setBackgroundColor(ColorConstants.white); label.setVisible(false); add(label, BorderLayout.CENTER); label.setText(" "); button = new ArrowButton(Orientable.SOUTH); button.setBorder(null); button.setOpaque(false); button.setEnabled(false); button.setPreferredSize(15, 13); add(button, BorderLayout.RIGHT); setBorder( new SchemeBorder( new ButtonScheme( new Color[] {buttonLightest}, new Color[] {buttonDarkest, buttonDarker}))); }
/** @generated */ protected void updateLabel(Label target) { Label source = (Label) getHostFigure(); target.setText(source.getText()); target.setTextAlignment(source.getTextAlignment()); target.setFont(source.getFont()); }
public void setName(String name) { label.setText((null != name) ? name : ""); // $NON-NLS-1$ }
@Override public void setValue(double value) { super.setValue(value); valueLabel.setText(getValueText()); }
/** * Sets the hide. * * @param hide the new hide */ @Override public void setHide(boolean hide) { this.hide = hide; hideSymbol.setText(getSymbol()); repaint(); }
public int setText(String text) { textLb.setText(text); return textLb.getPreferredSize().width; }
/* * (non-Javadoc) * * @see org.talend.designer.gefabstractmap.figures.table.AbstractTable#createColumns() */ @Override protected void createColumns() { TableColumn column = new TableColumn(ColumnKeyConstant.TREE_SETTING_PROPERTY); column.setText("Property"); addColumn(column); ColumnSash sash = new ColumnSash(this); sash.setLeftColumn(column); addSeparator(sash); column = new TableColumn(ColumnKeyConstant.TREE_SETTING_VALUE); column.setText("Value"); sash.setRightColumn(column); addColumn(column); Figure container = getTableItemContainer(); joinModelRow = new Figure(); joinModelRow.setLayoutManager(new RowLayout()); Label label = new Label(); label.setText("Join Model"); label.setLabelAlignment(PositionConstants.LEFT); CompoundBorder compoundBorder = new CompoundBorder(new ColumnBorder(), new RowBorder(2, 5, 2, -1)); label.setBorder(compoundBorder); joinModelRow.add(label); joinModel = new ComboCellLabel(); joinModel.setDirectEditType(DirectEditType.JOIN_MODEL); joinModel.setText(inputTable.getJoinModel()); joinModel.setLabelAlignment(PositionConstants.LEFT); joinModel.setBorder(new RowBorder(2, 5, 2, -1)); joinModelRow.add(joinModel); container.add(joinModelRow); // joinOptimizationRow = new Figure(); joinOptimizationRow.setLayoutManager(new RowLayout()); label = new Label(); label.setText("Join Optimization"); label.setLabelAlignment(PositionConstants.LEFT); compoundBorder = new CompoundBorder(new ColumnBorder(), new RowBorder(2, 5, 2, -1)); label.setBorder(compoundBorder); joinOptimizationRow.add(label); joinOptimization = new ComboCellLabel(); joinOptimization.setDirectEditType(DirectEditType.JOIN_OPTIMIZATION); joinOptimization.setText(getJoinOptimizationDisplayName(inputTable.getJoinOptimization())); joinOptimization.setLabelAlignment(PositionConstants.LEFT); joinOptimization.setBorder(new RowBorder(2, 5, 2, -1)); joinOptimizationRow.add(joinOptimization); container.add(joinOptimizationRow); // customPartitionerRow = new Figure(); customPartitionerRow.setLayoutManager(new RowLayout()); label = new Label(); label.setText("Custom Partitioner"); label.setLabelAlignment(PositionConstants.LEFT); compoundBorder = new CompoundBorder(new ColumnBorder(), new RowBorder(2, 5, 2, -1)); label.setBorder(compoundBorder); customPartitionerRow.add(label); customPartitioner = new TextCellLabel(); customPartitioner.setDirectEditType(DirectEditType.CUSTOM_PARTITIONER); customPartitioner.setText(inputTable.getCustomPartitioner()); customPartitioner.setLabelAlignment(PositionConstants.LEFT); customPartitioner.setBorder(new RowBorder(2, 5, 2, -1)); customPartitionerRow.add(customPartitioner); container.add(customPartitionerRow); // increaseParallelismRow = new Figure(); increaseParallelismRow.setLayoutManager(new RowLayout()); label = new Label(); label.setText("Increase Parallelism"); label.setLabelAlignment(PositionConstants.LEFT); compoundBorder = new CompoundBorder(new ColumnBorder(), new RowBorder(2, 5, 2, -1)); label.setBorder(compoundBorder); increaseParallelismRow.add(label); increaseParallelism = new TextCellLabel(); increaseParallelism.setDirectEditType(DirectEditType.INCREASE_PARALLELISM); increaseParallelism.setText(inputTable.getIncreaseParallelism()); increaseParallelism.setLabelAlignment(PositionConstants.LEFT); increaseParallelism.setBorder(new RowBorder(2, 5, 2, -1)); increaseParallelismRow.add(increaseParallelism); container.add(increaseParallelismRow); container.setOpaque(true); container.setBackgroundColor(ColorConstants.white); container.addMouseListener( new MouseListener() { Figure selectedFigure = null; @Override public void mousePressed(MouseEvent me) { boolean joinOptimization = joinOptimizationRow.containsPoint(me.x, me.y); if (joinOptimization) { if (selectedFigure != joinOptimizationRow) { joinOptimizationRow.setOpaque(true); joinOptimizationRow.setBackgroundColor( ColorProviderMapper.getColor(ColorInfo.COLOR_COLUMN_TREE_SETTING)); customPartitionerRow.setOpaque(false); joinModelRow.setOpaque(false); increaseParallelismRow.setOpaque(false); } return; } boolean customPartitioner = customPartitionerRow.containsPoint(me.x, me.y); if (customPartitioner) { if (selectedFigure != customPartitionerRow) { customPartitionerRow.setOpaque(true); customPartitionerRow.setBackgroundColor( ColorProviderMapper.getColor(ColorInfo.COLOR_COLUMN_TREE_SETTING)); joinOptimizationRow.setOpaque(false); joinModelRow.setOpaque(false); increaseParallelismRow.setOpaque(false); } return; } boolean joinModel = joinModelRow.containsPoint(me.x, me.y); if (joinModel) { if (selectedFigure != joinModelRow) { joinModelRow.setOpaque(true); joinModelRow.setBackgroundColor( ColorProviderMapper.getColor(ColorInfo.COLOR_COLUMN_TREE_SETTING)); joinOptimizationRow.setOpaque(false); customPartitionerRow.setOpaque(false); increaseParallelismRow.setOpaque(false); } return; } boolean increaseParallelism = increaseParallelismRow.containsPoint(me.x, me.y); if (increaseParallelism) { if (selectedFigure != increaseParallelismRow) { increaseParallelismRow.setOpaque(true); increaseParallelismRow.setBackgroundColor( ColorProviderMapper.getColor(ColorInfo.COLOR_COLUMN_TREE_SETTING)); joinOptimizationRow.setOpaque(false); customPartitionerRow.setOpaque(false); joinModelRow.setOpaque(false); } } } @Override public void mouseReleased(MouseEvent me) {} @Override public void mouseDoubleClicked(MouseEvent me) {} }); }
/* * (non-Javadoc) * * @see * de.tub.tfs.muvitor.gef.directedit.IDirectEditPart.IGraphicalDirectEditPart * #updateValueDisplay(java.lang.String) */ @Override public void updateValueDisplay(String value) { counterLabel.setText(value); }
/* * (non-Javadoc) * * @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals() */ @Override protected void refreshVisuals() { super.refreshVisuals(); counterLabel.setText(Integer.toString(getCastedModel().getCounter())); }
public void setLabel(String text) { labelControl.setText(text); }
public void refreshVisuals() { Label label = (Label) getFigure(); label.setText(((Task) getModel()).getName()); }
public void setName(String text) { name.setText(text); }
public void refreshTooltip() { tooltipFigure.setText(getTooltipString()); }
public void setConnName(String newName) { lblCnnName.setText(modifyString(newName)); if (newName == null || newName.trim().length() == 0) lblCnnName.setOpaque(false); else lblCnnName.setOpaque(true); }