当前位置: 首页>>代码示例>>Java>>正文


Java ObjectState类代码示例

本文整理汇总了Java中org.netbeans.api.visual.model.ObjectState的典型用法代码示例。如果您正苦于以下问题:Java ObjectState类的具体用法?Java ObjectState怎么用?Java ObjectState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ObjectState类属于org.netbeans.api.visual.model包,在下文中一共展示了ObjectState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ListWidget

import org.netbeans.api.visual.model.ObjectState; //导入依赖的package包/类
/**
 * 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 ());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:ListWidget.java

示例2: updateUI

import org.netbeans.api.visual.model.ObjectState; //导入依赖的package包/类
public void updateUI (VMDConnectionWidget widget, ObjectState previousState, ObjectState state) {
    if (state.isHovered ())
        widget.setForeground (COLOR_HOVERED);
    else if (state.isSelected ())
        widget.setForeground (COLOR_SELECTED);
    else if (state.isHighlighted ())
        widget.setForeground (COLOR_HIGHLIGHTED);
    else if (state.isFocused ())
        widget.setForeground (COLOR_HOVERED);
    else
        widget.setForeground (COLOR_NORMAL);

    if (state.isSelected ()) {
        widget.setControlPointShape (PointShape.SQUARE_FILLED_SMALL);
        widget.setEndPointShape (PointShape.SQUARE_FILLED_BIG);
    } else {
        widget.setControlPointShape (PointShape.NONE);
        widget.setEndPointShape (POINT_SHAPE_IMAGE);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:VMDOriginalColorScheme.java

示例3: updateUI

import org.netbeans.api.visual.model.ObjectState; //导入依赖的package包/类
public void updateUI (VMDNodeWidget widget, ObjectState previousState, ObjectState state) {
    if (! previousState.isSelected ()  &&  state.isSelected ())
        widget.bringToFront ();

    boolean hover = state.isHovered () || state.isFocused ();
    widget.getHeader ().setOpaque (hover);

    if (state.isSelected ())
        widget.setBorder (BORDER60_SELECT);
    else if (state.isHovered ())
        widget.setBorder (BORDER60_HOVER);
    else if (state.isFocused ())
        widget.setBorder (BORDER60_HOVER);
    else
        widget.setBorder (BORDER60);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:VMDNetBeans60ColorScheme.java

示例4: ListWidget

import org.netbeans.api.visual.model.ObjectState; //导入依赖的package包/类
/**
 * 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 ());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:ListWidget.java

示例5: IconNodeWidget

import org.netbeans.api.visual.model.ObjectState; //导入依赖的package包/类
/**
 * 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 ());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:IconNodeWidget.java

示例6: testRegisterWidgetTransfersState

import org.netbeans.api.visual.model.ObjectState; //导入依赖的package包/类
/**
 * Checks that lazy object will maintain the state even if
 * a widget is registered
 */
