org.netbeans.api.visual.layout.LayoutFactory Java Examples

The following examples show how to use org.netbeans.api.visual.layout.LayoutFactory. 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: RuleScene.java    From jlibs with Apache License 2.0 6 votes vote down vote up
@Override
protected Widget attachEdgeWidget(Edge edge){
    EdgeWidget connection = new EdgeWidget(this);
    connection.setStroke(Util.STROKE_2);
    connection.setTargetAnchorShape(AnchorShape.TRIANGLE_FILLED);

    LabelWidget label = createEdgeLabel(edge);
    connection.setConstraint(label, LayoutFactory.ConnectionWidgetLayoutAlignment.TOP_CENTER, 0.5f);

    connection.addChild(label);
    connections.addChild(connection);

    connection.setRouter(router);
    connection.highLight(false);
    
    connection.getActions().addAction(hoverAction);
    connection.getActions().addAction(editAction);
    connection.getActions().addAction(edgePopupAction);
    return connection;
}
 
Example #2
Source File: ControlFlowScene.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public ControlFlowScene() {
    selection = new HashSet<BlockWidget>();

    this.getInputBindings().setZoomActionModifiers(0);
    this.setLayout(LayoutFactory.createAbsoluteLayout());

    mainLayer = new LayerWidget(this);
    this.addChild(mainLayer);

    edgeLayer = new LayerWidget(this);
    this.addChild(edgeLayer);

    selectLayer = new LayerWidget(this);
    this.addChild(selectLayer);

    this.getActions().addAction(hoverAction);
    this.getActions().addAction(selectAction);
    this.getActions().addAction(ActionFactory.createRectangularSelectAction(this, selectLayer, this));
    this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
}
 
Example #3
Source File: ControlFlowScene.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public ControlFlowScene() {
    selection = new HashSet<BlockWidget>();

    this.getInputBindings().setZoomActionModifiers(0);
    this.setLayout(LayoutFactory.createAbsoluteLayout());

    mainLayer = new LayerWidget(this);
    this.addChild(mainLayer);

    edgeLayer = new LayerWidget(this);
    this.addChild(edgeLayer);

    selectLayer = new LayerWidget(this);
    this.addChild(selectLayer);

    this.getActions().addAction(hoverAction);
    this.getActions().addAction(selectAction);
    this.getActions().addAction(ActionFactory.createRectangularSelectAction(this, selectLayer, this));
    this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
}
 
Example #4
Source File: ControlFlowScene.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public ControlFlowScene() {
    selection = new HashSet<BlockWidget>();

    this.getInputBindings().setZoomActionModifiers(0);
    this.setLayout(LayoutFactory.createAbsoluteLayout());

    mainLayer = new LayerWidget(this);
    this.addChild(mainLayer);

    edgeLayer = new LayerWidget(this);
    this.addChild(edgeLayer);

    selectLayer = new LayerWidget(this);
    this.addChild(selectLayer);

    this.getActions().addAction(hoverAction);
    this.getActions().addAction(selectAction);
    this.getActions().addAction(ActionFactory.createRectangularSelectAction(this, selectLayer, this));
    this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
}
 
Example #5
Source File: ControlFlowScene.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public ControlFlowScene() {
    selection = new HashSet<BlockWidget>();

    this.getInputBindings().setZoomActionModifiers(0);
    this.setLayout(LayoutFactory.createAbsoluteLayout());

    mainLayer = new LayerWidget(this);
    this.addChild(mainLayer);

    edgeLayer = new LayerWidget(this);
    this.addChild(edgeLayer);

    selectLayer = new LayerWidget(this);
    this.addChild(selectLayer);

    this.getActions().addAction(hoverAction);
    this.getActions().addAction(selectAction);
    this.getActions().addAction(ActionFactory.createRectangularSelectAction(this, selectLayer, this));
    this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
}
 
Example #6
Source File: ControlFlowScene.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public ControlFlowScene() {
    selection = new HashSet<BlockWidget>();

    this.getInputBindings().setZoomActionModifiers(0);
    this.setLayout(LayoutFactory.createAbsoluteLayout());

    mainLayer = new LayerWidget(this);
    this.addChild(mainLayer);

    edgeLayer = new LayerWidget(this);
    this.addChild(edgeLayer);

    selectLayer = new LayerWidget(this);
    this.addChild(selectLayer);

    this.getActions().addAction(hoverAction);
    this.getActions().addAction(selectAction);
    this.getActions().addAction(ActionFactory.createRectangularSelectAction(this, selectLayer, this));
    this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
}
 
Example #7
Source File: IconNodeWidget.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Creates an icon node widget with a specified orientation.
 * @param scene the scene
 * @param orientation the text orientation
 */
