Java Code Examples for org.netbeans.api.visual.widget.Widget#addChild()
The following examples show how to use
org.netbeans.api.visual.widget.Widget#addChild() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OutputWidget.java From netbeans with Apache License 2.0 | 6 votes |
private void createContent() { headerLabelWidget = new ImageLabelWidget(getScene(), getIcon(), getTitle()); headerLabelWidget.setLabelFont(getScene().getFont().deriveFont(Font.BOLD)); getHeaderWidget().addChild(new Widget(getScene()),5); getHeaderWidget().addChild(headerLabelWidget); getHeaderWidget().addChild(new Widget(getScene()),4); buttons = new Widget(getScene()); buttons.setLayout(LayoutFactory.createHorizontalFlowLayout( LayoutFactory.SerialAlignment.CENTER, 8)); buttons.addChild(getExpanderWidget()); getHeaderWidget().addChild(buttons); LabelWidget returnWidget = new LabelWidget(getScene(), method.isOneWay()? NbBundle.getMessage(OperationWidget.class, "LBL_ReturnTypeNone"): NbBundle.getMessage(OperationWidget.class, "LBL_ReturnType", method.getResult().getResultType())); returnWidget.setAlignment(LabelWidget.Alignment.CENTER); getContentWidget().addChild(returnWidget); }
Example 2
Source File: TableWidget.java From netbeans with Apache License 2.0 | 6 votes |
private void createTableHeader() { Scene scene = getScene(); int noCols = model.getColumnCount(); Widget headerWidget = new RowWidget(scene,noCols,null); addChild(headerWidget); for (int i = 0; i<noCols;i++) { LabelWidget columnHeader = new LabelWidget(scene, model.getColumnName(i)); if(i!=0) { columnHeader.setBorder(new LineBorder(0, 1, 0, 0, BORDER_COLOR)); } columnHeader.setAlignment(LabelWidget.Alignment.CENTER); columnHeader.setBackground(HEADER_COLOR); columnHeader.setOpaque(true); headerWidget.addChild(columnHeader); } }
Example 3
Source File: FaultsWidget.java From netbeans with Apache License 2.0 | 6 votes |
private void createContent() { model = new FaultsTableModel(method); populateContentWidget(getContentWidget()); getContentWidget().setBorder(BorderFactory.createEmptyBorder(0,1,1,1)); headerLabelWidget = new ImageLabelWidget(getScene(), getIcon(), getTitle(), "("+method.getFaults().size()+")"); headerLabelWidget.setLabelFont(getScene().getFont().deriveFont(Font.BOLD)); getHeaderWidget().addChild(new Widget(getScene()),5); getHeaderWidget().addChild(headerLabelWidget); getHeaderWidget().addChild(new Widget(getScene()),4); buttons = new Widget(getScene()); buttons.setLayout(LayoutFactory.createHorizontalFlowLayout( LayoutFactory.SerialAlignment.CENTER, 8)); buttons.addChild(getExpanderWidget()); getHeaderWidget().addChild(buttons); }
Example 4
Source File: ParametersWidget.java From netbeans with Apache License 2.0 | 6 votes |
private void createContent() { model = new ParametersTableModel(method, nameEditable); populateContentWidget(getContentWidget()); getContentWidget().setBorder(BorderFactory.createEmptyBorder(0,1,1,1)); headerLabelWidget = new ImageLabelWidget(getScene(), getIcon(), getTitle(), "("+method.getParams().size()+")"); headerLabelWidget.setLabelFont(getScene().getFont().deriveFont(Font.BOLD)); getHeaderWidget().addChild(new Widget(getScene()),5); getHeaderWidget().addChild(headerLabelWidget); getHeaderWidget().addChild(new Widget(getScene()),4); buttons = new Widget(getScene()); buttons.setLayout(LayoutFactory.createHorizontalFlowLayout( LayoutFactory.SerialAlignment.CENTER, 8)); buttons.addChild(getExpanderWidget()); buttons.setOpaque(true); buttons.setBackground(TITLE_COLOR_BRIGHT); getHeaderWidget().addChild(buttons); }
Example 5
Source File: FlowLayout105400Test.java From netbeans with Apache License 2.0 | 5 votes |
public void testFlowLayoutInsets () { Scene scene = new Scene (); Widget parent = new Widget (scene); parent.setBorder (BorderFactory.createResizeBorder (10)); parent.setLayout (LayoutFactory.createVerticalFlowLayout ()); scene.addChild (parent); Widget child = new Widget (scene); child.setBackground (Color.BLUE); child.setOpaque (true); child.setPreferredBounds (new Rectangle (-50, -30, 30, 20)); parent.addChild (child); assertScene (scene, Color.WHITE, new Rectangle (-1, -1, 52, 42)); }
Example 6
Source File: FlowLayoutWeightOverflow108052Test.java From netbeans with Apache License 2.0 | 5 votes |
public void testFlowLayoutWeightOverflow () { Scene scene = new Scene (); LayerWidget layer = new LayerWidget (scene); layer.setMinimumSize (new Dimension (300, 200)); scene.addChild (layer); Widget vbox = new Widget (scene); vbox.setBorder (BorderFactory.createLineBorder (1, Color.BLACK)); vbox.setLayout (LayoutFactory.createVerticalFlowLayout (LayoutFactory.SerialAlignment.JUSTIFY, 0)); layer.addChild (vbox); Widget hbox1 = new Widget (scene); hbox1.setBorder (BorderFactory.createLineBorder (1, Color.BLUE)); hbox1.setLayout (LayoutFactory.createHorizontalFlowLayout ()); vbox.addChild (hbox1); Widget item1 = new LabelWidget (scene, "Item1"); item1.setBorder (BorderFactory.createLineBorder (1, Color.GREEN)); hbox1.addChild (item1); Widget item2 = new LabelWidget (scene, "Item2"); item2.setBorder (BorderFactory.createLineBorder (1, Color.YELLOW)); hbox1.addChild (item2, 1000); Widget item3 = new LabelWidget (scene, "Item3"); item3.setBorder (BorderFactory.createLineBorder (1, Color.RED)); hbox1.addChild (item3); Widget hbox2 = new Widget (scene); hbox2.setBorder (BorderFactory.createLineBorder (1, Color.BLUE)); hbox2.setPreferredSize (new Dimension (200, 20)); vbox.addChild (hbox2); Color color = (Color) (new DefaultLookFeel()).getBackground(); assertScene (scene, color, new Rectangle (-5, -5, 210, 100)); }
Example 7
Source File: WsitWidget.java From netbeans with Apache License 2.0 | 5 votes |
private void createContent() { headerLabelWidget = new ImageLabelWidget(getScene(), null, NbBundle.getMessage(WsitWidget.class, "LBL_Wsit")); headerLabelWidget.setLabelFont(getScene().getFont().deriveFont(Font.BOLD)); getHeaderWidget().addChild(headerLabelWidget); getHeaderWidget().addChild(new Widget(getScene()),1); buttons = new Widget(getScene()); buttons.setLayout(LayoutFactory.createHorizontalFlowLayout( LayoutFactory.SerialAlignment.JUSTIFY, 8)); buttons.addChild(getExpanderWidget()); getHeaderWidget().addChild(buttons); getContentWidget().setBorder(BorderFactory.createEmptyBorder(RADIUS)); configButtons = new Widget(getScene()); configButtons.setLayout(LayoutFactory.createVerticalFlowLayout( LayoutFactory.SerialAlignment.LEFT_TOP, RADIUS)); getContentWidget().addChild(configButtons); populateConfigWidget(); Widget advancedButtonContainer = new Widget(getScene()); advancedButtonContainer.setLayout(LayoutFactory.createVerticalFlowLayout( LayoutFactory.SerialAlignment.RIGHT_BOTTOM, RADIUS)); advancedButton = new ButtonWidget(getScene(), new AdvancedAction(service,implementationClass)); advancedButton.setOpaque(true); advancedButton.setRoundedBorder(ButtonWidget.BORDER_RADIUS, 4, 0, null); advancedButtonContainer.addChild(advancedButton); getContentWidget().addChild(advancedButtonContainer); }
Example 8
Source File: SampleMessageWidget.java From netbeans with Apache License 2.0 | 5 votes |
/** * Creates a new instance of SampleMessageWidget * @param scene * @param operation * @param type */ public SampleMessageWidget(ObjectScene scene, MethodModel operation, Type type) { super(scene,0,12,0,TITLE_COLOR); this.operation = operation; this.type = type; headerLabelWidget = new ImageLabelWidget(scene, null, operation.getOperationName()+": ",type.getTitle()); headerLabelWidget.setLabelFont(scene.getFont().deriveFont(Font.BOLD)); headerLabelWidget.setPaintAsDisabled(false); headerLabelWidget.setLabelForeground(type.getBorderColor()); getHeaderWidget().addChild(new Widget(getScene()),1); getHeaderWidget().addChild(headerLabelWidget); getHeaderWidget().addChild(new Widget(getScene()),1); buttons = new Widget(getScene()); buttons.setLayout(LayoutFactory.createHorizontalFlowLayout( LayoutFactory.SerialAlignment.JUSTIFY, 8)); getHeaderWidget().addChild(buttons); final ButtonWidget closeButton = new ButtonWidget(getScene(), (String)null); closeButton.setImage(new ExpanderImageWidget(scene,type.getBorderColor(),8)); closeButton.setRoundedBorder(0, 4, 4,type.getBorderColor()); closeButton.setAction(new AbstractAction() { public void actionPerformed(ActionEvent arg0) { SampleMessageWidget.this.removeFromParent(); } }); buttons.addChild(closeButton); paneWidget = new EditorPaneWidget(scene, Utils.getFormatedDocument(type.getMessage(operation)),"text/xml"); paneWidget.setEditable(false); getContentWidget().addChild(paneWidget); getContentWidget().setBorder(BorderFactory.createEmptyBorder(12, 6)); }
Example 9
Source File: DescriptionWidget.java From netbeans with Apache License 2.0 | 5 votes |
private void createContent() { populateContentWidget(getContentWidget()); headerLabelWidget = new ImageLabelWidget(getScene(), getIcon(), getTitle()); headerLabelWidget.setLabelFont(getScene().getFont().deriveFont(Font.BOLD)); getHeaderWidget().addChild(new Widget(getScene()),5); getHeaderWidget().addChild(headerLabelWidget); getHeaderWidget().addChild(new Widget(getScene()),4); buttons = new Widget(getScene()); buttons.setLayout(LayoutFactory.createHorizontalFlowLayout( LayoutFactory.SerialAlignment.CENTER, 8)); buttons.addChild(getExpanderWidget()); getHeaderWidget().addChild(buttons); }
Example 10
Source File: DescriptionWidget.java From netbeans with Apache License 2.0 | 5 votes |
private void populateContentWidget(Widget parentWidget) { EditorPaneWidget descPaneWidget = new EditorPaneWidget(getScene(),model.getText(),"text/java"); descPaneWidget.setBorder(BorderFactory.createEmptyBorder(1)); descPaneWidget.setEditable(true); descPaneWidget.addDocumentListener(listener); parentWidget.addChild(descPaneWidget); }
Example 11
Source File: FaultsWidget.java From netbeans with Apache License 2.0 | 5 votes |
private void populateContentWidget(Widget parentWidget) { if(model.getRowCount()>0) { faultTable = new TableWidget(getScene(),model); parentWidget.addChild(faultTable); } else { LabelWidget noFaults = new LabelWidget(getScene(), NbBundle.getMessage(OperationWidget.class, "LBL_FaultsNone")); noFaults.setAlignment(LabelWidget.Alignment.CENTER); parentWidget.addChild(noFaults); } }
Example 12
Source File: ParametersWidget.java From netbeans with Apache License 2.0 | 5 votes |
private void populateContentWidget(Widget parentWidget) { if(model.getRowCount()>0) { parameterTable = new TableWidget(getScene(),model); parentWidget.addChild(parameterTable); } else { LabelWidget noParamsWidget = new LabelWidget(getScene(), NbBundle.getMessage(OperationWidget.class, "LBL_InputNone")); noParamsWidget.setAlignment(LabelWidget.Alignment.CENTER); parentWidget.addChild(noParamsWidget); } }
Example 13
Source File: OperationsWidget.java From netbeans with Apache License 2.0 | 5 votes |
private void createContent(ProjectService service) { if (serviceModel==null) { return; } headerLabelWidget = new ImageLabelWidget(getScene(), null, NbBundle.getMessage(OperationWidget.class, "LBL_Operations")); headerLabelWidget.setLabelFont(getScene().getFont().deriveFont(Font.BOLD)); getHeaderWidget().addChild(headerLabelWidget); getHeaderWidget().addChild(new Widget(getScene()),1); updateHeaderLabel(); buttons = new Widget(getScene()); buttons.setLayout(LayoutFactory.createHorizontalFlowLayout( LayoutFactory.SerialAlignment.CENTER, 8)); ButtonWidget addButton = new ButtonWidget(getScene(), addAction); addButton.setOpaque(true); addButton.setRoundedBorder(addButton.BORDER_RADIUS, 4, 0, null); removeAction = new RemoveOperationAction(service); ButtonWidget removeButton = new ButtonWidget(getScene(), removeAction); removeButton.setOpaque(true); removeButton.setRoundedBorder(removeButton.BORDER_RADIUS, 4, 0, null); buttons.addChild(addButton); buttons.addChild(removeButton); buttons.addChild(getExpanderWidget()); getHeaderWidget().addChild(buttons); getContentWidget().setBorder(BorderFactory.createEmptyBorder(RADIUS)); if(serviceModel.getOperations()!=null) { for(MethodModel operation:serviceModel.getOperations()) { OperationWidget operationWidget = new OperationWidget(getObjectScene(), serviceModel, service, operation); getContentWidget().addChild(operationWidget); } } }
Example 14
Source File: SlotWidget.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public SlotWidget(Slot slot, DiagramScene scene, Widget parent, FigureWidget fw) { super(scene); this.diagramScene = scene; this.slot = slot; figureWidget = fw; this.setToolTipText("<HTML>" + slot.getToolTipText() + "</HTML>"); this.setCheckClipping(true); parent.addChild(this); //this.setPreferredBounds(this.calculateClientArea()); }
Example 15
Source File: NodeWidget.java From netbeans with Apache License 2.0 | 4 votes |
@Messages("ACT_FixVersionConflict=Fix Version Conflict...") private void initContent (DependencyGraphScene scene, GraphNodeImplementation impl, Icon icon) { contentW = new LevelOfDetailsWidget(scene, 0.05, 0.1, Double.MAX_VALUE, Double.MAX_VALUE); contentW.setBorder(BorderFactory.createLineBorder(10)); contentW.setLayout(LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.JUSTIFY, 1)); //Artifact name (with optional project icon on the left) nodeW = new IconNodeWidget(scene, TextOrientation.RIGHT_CENTER); nodeW.setLabel(node.getImpl().getQualifiedName() + " "); if (null != icon) { nodeW.setImage(ImageUtilities.icon2Image(icon)); } nodeW.getLabelWidget().setUseGlyphVector(true); if (node.isRoot()) { Font defF = scene.getDefaultFont(); nodeW.getLabelWidget().setFont(defF.deriveFont(Font.BOLD, defF.getSize() + 3f)); } contentW.addChild(nodeW); if(getDependencyGraphScene().supportsVersions()) { Widget versionDetW = new LevelOfDetailsWidget(scene, 0.5, 0.7, Double.MAX_VALUE, Double.MAX_VALUE); versionDetW.setLayout(LayoutFactory.createHorizontalFlowLayout(LayoutFactory.SerialAlignment.CENTER, 2)); contentW.addChild(versionDetW); versionW = new LabelWidget(scene); versionW.setLabel(scene.getVersion(node.getImpl())); versionW.setUseGlyphVector(true); int mngState = node.getManagedState(); if (mngState != GraphNode.UNMANAGED) { lockW = new ImageWidget(scene, mngState == GraphNode.MANAGED ? ImageUtilities.loadImage(LOCK_ICON) : ImageUtilities.loadImage(LOCK_BROKEN_ICON)); } versionDetW.addChild(versionW); if (lockW != null) { versionDetW.addChild(lockW); } } // fix hint if (fixConflictAction != null) { Widget rootW = new Widget(scene); rootW.setLayout(LayoutFactory.createOverlayLayout()); fixHintW = new ImageWidget(scene, ImageUtilities.loadImage(BULB_ICON)); fixHintW.setVisible(false); fixHintW.setToolTipText(ACT_FixVersionConflict()); fixHintW.getActions().addAction(sceneHoverActionAction); fixHintW.getActions().addAction(fixConflictAction); Widget panelW = new Widget(scene); panelW.setLayout(LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.LEFT_TOP, 0)); panelW.setBorder(BorderFactory.createEmptyBorder(0, 3)); panelW.addChild(fixHintW); rootW.addChild(panelW); rootW.addChild(contentW); addChild(rootW); } else { addChild(contentW); } }
Example 16
Source File: DesignView.java From netbeans with Apache License 2.0 | 4 votes |
/** * Creates a new instance of GraphView. * @param service * @param implementationClass */ public DesignView(ProjectService service, FileObject implementationClass) { super(new BorderLayout()); this.service = service; this.implementationClass = implementationClass; scene = new ObjectScene() { @Override /** * Use our own traversal policy */ public Comparable<DesignerWidgetIdentityCode> getIdentityCode(Object object) { return new DesignerWidgetIdentityCode(scene,object); } }; zoomer = new ZoomManager(scene); scene.getActions().addAction(ActionFactory.createCycleObjectSceneFocusAction()); scene.setKeyEventProcessingType (EventProcessingType.FOCUSED_WIDGET_AND_ITS_PARENTS); mainLayer = new LayerWidget(scene); mainLayer.setPreferredLocation(new Point(0, 0)); mainLayer.setLayout(LayoutFactory.createVerticalFlowLayout( LayoutFactory.SerialAlignment.JUSTIFY, 12)); scene.addChild(mainLayer); mainWidget = new Widget(scene); mainWidget.setLayout(LayoutFactory.createVerticalFlowLayout( LayoutFactory.SerialAlignment.JUSTIFY, 12)); headerWidget = new LabelWidget(scene); headerWidget.setFont(scene.getFont().deriveFont(Font.BOLD)); headerWidget.setForeground(Color.GRAY); headerWidget.setBorder(BorderFactory.createEmptyBorder(6,28,0,0)); mainWidget.addChild(headerWidget); separatorWidget = new SeparatorWidget(scene, SeparatorWidget.Orientation.HORIZONTAL); separatorWidget.setForeground(Color.ORANGE); mainWidget.addChild(separatorWidget); contentWidget = new Widget(scene); contentWidget.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); contentWidget.setLayout(LayoutFactory.createVerticalFlowLayout( LayoutFactory.SerialAlignment.JUSTIFY, 16)); mainWidget.addChild(contentWidget); JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER){ /* (non-Javadoc) * @see java.awt.FlowLayout#layoutContainer(java.awt.Container) */ @Override public void layoutContainer( Container target ) { super.layoutContainer(target); Component[] components = target.getComponents(); double height = target.getSize().getHeight()/2; for (Component component : components) { Point location = component.getLocation(); component.setLocation( (int)location.getX(), (int)height ); } } }); panel.add(new JLabel(NbBundle.getMessage( DesignView.class, "LBL_Wait"))); add( panel,BorderLayout.CENTER); mainLayer.addChild(mainWidget); messageWidget = new Widget(scene); messageWidget.setLayout(LayoutFactory.createVerticalFlowLayout( LayoutFactory.SerialAlignment.JUSTIFY, 4)); mainLayer.addChild(messageWidget); scene.addObject(messageLayerKey, messageWidget); initServiceModel(); }