public void testRegisterWidgetTransfersState() throws Exception {
    Object item = new String("lazyItem");
    scene.setSelectedObjects(Collections.singleton(item));
    scene.setHighlightedObjects(Collections.singleton(item));
    scene.setHoveredObject(item);
    scene.setFocusedObject(item);
    
    Widget w = new LabelWidget(scene);
    scene.addObject(item, w);
    
    ObjectState s = scene.getObjectState(item);
    assertTrue(s.isSelected());
    assertTrue(s.isHighlighted());
    assertTrue(s.isHovered());
    assertTrue(s.isFocused());
    
    ObjectState ws = w.getState();
    assertTrue(ws.isSelected());
    assertTrue(ws.isHighlighted());
    assertTrue(ws.isHovered());
    assertTrue(ws.isFocused());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:ObjectSceneLazyTest.java

示例7: mouseClicked

import org.netbeans.api.visual.model.ObjectState; //导入依赖的package包/类
@Override
public final WidgetAction.State mouseClicked(Widget widget, WidgetAction.WidgetMouseEvent event) {
    if (event.getButton() == MouseEvent.BUTTON1 && event.getClickCount() == 1) {
        ObjectState widgetState = widget.getState();
        boolean isFocused = widgetState.isObjectFocused();
        ObjectState newWidgetState = widgetState.deriveObjectFocused(!isFocused);

        unfocusAllWidgets(widget);
        widget.setState(newWidgetState);
        widget.revalidate();

        String htmlDescription = getHtmlDescription();
        if (htmlDescription != null) {
            IPaletteActions paletteActions = ((ShedScene) widget.getScene()).getPaletteActions();
            paletteActions.setHtmlDescription(htmlDescription);
        }
        return WidgetAction.State.CONSUMED;
    }
    return WidgetAction.State.REJECTED;
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:21,代码来源:FocusActionFactory.java

示例8: EdgeSwitchWidget

import org.netbeans.api.visual.model.ObjectState; //导入依赖的package包/类
public EdgeSwitchWidget(final CfgScene scene, NodeWidget nodeWidget, boolean output) {        
    super(scene);
    this.scene = scene;   
    this.output = output;
    this.nodeWidget = nodeWidget;  
  
    this.getActions().addAction(ActionFactory.createSelectAction(selectProvider));
    TwoStateHoverProvider ts = new TsHover(this);   
    WidgetAction wa = ActionFactory.createHoverAction(ts);
    this.hoverAction = wa;
    this.getActions().addAction(wa);
    scene.getActions().addAction(wa);
    this.setToolTipText(TT_HIDE_EDGES);      
    this.setForeground(color_enabled);
    this.setState(ObjectState.createNormal());
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:17,代码来源:EdgeSwitchWidget.java

示例9: changeEdgeVisibility

import org.netbeans.api.visual.model.ObjectState; //导入依赖的package包/类
public void changeEdgeVisibility(boolean visible){
    Collection<CfgEdge> edges = this.getEdges();  
        
    for(CfgEdge e: edges) {
        EdgeWidget ew = (EdgeWidget) scene.findWidget(e);
        if(visible != ew.isEdgeVisible()){              
            ew.setEdgeVisible(visible);     
            if(output){
                scene.getInputSwitch(e.getTargetNode()).updateStatus();
            } else {
                scene.getOutputSwitch(e.getSourceNode()).updateStatus();
            }              
        }
    }
    if(visible)    
        this.setToolTipText(TT_HIDE_EDGES); 
    else 
        this.setToolTipText(TT_SHOW_EDGES);
   
    this.setForeground(color_enabled);
    this.bringToBack();
    ObjectState os = this.getState();   
    this.setState(os.deriveSelected(!visible));
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:25,代码来源:EdgeSwitchWidget.java

示例10: updateStatus

import org.netbeans.api.visual.model.ObjectState; //导入依赖的package包/类
/**
 *  Update the status of the switch to the current state of the edges
 *  usually needed when the opposit switch changes the state
 */
private void updateStatus(){
    Collection<CfgEdge> edges = this.getEdges(); 
    boolean hiddenFound=false;
    for(CfgEdge e: edges) {
        EdgeWidget ew = (EdgeWidget) scene.findWidget(e);
        if(!ew.isVisible()) {
            hiddenFound=true;
            break;
        }
    }        
    ObjectState os = this.getState();
    if(os.isSelected() && !hiddenFound) {
        this.setState(os.deriveSelected(false));
        setToolTipText(TT_HIDE_EDGES);
    } else if (!os.isSelected() && hiddenFound) {
        this.setState(os.deriveSelected(true));
        setToolTipText(TT_SHOW_EDGES); 
    }
    this.revalidate();
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:25,代码来源:EdgeSwitchWidget.java

示例11: notifyStateChanged

import org.netbeans.api.visual.model.ObjectState; //导入依赖的package包/类
@Override
public void notifyStateChanged(ObjectState oldState, ObjectState newState) {
   setForeground (getLineColor());
  
   if(newState.isHighlighted() && !oldState.isHighlighted()){
        this.setStroke(previewStroke);
        this.setVisible(true);
   } else {
       if(newState.isSelected()){
            this.setStroke(selectedStroke);
       } else {
            this.setStroke(defaultStroke);
       }
       if(this.isEdgeVisible()){
            this.setVisible(true);
       } else {
            this.setVisible(false);
       }
   }       
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:21,代码来源:EdgeWidget.java

示例12: notifyStateChanged

import org.netbeans.api.visual.model.ObjectState; //导入依赖的package包/类
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
    super.notifyStateChanged(previousState, state);

    Font font = this.figure.getDiagram().getFont();
    if (state.isSelected()) {
        font = this.figure.getDiagram().getBoldFont();
    }

    Color borderColor = Color.BLACK;
    Color innerBorderColor = getFigure().getColor();
    if (state.isHighlighted()) {
        innerBorderColor = borderColor = Color.BLUE;
    }

    middleWidget.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(borderColor, 1), BorderFactory.createLineBorder(innerBorderColor, 1)));
    for (LabelWidget labelWidget : labelWidgets) {
        labelWidget.setFont(font);
    }
    repaint();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:FigureWidget.java

示例13: notifyStateChanged

import org.netbeans.api.visual.model.ObjectState; //导入依赖的package包/类
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
    super.notifyStateChanged(previousState, state);

    if (previousState.isHovered() != state.isHovered()) {
        if (state.isHovered()) {
            this.setBorder(BorderFactory.createLineBorder(1, HOVER_FOREGROUND_COLOR));
        } else {
            this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
        }
    }

    if (previousState.isSelected() != state.isSelected()) {
        if (state.isSelected()) {
            this.setFont(boldFont);
        } else {
            this.setFont(font);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:BlockWidget.java

示例14: paintWidget

import org.netbeans.api.visual.model.ObjectState; //导入依赖的package包/类
@Override
protected void paintWidget() {
    Graphics2D g = getScene().getGraphics();
    //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
    g.setColor(this.color);
    ObjectState state = this.getState();
    float width = 1.0f;
    if (state.isHovered() || this.popupVisible) {
        width = HOVER_STROKE_WIDTH;
    }

    Stroke oldStroke = g.getStroke();
    g.setStroke(new BasicStroke(width));
    for (Route r : routeList) {
        g.drawLine(r.from.x, r.from.y, r.to.x, r.to.y);
    }
    g.setStroke(oldStroke);
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:19,代码来源:MultiConnectionWidget.java

示例15: notifyStateChanged

import org.netbeans.api.visual.model.ObjectState; //导入依赖的package包/类
@Override
public void notifyStateChanged(ObjectState previousState, ObjectState state) {

    if (previousState.isHovered() != state.isHovered()) {
        color = connection.getColor();
        if (state.isHovered()) {
            this.setStroke(BOLD_STROKE);
        } else {
            this.setStroke(NORMAL_STROKE);
        }

        if (state.isHovered()) {
            this.setStroke(BOLD_STROKE);
        } else {
            this.setStroke(NORMAL_STROKE);
        }

        repaint();
    }
    super.notifyStateChanged(previousState, state);
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:22,代码来源:DiagramConnectionWidget.java


注:本文中的org.netbeans.api.visual.model.ObjectState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。