public IconNodeWidget (Scene scene, TextOrientation orientation) {
    super (scene);
    LookFeel lookFeel = getScene ().getLookFeel ();

    switch (orientation) {
        case BOTTOM_CENTER:
            setLayout (LayoutFactory.createVerticalFlowLayout (LayoutFactory.SerialAlignment.CENTER, - lookFeel.getMargin () + 1));
            break;
        case RIGHT_CENTER:
            setLayout (LayoutFactory.createHorizontalFlowLayout (LayoutFactory.SerialAlignment.CENTER, - lookFeel.getMargin () + 1));
            break;
    }

    imageWidget = new ImageWidget (scene);
    addChild (imageWidget);

    labelWidget = new LabelWidget (scene);
    labelWidget.setFont (scene.getDefaultFont ().deriveFont (14.0f));
    addChild (labelWidget);

    setState (ObjectState.createNormal ());
}
 
Example #8
Source File: ListWidget.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a list widget.
 * @param scene the scene
 */
public ListWidget (Scene scene) {
    super (scene);
    GeomUtil.LOG.warning ("org.netbeans.api.visual.widget.general.ListWidget class is deprecated. Use org.netbeans.modules.visual.experimental.widget.general.ListWidget class instead. Since it is an experimental class outside of public-API packages, you have to set an implementation dependency on the org.netbeans.api.visual module."); // NOI18N

    LookFeel lookFeel = scene.getLookFeel ();
    setOpaque (true);
    setBackground (lookFeel.getBackground ());
    setBorder (BorderFactory.createLineBorder ());
    setLayout (LayoutFactory.createVerticalFlowLayout ());

    header = new Widget (scene);
    header.setLayout (LayoutFactory.createHorizontalFlowLayout (LayoutFactory.SerialAlignment.CENTER, 0));
    header.addChild (imageWidget = new ImageWidget (scene));
    header.addChild (labelWidget = new LabelWidget (scene));
    addChild (header);

    addChild (new SeparatorWidget (scene, SeparatorWidget.Orientation.HORIZONTAL));

    setState (ObjectState.createNormal ());
}
 
Example #9
Source File: VMDGraphScene.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a VMD graph scene with a specific color scheme.
 * @param scheme the color scheme
 */
public VMDGraphScene (VMDColorScheme scheme) {
    this.scheme = scheme;
    setKeyEventProcessingType (EventProcessingType.FOCUSED_WIDGET_AND_ITS_PARENTS);

    addChild (backgroundLayer);
    addChild (mainLayer);
    addChild (connectionLayer);
    addChild (upperLayer);

    router = RouterFactory.createOrthogonalSearchRouter (mainLayer, connectionLayer);

    getActions ().addAction (ActionFactory.createZoomAction ());
    getActions ().addAction (ActionFactory.createPanAction ());
    getActions ().addAction (ActionFactory.createRectangularSelectAction (this, backgroundLayer));

    sceneLayout = LayoutFactory.createSceneGraphLayout (this, new GridGraphLayout<String, String> ().setChecker (true));
}
 
Example #10
Source File: OutputWidget.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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 #11
Source File: DB_VMDGraph.java    From BART with MIT License 6 votes vote down vote up
private void createAttribute(String table , Attribute attribute)   {
    VMDPinWidget attributeWidget = (VMDPinWidget)scene.addPin(table,table+attribute.getName());
    attributeWidget.setPinName(attribute.getName());
    attributeWidget.setToolTipText("Double click for View Table data");
    attributeWidget.setLayout(LayoutFactory.createHorizontalFlowLayout(
                                LayoutFactory.SerialAlignment.JUSTIFY, 7));
    
    LabelWidget type = new LabelWidget(scene);
    type.setForeground(Color.GRAY);
    type.setLabel(attribute.getType());
    attributeWidget.addChild(type);
    
    for(Key k : db.getKeys(table))   {
        for(AttributeRef attr : k.getAttributes())   {
            if(attr.getName().equals(attribute.getName()) && k.isPrimaryKey())   {
                LabelWidget pk = new LabelWidget(scene);
                pk.setForeground(Color.BLUE);
                pk.setLabel(" PK");
                attributeWidget.addChild(pk);    
            }
        }
    }
}
 
