Java Code Examples for org.netbeans.api.visual.action.WidgetAction#WidgetMouseEvent

The following examples show how to use org.netbeans.api.visual.action.WidgetAction#WidgetMouseEvent . 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: TableWidget.java    From jeddict with Apache License 2.0 6 votes vote down vote up
@Override
public WidgetAction.State mousePressed(Widget widget, WidgetAction.WidgetMouseEvent event) {
    if (event.getButton() == MouseEvent.BUTTON1 && event.getClickCount() == 2) {
        TableWidget tableWidget = TableWidget.this;
        ModelerFile file = tableWidget.getModelerScene().getModelerFile();
        Node tablesNode = (Node) file.getAttribute(Node.class.getSimpleName());

        Optional<Node> nodeOptional = Arrays.stream(tablesNode.getChildren().getNodes())
                .filter(tableNode -> tableNode.getName().equalsIgnoreCase(tableWidget.getName()))
                .findFirst();
        if (nodeOptional.isPresent()) {
            ViewDataAction viewDataAction = new ViewDataAction();
            viewDataAction.performAction(new Node[]{nodeOptional.get()});
            return WidgetAction.State.CONSUMED;
        }
    }
    return WidgetAction.State.REJECTED;
}
 
Example 2
Source File: SlotWidget.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void handleDoubleClick(Widget w, WidgetAction.WidgetMouseEvent e) {
    Set<Integer> hiddenNodes = new HashSet<>(diagramScene.getModel().getHiddenNodes());
    if (diagramScene.isAllVisible()) {
        hiddenNodes = new HashSet<>(diagramScene.getModel().getGraphToView().getGroup().getAllNodes());
    }

    boolean progress = false;
    for (Figure f : diagramScene.getModel().getDiagramToView().getFigures()) {
        for (Slot s : f.getSlots()) {
            if (DiagramScene.doesIntersect(s.getSource().getSourceNodesAsSet(), slot.getSource().getSourceNodesAsSet())) {
                progress = true;
                hiddenNodes.removeAll(f.getSource().getSourceNodesAsSet());
            }
        }
    }

    if (progress) {
        this.diagramScene.getModel().showNot(hiddenNodes);
    }
}
 
Example 3
Source File: DoubleClickAction.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public WidgetAction.State mouseClicked(Widget widget, WidgetAction.WidgetMouseEvent event) {
    if (event.getClickCount() > 1) {
        handler.handleDoubleClick(widget, event);
        return WidgetAction.State.CONSUMED;
    }
    return WidgetAction.State.REJECTED;
}
 
Example 4
Source File: TableWidget.java    From jeddict with Apache License 2.0 5 votes vote down vote up
@Override
public WidgetAction.State mousePressed(Widget widget, WidgetAction.WidgetMouseEvent event) {
    if (event.getButton() == MouseEvent.BUTTON1  && event.getClickCount()==2) {
        SQLEditorUtil.openDBTable(TableWidget.this);
        return WidgetAction.State.CONSUMED;
    }
    return WidgetAction.State.REJECTED;
}
 
Example 5
Source File: OpenSourceCodeAction.java    From jeddict with Apache License 2.0 5 votes vote down vote up
@Override
public WidgetAction.State mousePressed(Widget widget, WidgetAction.WidgetMouseEvent event) {
    if (event.getButton() == MouseEvent.BUTTON1 && event.getClickCount() == 2) {
        openSourceCode(true);
        return WidgetAction.State.CONSUMED;
    }
    return WidgetAction.State.REJECTED;
}
 
Example 6
Source File: DoubleClickAction.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public WidgetAction.State mouseClicked(Widget widget, WidgetAction.WidgetMouseEvent event) {
    if (event.getClickCount() > 1) {
        handler.handleDoubleClick(widget, event);
        return WidgetAction.State.CONSUMED;
    }
    return WidgetAction.State.REJECTED;
}
 
Example 7
Source File: DoubleClickAction.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public WidgetAction.State mouseClicked(Widget widget, WidgetAction.WidgetMouseEvent event) {
    if (event.getClickCount() > 1) {
        handler.handleDoubleClick(widget, event);
        return WidgetAction.State.CONSUMED;
    }
    return WidgetAction.State.REJECTED;
}
 
