Java Code Examples for org.netbeans.api.visual.model.ObjectState#isFocused()

The following examples show how to use org.netbeans.api.visual.model.ObjectState#isFocused() . 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: VMDOriginalColorScheme.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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);
    }
}
 
Example 2
Source File: VMDNetBeans60ColorScheme.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 3
Source File: VMDNetBeans60ColorScheme.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void updateUI (VMDConnectionWidget widget, ObjectState previousState, ObjectState state) {
    if (state.isSelected ())
        widget.setForeground (COLOR60_SELECT);
    else if (state.isHighlighted ())
        widget.setForeground (VMDOriginalColorScheme.COLOR_HIGHLIGHTED);
    else if (state.isHovered ()  ||  state.isFocused ())
        widget.setForeground (COLOR60_HOVER);
    else
        widget.setForeground (VMDOriginalColorScheme.COLOR_NORMAL);

    if (state.isSelected ()  ||  state.isHovered ()) {
        widget.setControlPointShape (PointShape.SQUARE_FILLED_SMALL);
        widget.setEndPointShape (PointShape.SQUARE_FILLED_BIG);
        widget.setControlPointCutDistance (0);
    } else {
        widget.setControlPointShape (PointShape.NONE);
        widget.setEndPointShape (POINT_SHAPE60_IMAGE);
        widget.setControlPointCutDistance (5);
    }
}
 
Example 4
Source File: PFENotModifiableScheme.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void updateUI (VMDConnectionWidget widget, ObjectState previousState, ObjectState state) {
    if (state.isSelected ()) {
        widget.setForeground (COLOR60_SELECT);
    } else if (state.isHighlighted ()) {
        widget.setForeground (COLOR_HIGHLIGHTED);
    } else if (state.isHovered ()  ||  state.isFocused ()) {
        widget.setForeground (COLOR60_HOVER);
    } else {
        widget.setForeground (COLOR_NORMAL);
    }

    if (state.isSelected ()  ||  state.isHovered ()) {
        widget.setControlPointShape (PointShape.SQUARE_FILLED_SMALL);
        widget.setEndPointShape (PointShape.SQUARE_FILLED_BIG);
        widget.setControlPointCutDistance (0);
    } else {
        widget.setControlPointShape (PointShape.NONE);
        widget.setEndPointShape (POINT_SHAPE_IMAGE);
        widget.setControlPointCutDistance (5);
    }
}
 
Example 5
Source File: DBColorScheme.java    From jeddict with Apache License 2.0 6 votes vote down vote up
@Override
public void updateUI(IPEdgeWidget widget, ObjectState previousState, ObjectState state) {
    if (state.isSelected()) {
        widget.setForeground(EDGE_WIDGET_SELECT_COLOR);
    } else if (state.isHovered() || state.isFocused()) {
        widget.setForeground(EDGE_WIDGET_HOVER_COLOR);
    } else {
        widget.setForeground(EDGE_WIDGET_COLOR);
    }

    if (state.isSelected()) {
        widget.setControlPointShape(PointShape.SQUARE_FILLED_SMALL);
        widget.setEndPointShape(PointShape.SQUARE_FILLED_BIG);
        widget.setControlPointCutDistance(0);
    } else if (state.isHovered()) {
        widget.setControlPointShape(PointShape.SQUARE_FILLED_SMALL);
        widget.setEndPointShape(PointShape.SQUARE_FILLED_BIG);
        widget.setControlPointCutDistance(0);
    } else {

        widget.setControlPointShape(PointShape.NONE);
        widget.setEndPointShape(PointShape.NONE);
        widget.setControlPointCutDistance(5);
    }
}
 
Example 6
Source File: GraphColorScheme.java    From Llunatic with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void updateUI(VMDNodeWidget widget, ObjectState previousState, ObjectState state) {
    if (!previousState.isSelected() && state.isSelected()) {
        widget.bringToFront();
    } else if (!previousState.isHovered() && state.isHovered()) {
        widget.bringToFront();
    }
    Widget header = widget.getHeader();
    header.setOpaque(state.isSelected());
    if (state.isFocused() || state.isHovered()) {
        header.setBorder(BORDER_PIN_HOVERED);
    } else {
        header.setBorder(HEADER_BORDER_PIN);
    }
    
}
 