Example #12
Source File: ConnectionWidgetLayout.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private LayoutFactory.ConnectionWidgetLayoutAlignment calculateBestCenterAlignment(Point point, Rectangle bounds) {
    LayoutFactory.ConnectionWidgetLayoutAlignment retVal = LayoutFactory.ConnectionWidgetLayoutAlignment.NONE;
    
    if(bounds != null) {
        if(point.x <= bounds.x) {
            retVal = LayoutFactory.ConnectionWidgetLayoutAlignment.CENTER_LEFT;
        } else if(point.x >= (bounds.x + bounds.width)) {
            retVal = LayoutFactory.ConnectionWidgetLayoutAlignment.CENTER_RIGHT;
        } else if(point.y <= bounds.y) {
            retVal = LayoutFactory.ConnectionWidgetLayoutAlignment.TOP_CENTER;
        } else if(point.y >= (bounds.y + bounds.height)) {
            retVal = LayoutFactory.ConnectionWidgetLayoutAlignment.BOTTOM_CENTER;
        }
    }
    
    return retVal;
}
 
Example #13
Source File: SwitchCardProvider.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void select (Widget widget, Point localLocation, boolean invertSelection) {
        Widget currentActiveCard = LayoutFactory.getActiveCard (cardLayoutWidget);

        List<Widget> children = cardLayoutWidget.getChildren ();
        int i = children.indexOf (currentActiveCard);
        i ++;
        if (i >= children.size ())
            i = 0;
        Widget newActiveCard = children.get (i);

        if (currentActiveCard == newActiveCard)
            return;

        LayoutFactory.setActiveCard (cardLayoutWidget, newActiveCard);
//        notifyCardSwitched (currentActiveCard, newActiveCard);
    }
 
Example #14
Source File: ListWidget.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a list widget.
 * @param scene the scene
 */
public ListWidget (Scene scene) {
    super (scene);

    LookFeel lookFeel = scene.getLookFeel ();
    setOpaque (true);
    setBackground (lookFeel.getBackground ());
    setBorder (BorderFactory.createLineBorder ());
    setLayout (LayoutFactory.createVerticalFlowLayout ());

    header = new Widget (scene);
    header.setLayout (LayoutFactory.createHorizontalFlowLayout (LayoutFactory.SerialAlignment.CENTER, 0));
    header.addChild (imageWidget = new ImageWidget (scene));
    header.addChild (labelWidget = new LabelWidget (scene));
    addChild (header);

    addChild (new SeparatorWidget (scene, SeparatorWidget.Orientation.HORIZONTAL));

    setState (ObjectState.createNormal ());
}
 
Example #15
Source File: ControlFlowScene.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public ControlFlowScene() {
    selection = new HashSet<BlockWidget>();

    this.getInputBindings().setZoomActionModifiers(0);
    this.setLayout(LayoutFactory.createAbsoluteLayout());

    mainLayer = new LayerWidget(this);
    this.addChild(mainLayer);

    edgeLayer = new LayerWidget(this);
    this.addChild(edgeLayer);

    selectLayer = new LayerWidget(this);
    this.addChild(selectLayer);

    this.getActions().addAction(hoverAction);
    this.getActions().addAction(selectAction);
    this.getActions().addAction(ActionFactory.createRectangularSelectAction(this, selectLayer, this));
    this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
}
 
Example #16
Source File: OpenSimObjectWidget.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
public OpenSimObjectWidget (Scene scene) {
    super (scene);
    setLayout (LayoutFactory.createVerticalFlowLayout ());
    setBorder (BorderFactory.createLineBorder ());
    setOpaque (true);
    setCheckClipping (true);
    
    Widget classWidget = new Widget (scene);
    classWidget.setLayout (LayoutFactory.createHorizontalFlowLayout ());
    classWidget.setBorder (BORDER_4);

    ImageWidget classImage = new ImageWidget (scene);
    classImage.setImage (IMAGE_CLASS);
    classWidget.addChild (classImage);

    className = new LabelWidget (scene);
    className.setFont (scene.getDefaultFont ().deriveFont (Font.BOLD));
    classWidget.addChild (className);
    addChild (classWidget);

}
 
Example #17
Source File: ParametersWidget.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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 #18
Source File: ControlFlowScene.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public ControlFlowScene() {
    selection = new HashSet<BlockWidget>();

    this.getInputBindings().setZoomActionModifiers(0);
    this.setLayout(LayoutFactory.createAbsoluteLayout());

    mainLayer = new LayerWidget(this);
    this.addChild(mainLayer);

    edgeLayer = new LayerWidget(this);
    this.addChild(edgeLayer);

    selectLayer = new LayerWidget(this);
    this.addChild(selectLayer);

    this.getActions().addAction(hoverAction);
    this.getActions().addAction(selectAction);
    this.getActions().addAction(ActionFactory.createRectangularSelectAction(this, selectLayer, this));
    this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
}
 
