private void createRoundArrow ( final Figure figure ) { final PolylineConnection c = new PolylineConnection (); c.setSourceAnchor ( new ChopboxAnchor ( this.sourceRect ) ); c.setTargetAnchor ( new ChopboxAnchor ( this.targetRect ) ); final PolygonDecoration dec = new PolygonDecoration (); dec.setTemplate ( PolygonDecoration.TRIANGLE_TIP ); c.setTargetDecoration ( dec ); final MidpointLocator typeLocator = new MidpointLocator ( c, 0 ); typeLocator.setRelativePosition ( PositionConstants.NORTH ); this.typeLabel = new Label ( "" ); //$NON-NLS-1$ c.add ( this.typeLabel, typeLocator ); figure.add ( c ); this.roundConnection = c; }
public TextController ( final FigureCanvas canvas, final SymbolController controller, final Text element, final ResourceManager manager ) { super ( controller, manager ); this.canvas = canvas; this.figure = new Label ( element.getText ()) { @Override public void addNotify () { super.addNotify (); start (); } @Override protected void paintFigure ( final Graphics graphics ) { final Double alpha = getAlpha (); if ( alpha != null ) { graphics.setAlpha ( (int) ( Math.max ( 0.0, Math.min ( 1.0, alpha ) ) * 255.0 ) ); } super.paintFigure ( graphics ); } @Override public void removeNotify () { stop (); super.removeNotify ( ); } }; controller.addElement ( element, this ); applyCommon ( element ); }
private void update() { removeAll(); valid = model.isMatrix(); if(valid) { Object[] array = (Object[]) model.getValues(); for(Object line : array) { int len = Array.getLength(line); for(int i = 0; i < len; i++) { Object e = Array.get(line, i); Label label = new Label(e.toString()); // TODO array deepToString label.setForegroundColor(ColorConstants.black); add(label); } } } getLayoutManager().layout(this); repaint(); }
private void update(IValueModel v, int value) { long n = Long.parseLong(v.getCurrentValue()); int nBits = 0; String bits = Long.toBinaryString(n); switch(v.getTypeName()) { case "byte": nBits = 8; break; case "short": nBits = 16; break; case "int": nBits = 32; break; case "long": nBits = 64; break; } while(bits.length() < nBits) bits = "0" + bits; label.setText(bits); label.setToolTip(new Label(v.getCurrentValue())); }
public AbstractNodeFigure(AbstractNodeElement node,Image icon){ this.node=node; BorderLayout layout=new BorderLayout(); this.setLayoutManager(layout); ImageFigure iconFigure=new ImageFigure(icon); this.add(iconFigure,BorderLayout.LEFT); this.label=new Label(this.node.getLabel()); this.label.setForegroundColor(ColorConstants.black); this.add(this.label,BorderLayout.CENTER); this.setAntialias(SWT.ON); RGB rgb=Activator.getPreference().getBorderColor(); this.setForegroundColor(new Color(null,rgb.red,rgb.green,rgb.blue)); rgb=Activator.getPreference().getBackgroundColor(); this.setBackgroundColor(new Color(null,rgb.red,rgb.green,rgb.blue)); this.setLineWidth(2); }
@Override protected IFigure createFigure() { final LineLayout layout = new LineLayout(); layout.setHorizontal(true); layout.setMajorAlignment(FlowLayout.ALIGN_TOPLEFT); layout.setMinorAlignment(FlowLayout.ALIGN_BOTTOMRIGHT); layout.setMinorSpacing(SPACING); layout.setMargin(MARGIN); FreeformLayer res = new FreeformLayer(); final Label toolTip = new Label(); toolTip.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT)); toolTip.setBackgroundColor(ColorConstants.tooltipBackground); toolTip.setForegroundColor(ColorConstants.tooltipForeground); toolTip.setText(getModel().getTimelineWindow().getProvider().getTextAt(getModel().getBranch())); res.setToolTip(toolTip); res.setLayoutManager(layout); return res; }
MethodWidget(IMethod method) { setLayoutManager(new FlowLayout()); button = new Button(shortSig(method)); button.setToolTip(new Label(longSig(method))); button.setForegroundColor(ColorConstants.black); FontManager.setFont(button, PandionJConstants.BUTTON_FONT_SIZE); button.setEnabled(methodsEnabled); add(button); resultLabel = new Label(); resultLabel.setForegroundColor(ColorConstants.black); add(resultLabel); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { invoke(model, method, resultLabel); } }); }
private IFigure createTargetValue () { this.targetRect = new RoundedRectangle (); this.targetRect.setLayoutManager ( new BorderLayout () ); this.targetRect.setBackgroundColor ( ColorConstants.lightGray ); this.targetRect.setForegroundColor ( ColorConstants.black ); this.targetRect.setBorder ( new MarginBorder ( 10 ) ); this.targetRect.add ( this.targetLabel = new Label (), BorderLayout.CENTER ); return this.targetRect; }
private IFigure createSourceValue () { this.sourceRect = new RoundedRectangle (); this.sourceRect.setLayoutManager ( new BorderLayout () ); this.sourceRect.setBackgroundColor ( ColorConstants.lightGray ); this.sourceRect.setForegroundColor ( ColorConstants.black ); this.sourceRect.setBorder ( new MarginBorder ( 10 ) ); this.sourceRect.add ( this.sourceLabel = new Label (), BorderLayout.CENTER ); return this.sourceRect; }
private IFigure createEntryGrid ( final Figure connLayer ) { final Figure figure = new Figure (); figure.setLayoutManager ( new GridLayout ( 1, false ) ); figure.add ( this.presetCeil = new Label ( "" ), new GridData ( GridData.CENTER, GridData.FILL, true, true ) ); //$NON-NLS-1$ figure.add ( this.presetHH = new Label ( "" ), new GridData ( GridData.CENTER, GridData.FILL, true, true ) ); //$NON-NLS-1$ figure.add ( this.presetH = new Label ( "" ), new GridData ( GridData.CENTER, GridData.FILL, true, true ) ); //$NON-NLS-1$ figure.add ( this.currentLabel = new Label ( "" ), new GridData ( GridData.CENTER, GridData.FILL, true, true ) ); //$NON-NLS-1$ figure.add ( this.presetL = new Label ( "" ), new GridData ( GridData.CENTER, GridData.FILL, true, true ) ); //$NON-NLS-1$ figure.add ( this.presetLL = new Label ( "" ), new GridData ( GridData.CENTER, GridData.FILL, true, true ) ); //$NON-NLS-1$ figure.add ( this.presetFloor = new Label ( "" ), new GridData ( GridData.CENTER, GridData.FILL, true, true ) ); //$NON-NLS-1$ createConnection ( connLayer, this.presetCeil, this.rectCeil ); createConnection ( connLayer, this.presetHH, this.triHH ); createConnection ( connLayer, this.presetH, this.triH ); createConnection ( connLayer, this.presetL, this.triL ); createConnection ( connLayer, this.presetLL, this.triLL ); createConnection ( connLayer, this.presetFloor, this.rectFloor ); this.blinkerCeil = new LevelBlinker ( this.rectCeil ); this.blinkerHH = new LevelBlinker ( this.triHH ); this.blinkerH = new LevelBlinker ( this.triH ); this.blinkerL = new LevelBlinker ( this.triL ); this.blinkerLL = new LevelBlinker ( this.triLL ); this.blinkerFloor = new LevelBlinker ( this.rectFloor ); this.stylerCeil = new StateStyler ( this.blinkerCeil ); this.stylerHH = new StateStyler ( this.blinkerHH ); this.stylerH = new StateStyler ( this.blinkerH ); this.stylerL = new StateStyler ( this.blinkerL ); this.stylerLL = new StateStyler ( this.blinkerLL ); this.stylerFloor = new StateStyler ( this.blinkerFloor ); return figure; }
private void createConnection ( final Figure connLayer, final Label label, final Figure figure ) { final Connection c = new PolylineConnection (); c.setSourceAnchor ( new ChopboxAnchor ( label ) ); c.setTargetAnchor ( new ChopboxAnchor ( figure ) ); c.setConnectionRouter ( new BendpointConnectionRouter () ); connLayer.add ( c ); }
private void setLabel ( final Label preset, final String string ) { final Number num = getPreset ( string ); if ( num != null ) { preset.setText ( String.format ( Messages.LevelPresets_NumFormat, num.toString () ) ); } else { preset.setText ( Messages.LevelPresets_EmtyNum ); } }
private IFigure createNaPanel () { final Figure naPanel = new Figure (); final BorderLayout layout = new BorderLayout (); naPanel.setLayoutManager ( layout ); final Label label = new Label (); label.setText ( Messages.AbstractBaseDraw2DDetailsPart_Label_NotAvail_Text ); naPanel.add ( label, BorderLayout.CENTER ); return naPanel; }
public NullFigure(IEntityModel model) { super(model); Label label = new Label(" "); label.setOpaque(false); label.setSize(-1,-1); label.setToolTip(new Label("null")); add(label); }
private void addChildFigures(IObjectModel m, String attName) { IArrayModel<?> array = m.getArray(attName); if(array != null) { IArrayWidgetExtension ext = getArrayExtension(array, tags.get(attName)); if(ext != IArrayWidgetExtension.NULL_EXTENSION) { IFigure f = ext.createFigure(array); f.setToolTip(new Label(attName)); figs.put(attName, f); compositeFig.add(f); } } }
@Override protected IFigure createFigure() { final LineLayout layout = new LineLayout(); layout.setHorizontal(false); layout.setMajorAlignment(FlowLayout.ALIGN_TOPLEFT); layout.setMinorAlignment(FlowLayout.ALIGN_TOPLEFT); layout.setMinorSpacing(SPACING); FreeformLayer res = new FreeformLayer(); res.setLayoutManager(layout); label = new Label(); res.add(label); return res; }
public Label getDisplay() { String dis = "Name : " + node.getName() + "\nOp Type : " + node.getType(); if (node.getType() != null && node.getType().equalsIgnoreCase(Enums.ModuleOperationTypes.REQUEST_SENT.name())) { dis += "\nIs Synchronous? : " + node.isSync() + "\nTimeout : " + node.getTimeout(); } if (node.getType() != null && node.getType().equalsIgnoreCase(Enums.ModuleOperationTypes.DATA_READ.name()) || node.getType() != null && node.getType().equalsIgnoreCase(Enums.ModuleOperationTypes.DATA_WRITE.name())) { dis += "\nData Type : " + node.getdType(); } display.setText(dis); return display; }
@Override public IFigure createFigure(IArrayModel<?> e) { Label label = new Label(); label.setBorder(new MarginBorder(5)); PandionJUI.setFont(label, 18); updateLabel(e, label); e.registerDisplayObserver((a) -> updateLabel(e, label)); return label; }
@Override public IFigure createFigure(IObjectModel e) { Label label = new Label("\"" + e.getStringValue() + "\""); FontManager.setFont(label, PandionJConstants.VALUE_FONT_SIZE); label.setForegroundColor(ColorConstants.black); return label; }
@Override public IFigure createFigure(IObjectModel e) { int value = e.getInt("value"); int r = (value >> 16) & 0xFF; int g = (value >> 8) & 0xFF; int b = (value >> 0) & 0xFF; Label label = new Label(r + ", " + g + ", " + b); label.setOpaque(true); label.setBackgroundColor(PandionJUI.getColor(r, g, b)); return label; }
@Override protected void refreshVisuals() { TransitionLabel transitionLabel = (TransitionLabel)getModel(); Label figure = (Label) getFigure(); figure.setText(transitionLabel.getText()); Point offset=transitionLabel.getOffset(); AbstractConnectionEditPart parent = (AbstractConnectionEditPart) getParent(); PolylineConnection connection = (PolylineConnection) parent.getFigure(); if(offset==null){ offset=this.calculateInitialOffset(connection); transitionLabel.setOffset(offset); } TransitionLabelLocator constraint = new TransitionLabelLocator(transitionLabel.getText(),offset,connection); parent.setLayoutConstraint(this, getFigure(), constraint); }
private void update(int value) { int r = (value >> 16) & 0xFF; int g = (value >> 8) & 0xFF; int b = (value >> 0) & 0xFF; label.setToolTip(new Label(r + ", " + g + ", " + b)); label.setBackgroundColor(PandionJUI.getColor(r, g, b)); }
/** * Clear record count from job canvas after rerun or refresh. */ public void clearRecordCountAtPort(){ List<Figure> labels = new ArrayList<>(); Connection connection = (Connection) getFigure(); for(Object figure:connection.getChildren()){ if(figure instanceof Label){ labels.add((Figure) figure); } } for (Figure label : labels) { connection.remove(label); } }
ColorFigure() { setLayoutManager(new GridLayout(2, false)); colorFig = new Figure(); colorFig.setSize(PandionJConstants.POSITION_WIDTH, PandionJConstants.POSITION_WIDTH); add(colorFig); text = new Label(); text.setForegroundColor(ColorConstants.black); add(text); }
@Override public IFigure createFigure(IObjectModel e) { Label label = new Label(); e.registerDisplayObserver(new ModelObserver<Object>() { @Override public void update(Object arg) { eval(e, label); } }); eval(e, label); return label; }
ValueLabel(String fixedValue, boolean isIndexLabel){ setText(fixedValue); setOpaque(!isIndexLabel); setPreferredSize(PandionJConstants.POSITION_WIDTH, PandionJConstants.POSITION_WIDTH); if(isIndexLabel){ FontManager.setFont(this, PandionJConstants.INDEX_FONT_SIZE); setLabelAlignment(SWT.CENTER); setForegroundColor(ColorConstants.gray); setToolTip(new Label(fixedValue)); }else{ FontManager.setFont(this, PandionJConstants.VALUE_FONT_SIZE); setBackgroundColor(ColorConstants.white); setBorder(new LineBorder(ColorConstants.black, PandionJConstants.ARRAY_LINE_WIDTH, SWT.LINE_SOLID)); } }
public ValueExtensionFigure(IValueModel model, IFigure figure) { super(model, false); layout = new GridLayout(1, false); layout.verticalSpacing = 0; layout.horizontalSpacing = 0; layout.marginHeight = 0; layout.marginWidth = 0; setLayoutManager(layout); Figure comp = new Figure(); GridLayout compLayout = new GridLayout(2,false); compLayout.marginHeight = 0; compLayout.marginWidth = 0; compLayout.horizontalSpacing = 3; compLayout.verticalSpacing = 0; comp.setLayoutManager(compLayout); String tooltip = Utils.getTooltip(model); Label nameLabel = new Label(model.getName()); nameLabel.setForegroundColor(ColorConstants.black); FontManager.setFont(nameLabel, PandionJConstants.VAR_FONT_SIZE); nameLabel.setToolTip(new Label(tooltip)); comp.add(nameLabel); comp.add(figure); add(comp); layout.setConstraint(comp, new GridData(SWT.RIGHT, SWT.DEFAULT, true, false)); }
@Override public IFigure getTooltip(Object entity) { if(entity instanceof Pointer) { if(((Pointer) entity).isTopLevel()) return new Label(""); else return new Label(((Pointer) entity).reference.getName()); } else return new Label(entity.toString()); }
@Override public IFigure createFigure(IValueModel v) { label = new Label(""); label.setOpaque(true); label.setBackgroundColor(ColorConstants.white); label.setBorder(new LineBorder(1)); label.setFont(PandionJUI.getFont(14)); update(v, Integer.parseInt(v.getCurrentValue())); v.registerDisplayObserver((value) -> { update(v, Integer.parseInt(v.getCurrentValue())); }); return label; }
@Override public IFigure createFigure(IValueModel v) { label = new Label(" "); label.setOpaque(true); label.setPreferredSize(PandionJConstants.POSITION_WIDTH, PandionJConstants.POSITION_WIDTH); update(Integer.parseInt(v.getCurrentValue())); v.registerDisplayObserver((value) -> { update(Integer.parseInt(v.getCurrentValue())); }); return label; }
private void updateLook(IStackFrameModel model, boolean termination) { if(!invisible) { if(model.isObsolete() || termination) { setBackgroundColor(PandionJConstants.Colors.OBSOLETE); setBorder(new LineBorder(model.exceptionOccurred() ? PandionJConstants.Colors.ERROR : ColorConstants.lightGray, 2, SWT.LINE_DASH)); } else if(model.exceptionOccurred()) { setBackgroundColor(PandionJConstants.Colors.INST_POINTER); setBorder(new LineBorder(PandionJConstants.Colors.ERROR, PandionJConstants.STACKFRAME_LINE_WIDTH, SWT.LINE_DASH)); if(model.getExceptionType().equals(NullPointerException.class.getName())) paintNullRefs(); Label labelExc = new Label(PandionJConstants.Messages.prettyException(model.getExceptionType())); labelExc.setForegroundColor(PandionJConstants.Colors.ERROR); setToolTip(labelExc); } else if(model.isExecutionFrame()) setBackgroundColor(PandionJConstants.Colors.INST_POINTER); else setBackgroundColor(PandionJConstants.Colors.VIEW_BACKGROUND); } layout.layout(this); if(label != null && frame.getSourceFile() != null && frame.getLineNumber() != -1) label.setToolTip(new Label(frame.getSourceFile().getName() + " (line " + frame.getLineNumber() +")")); }
@SuppressWarnings("unchecked") @Override protected List<Figure> createSelectionHandles() { List<Figure> list=super.createSelectionHandles(); List<IFigure> figures=this.getHostFigure().getChildren(); for(IFigure figure:figures){ if(figure instanceof Label){ list.add(new MoveHandle((GraphicalEditPart)this.getHost(),new MoveHandleLocator(figure))); } } return list; }
private void invokeToString(IObjectModel e, Label label) { e.invoke("toString", new InvocationResult() { public void valueReturn(Object o) { PandionJUI.executeUpdate(() -> { label.setText(o == null ? "null" : ((IObjectModel) o).getStringValue()); }); } }); }
protected void createLayout () { setLayoutManager(new XYLayout()); setBackgroundColor(Activator.getStartVertexImageColor()); setOpaque(true); this.setBorder(null); ellipse = new Ellipse(); add(ellipse); name = new Label(""); add(name); }
private RoundedRectangle createPositionsFig() { RoundedRectangle fig = new RoundedRectangle(); fig.setOpaque(false); fig.setCornerDimensions(PandionJConstants.OBJECT_CORNER); fig.setBackgroundColor(PandionJConstants.Colors.OBJECT); GridLayout layout = new GridLayout(horizontal ? (model.getLength() > PandionJView.getMaxArrayLength() ? N + 1 : Math.max(1, N)) : 1, false); layout.verticalSpacing = 0; layout.horizontalSpacing = PandionJConstants.ARRAY_POSITION_SPACING; layout.marginWidth = PandionJConstants.ARRAY_MARGIN; layout.marginHeight = PandionJConstants.ARRAY_MARGIN; fig.setLayoutManager(layout); fig.setToolTip(new Label("length = " + model.getLength())); if(N == 0) { Label empty = new Label(""); GridData layoutData = new GridData(POSITION_WIDTH/2, POSITION_WIDTH); layout.setConstraint(empty, layoutData); fig.add(empty); } else { Iterator<Integer> it = model.getValidModelIndexes(); while(it.hasNext()) { Integer i = it.next(); if(!it.hasNext() && model.getLength() > PandionJView.getMaxArrayLength()) { Position emptyPosition = new Position(null); fig.add(emptyPosition); } Position p = new Position(i); fig.add(p); positions.add(p); } } return fig; }
private void updateLabel(IArrayModel<?> e, Label label) { String text = "\""; char[] chars = (char[]) e.getValues(); for(char c : chars) text += c; text += "\""; label.setText(text); }
public GuardFigure() { ToolbarLayout layout = new ToolbarLayout(); layout.setHorizontal(true); layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT); layout.setStretchMinorAxis(false); layout.setSpacing(0); setLayoutManager(layout); setBorder(null); lguarded = new Label("", PreferenceManager.getImageGuardScripted()); add(lguarded); }
public void setException ( final Throwable e ) { setText ( String.format ( "%s", e ) ); setToolTip ( new Label ( formatException ( e ) ) ); }
public Controller create ( final SymbolController controller, final Primitive element ) throws Exception { if ( element == null ) { logger.info ( "Empty element found" ); return new Controller () { @Override public IFigure getFigure () { return new Label ( "" ); } }; } if ( element instanceof XYContainer ) { return new XYContainerController ( controller, (XYContainer)element, this ); } else if ( element instanceof Text ) { return new TextController ( this.canvas, controller, (Text)element, this.manager ); } else if ( element instanceof Line ) { return new LineController ( controller, (Line)element, this.manager ); } else if ( element instanceof Polygon ) { return new PolygonController ( controller, (Polygon)element, this.manager ); } else if ( element instanceof Arc ) { return new ArcController ( controller, (Arc)element, this.manager ); } else if ( element instanceof SymbolReference ) { final XMISymbolLoader subLoader = load ( ( (SymbolReference)element ).getUri () ); return new SymbolReferenceController ( controller, (SymbolReference)element, createSubFactory ( subLoader ), this.manager, this.factoryContext ); } else if ( element instanceof Rectangle ) { return new RectangleController ( controller, (Rectangle)element, this.manager ); } else if ( element instanceof RoundedRectangle ) { return new RoundedRectangleController ( controller, (RoundedRectangle)element, this.manager ); } else if ( element instanceof Ellipse ) { return new EllipseController ( controller, (Ellipse)element, this.manager ); } else if ( element instanceof GridContainer ) { return new GridContainerController ( controller, (GridContainer)element, this ); } else if ( element instanceof BorderContainer ) { return new BorderContainerController ( controller, (BorderContainer)element, this ); } else if ( element instanceof FigureContainer ) { return new FigureContainerController ( controller, (FigureContainer)element, this.manager, this ); } else if ( element instanceof StackContainer ) { return new StackContainerController ( controller, (StackContainer)element, this ); } else if ( element instanceof Image ) { return new ImageController ( this.canvas, controller, (Image)element, this.symbolLoader, this.manager, this.factoryContext ); } final ViewElementFactory factory = Activator.createFactory ( element ); if ( factory != null ) { return factory.create ( controller, element, this.symbolLoader, this.manager, this, this.factoryContext ); } throw new IllegalArgumentException ( String.format ( "Element type %s is unknown", element.eClass ().getName () ) ); }