Example 7
Source File: DefaultLookFeel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Border getBorder (ObjectState state) {
    if (state.isHovered ())
        return BORDER_HOVERED;
    if (state.isSelected ())
        return BORDER_SELECTED;
    if (state.isFocused ())
        return BORDER_HOVERED;
    return BORDER_NORMAL;
}
 
Example 8
Source File: DefaultLookFeel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Border getMiniBorder (ObjectState state) {
    if (state.isHovered ())
        return MINI_BORDER_HOVERED;
    if (state.isSelected ())
        return MINI_BORDER_SELECTED;
    if (state.isFocused ())
        return MINI_BORDER_HOVERED;
    return MINI_BORDER_NORMAL;
}
 
Example 9
Source File: DefaultLookFeel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Color getLineColor (ObjectState state) {
    if (state.isHovered ())
        return COLOR_HOVERED;
    if (state.isSelected ())
        return COLOR_SELECTED;
    if (state.isHighlighted ()  || state.isFocused ())
        return COLOR_HIGHLIGHTED;
    return getForeground ();//Color.BLACK;
}
 
Example 10
Source File: DefaultLookFeel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Paint getBackground (ObjectState state) {
    if (state.isHovered ())
        return COLOR_HOVERED;
    if (state.isSelected ())
        return COLOR_SELECTED;
    if (state.isHighlighted ()  || state.isFocused ())
        return COLOR_HIGHLIGHTED;
    return getBackground ();//Color.WHITE;
}
 
Example 11
Source File: CheckBoxWidget.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
    if (previousState.isFocused() != state.isFocused()) {
        setBorder(state.isFocused()?BorderFactory.createDashedBorder
                (BORDER_COLOR, 2, 2, true):BorderFactory.createEmptyBorder(1));
    }
    super.notifyStateChanged(previousState,state);
}
 
Example 12
Source File: TableWidget.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
    if (previousState.isSelected() != state.isSelected() ||
            previousState.isFocused() != state.isFocused()) {
        setBorder(state.isSelected() ? state.isFocused()?
            BorderFactory.createDashedBorder(SELECTED_BORDER_COLOR, 2, 2, true):
            BorderFactory.createLineBorder(1,SELECTED_BORDER_COLOR) : 
            state.isFocused() ? BorderFactory.createDashedBorder
            (BORDER_COLOR, 2, 2, true):new LineBorder(1,0,0,0,BORDER_COLOR));
        revalidate(true);
    }
}
 
Example 13
Source File: ButtonWidget.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
    if (previousState.isWidgetAimed() != state.isWidgetAimed() ||
            previousState.isWidgetHovered() != state.isWidgetHovered() ||
            previousState.isFocused() != state.isFocused())
        revalidate(true);
}
 
Example 14
Source File: ImageLabelWidget.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
    if (previousState.isFocused() != state.isFocused()) {
        labelWidget.setBorder(state.isFocused()?BorderFactory.createDashedBorder
                (getForeground(), 2, 2, true):BorderFactory.createEmptyBorder());
        revalidate(true);
    }
}
 
Example 15
Source File: GraphColorScheme.java    From Llunatic with GNU General Public License v3.0 5 votes vote down vote up
@Override
    public void updateUI(VMDPinWidget widget, ObjectState previousState, ObjectState state) {
        widget.setOpaque(state.isSelected());
        if (state.isFocused() || state.isHovered()) {
            widget.setBorder(BORDER_PIN_HOVERED);
        } else {
            widget.setBorder(BORDER_PIN);
        }
//        LookFeel lookFeel = getScene ().getLookFeel ();
//        setBorder (BorderFactory.createCompositeBorder (BorderFactory.createEmptyBorder (8, 2), lookFeel.getMiniBorder (state)));
//        setForeground (lookFeel.getForeground (state));
    }