Example #19
Source File: FaultsWidget.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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 #20
Source File: ControlFlowScene.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public ControlFlowScene() {
    selection = new HashSet<BlockWidget>();

    this.getInputBindings().setZoomActionModifiers(0);
    this.setLayout(LayoutFactory.createAbsoluteLayout());

    mainLayer = new LayerWidget(this);
    this.addChild(mainLayer);

    edgeLayer = new LayerWidget(this);
    this.addChild(edgeLayer);

    selectLayer = new LayerWidget(this);
    this.addChild(selectLayer);

    this.getActions().addAction(hoverAction);
    this.getActions().addAction(selectAction);
    this.getActions().addAction(ActionFactory.createRectangularSelectAction(this, selectLayer, this));
    this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
}
 
Example #21
Source File: OperationsWidget.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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 #22
Source File: TgdDepSceneGenerator.java    From Llunatic with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Scene createScene(Dependency dependency) {
    LunaticDepScene scene = new LunaticDepScene();
    SceneLayout sceneLayout = LayoutFactory.createSceneGraphLayout(scene, graphLayout);
    scene.setSceneLayout(sceneLayout);
    populateScene(dependency, scene);
    return scene;
}
 
Example #23
Source File: OpenSimObjectWidget.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
public Widget createOperation (String operation) {
    Scene scene = getScene ();
    Widget widget = new Widget (scene);
    widget.setLayout (LayoutFactory.createHorizontalFlowLayout ());

    ImageWidget imageWidget = new ImageWidget (scene);
    imageWidget.setImage (IMAGE_OPERATION);
    widget.addChild (imageWidget);

    LabelWidget labelWidget = new LabelWidget (scene);
    labelWidget.setLabel (operation);
    widget.addChild (labelWidget);

    return widget;
}
 
Example #24
Source File: OpenSimObjectWidget.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
public Widget createMember (String member) {
    Scene scene = getScene ();
    Widget widget = new Widget (scene);
    widget.setLayout (LayoutFactory.createHorizontalFlowLayout ());

    ImageWidget imageWidget = new ImageWidget (scene);
    imageWidget.setImage (IMAGE_MEMBER);
    widget.addChild (imageWidget);

    LabelWidget labelWidget = new LabelWidget (scene);
    labelWidget.setLabel (member);
    widget.addChild (labelWidget);

     return widget;
}
 
Example #25
Source File: EgdSceneGenerator.java    From Llunatic with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Scene createScene(Dependency dependency) {
    LunaticDepScene scene = new LunaticDepScene();
    SceneLayout sceneLayout = LayoutFactory.createSceneGraphLayout(scene, graphLayout);
    scene.setSceneLayout(sceneLayout);
    populateScene(dependency, scene);
    return scene;
}
 
Example #26
Source File: QBGraphScene.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected Widget attachNodeWidget(Object node) {
    
    VMDNodeWidget widget = new VMDNodeWidget(this);
    // Widget widget = new Widget(this);
    
    widget.setLayout(LayoutFactory.createVerticalFlowLayout());
    widget.setBorder(VMDFactory.createVMDNodeBorder());
    widget.getActions().addAction(moveAction);
    
    ComponentWidget componentWidget = null;
    // LabelWidget label = null;
    
    if (node instanceof QBNodeComponent) // we have a qbNodeComponent
    {
        // label = new LabelWidget(this, ((QBNodeComponent)node).getNodeName());
        widget.setNodeName(((QBNodeComponent)node).getNodeName());
        widget.setNodeType("Table");
        componentWidget = new ComponentWidget(this, (QBNodeComponent)node);
        componentWidget.setBorder(VMDFactory.createVMDNodeBorder());
    }
    
    // 	label.setOpaque(true);
    // 	label.setBackground(Color.LIGHT_GRAY);
    // 	widget.addChild(label);
    
    widget.addChild(componentWidget);
    
    mainLayer.addChild(widget);
    return widget;
}
 
Example #27
Source File: EditorPaneWidget.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Paints the component widget.
 */
protected final void paintWidget () {
    if(!componentAdded) {
        setLayout( LayoutFactory.createHorizontalFlowLayout() );
        getScene().getView().add(scrollPane);
        componentAdded = true;
    }
    scrollPane.setBounds (getScene().convertSceneToView (convertLocalToScene (getClientArea())));
    editorPane.setFont(editorPane.getFont().deriveFont((float)getScene().getZoomFactor()*origoinalFontSize));
    editorPane.repaint();
}
 
Example #28
Source File: ImageLabelWidget.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public ImageLabelWidget(Scene scene, Image image,
        String label,
        String comment, int hgap) {
    super(scene);
    
    setLayout(LayoutFactory.createHorizontalFlowLayout(LayoutFactory.SerialAlignment.CENTER, hgap));
    
    setImage(image);
    setLabel(label);
    setComment(comment);
}
 
Example #29
Source File: DescriptionWidget.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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 #30
Source File: SampleMessageWidget.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** 
 * 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));
}