Example 8
Source File: DoubleClickAction.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public WidgetAction.State mouseClicked(Widget widget, WidgetAction.WidgetMouseEvent event) {
    if (event.getClickCount() > 1) {
        handler.handleDoubleClick(widget, event);
        return WidgetAction.State.CONSUMED;
    }
    return WidgetAction.State.REJECTED;
}
 
Example 9
Source File: DoubleClickAction.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public WidgetAction.State mouseClicked(Widget widget, WidgetAction.WidgetMouseEvent event) {
    if (event.getClickCount() > 1) {
        handler.handleDoubleClick(widget, event);
        return WidgetAction.State.CONSUMED;
    }
    return WidgetAction.State.REJECTED;
}
 
Example 10
Source File: DoubleClickAction.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public WidgetAction.State mouseClicked(Widget widget, WidgetAction.WidgetMouseEvent event) {
    if (event.getClickCount() > 1) {
        handler.handleDoubleClick(widget, event);
        return WidgetAction.State.CONSUMED;
    }
    return WidgetAction.State.REJECTED;
}
 
Example 11
Source File: InplaceEditorAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
    public State mouseReleased(Widget widget, WidgetAction.WidgetMouseEvent event) {
//        if (editor != null)
//            closeEditor (true);
//        return State.REJECTED;

        if (editor != null) {
            Container parent = editor.getParent();
            if (parent != null) {
                parent.requestFocusInWindow();
            }
            closeEditor(true);
        }
        return State.REJECTED;
    }
 
Example 12
Source File: ConnectAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public WidgetAction.State mouseReleased (Widget widget, WidgetAction.WidgetMouseEvent event) {
    Point point = event.getPoint ();
    boolean state = move (widget, point);
    if (state) {
        if (targetWidget != null)
            if (Math.abs (startingPoint.x - point.x) >= MIN_DIFFERENCE  ||  Math.abs (startingPoint.y - point.y) >= MIN_DIFFERENCE)
                provider.createConnection (sourceWidget, targetWidget);
        cancel ();
    }
    return state ? State.CONSUMED : State.REJECTED;
}
 
Example 13
Source File: ExtendedConnectAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public WidgetAction.State mouseReleased(Widget widget, WidgetAction.WidgetMouseEvent event) {
    macLocking = false;
    if (isLocked ())
        return super.mouseReleased(widget,event);
    else
        return State.REJECTED;
}
 
Example 14
Source File: ExtendedConnectAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public WidgetAction.State mousePressed(Widget widget, WidgetAction.WidgetMouseEvent event) {
    if (isLocked ())
        return State.createLocked (widget, this);
    if ((event.getModifiers () & modifiers) == modifiers) {
        if ((Utilities.getOperatingSystem () & Utilities.OS_MAC) != 0)
            macLocking = true;
        return super.mousePressedCore(widget,event);
    }
    return State.REJECTED;
}
 
Example 15
Source File: DoubleClickAction.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public WidgetAction.State mouseClicked(Widget widget, WidgetAction.WidgetMouseEvent event) {
    if (event.getClickCount() > 1) {
        handler.handleDoubleClick(widget, event);
        return WidgetAction.State.CONSUMED;
    }
    return WidgetAction.State.REJECTED;
}
 
Example 16
Source File: DoubleClickAction.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public WidgetAction.State mouseClicked(Widget widget, WidgetAction.WidgetMouseEvent event) {
    if (event.getClickCount() > 1) {
        handler.handleDoubleClick(widget, event);
        return WidgetAction.State.CONSUMED;
    }
    return WidgetAction.State.REJECTED;
}
 
Example 17
Source File: ConnectAction.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public WidgetAction.State mouseDragged (Widget widget, WidgetAction.WidgetMouseEvent event) {
    return move (widget, event.getPoint ()) ? State.createLocked (widget, this) : State.REJECTED;
}
 
Example 18
Source File: ConnectAction.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public WidgetAction.State mousePressed (Widget widget, WidgetAction.WidgetMouseEvent event) {
    if (isLocked ())
        return WidgetAction.State.createLocked (widget, this);
    return mousePressedCore (widget, event);
}