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


Java State类代码示例

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


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

示例1: mouseMoved

import org.netbeans.api.visual.action.WidgetAction.State; //导入依赖的package包/类
@Override
public State mouseMoved(Widget widget, WidgetMouseEvent event) {
    if (paletteWidget != null && paletteWidget.isVisible() && widget.getState().isSelected()) {
        Rectangle bounds = widget.getBounds();
        boolean left = event.getPoint().x < (bounds.x + bounds.width / 2);

        Point scenePt = widget.convertLocalToScene(event.getPoint());
        Point viewPt = scene.convertSceneToView(scenePt);
        viewPt = SwingUtilities.convertPoint(getScene().getView(), viewPt, getDecoratorLayer());

        // The palette is going to follow the cursor vertical position.
        // We may want to change where the horizontal position is located.
        Point newPt = getPaletteLocationLR(widget, paletteWidget, left);
        newPt.y = viewPt.y - 6;
        //Point newPt = new Point(paletteWidget.getX(), viewPt.y);
        if (!paletteWidget.getBounds().contains(viewPt)) {
            paletteWidget.setLocation(newPt);
        }
    }

    return State.REJECTED;
}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:23,代码来源:SwingPaletteManager.java

示例2: mousePressed

import org.netbeans.api.visual.action.WidgetAction.State; //导入依赖的package包/类
public State mousePressed (Widget widget, WidgetMouseEvent event) {
    if (isLocked ())
        return State.createLocked (widget, this);
    if (event.getButton () == MouseEvent.BUTTON1  &&  event.getClickCount () == 1) {
        movingWidget = widget;
        initialMouseLocation = event.getPoint ();
        setModifiers(event.getModifiers());
        setModifiersEx(event.getModifiersEx());
        originalSceneLocation = provider.getOriginalLocation (widget);
        if (originalSceneLocation == null)
            originalSceneLocation = new Point ();
        dragSceneLocation = widget.convertLocalToScene (event.getPoint ());
        provider.movementStarted (widget);
        if (provider instanceof ReportAlignWithMoveStrategyProvider)
        {
            ((ReportAlignWithMoveStrategyProvider)provider).setAction(this);
        }
        return State.createLocked (widget, this);
    }
    return State.REJECTED;
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:22,代码来源:ExMoveAction.java

示例3: mouseReleased

import org.netbeans.api.visual.action.WidgetAction.State; //导入依赖的package包/类
public State mouseReleased (Widget widget, WidgetMouseEvent event) {

        setModifiers(event.getModifiers());
        setModifiersEx(event.getModifiersEx());

        boolean state;
        if (initialMouseLocation != null  &&  initialMouseLocation.equals (event.getPoint ()))
            state = true;
        else
            state = move (widget, event.getPoint ());
        if (state) {
            movingWidget = null;
            dragSceneLocation = null;
            originalSceneLocation = null;
            initialMouseLocation = null;
            provider.movementFinished (widget);
        }
        return state ? State.CONSUMED : State.REJECTED;
    }
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:20,代码来源:ExMoveAction.java

示例4: mouseMoved

import org.netbeans.api.visual.action.WidgetAction.State; //导入依赖的package包/类
@Override
public State mouseMoved(Widget widget, WidgetMouseEvent event) {
    long id = event.getEventID();
    if (id != eventID) {
        eventID = id;
        provider.widgetHovered(widget);
    }
    return State.REJECTED;
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:10,代码来源:MouseOverAction.java

示例5: mousePressed

import org.netbeans.api.visual.action.WidgetAction.State; //导入依赖的package包/类
@Override
public State mousePressed (Widget widget, WidgetMouseEvent event) {
    if (isLocked ())
        return State.createLocked (widget, this);
    if (enabled && (event.getModifiersEx() & modifiersExMask) == modifiersEx) {
        scene = widget.getScene ();
        scrollPane = findScrollPane (scene.getView ());
        if (scrollPane != null) {
            lastLocation = scene.convertSceneToView (widget.convertLocalToScene (event.getPoint ()));
            SwingUtilities.convertPointToScreen (lastLocation, scene.getView ());
            return State.createLocked (widget, this);
        }
    }
    return State.REJECTED;
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:16,代码来源:CustomizablePanAction.java

示例6: mouseReleased

import org.netbeans.api.visual.action.WidgetAction.State; //导入依赖的package包/类
@Override
public State mouseReleased (Widget widget, WidgetMouseEvent event) {
    boolean state = pan (widget, event.getPoint ());
    if (state)
        scrollPane = null;
    return state ? State.createLocked (widget, this) : State.REJECTED;
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:8,代码来源:CustomizablePanAction.java

示例7: mousePressed

import org.netbeans.api.visual.action.WidgetAction.State; //导入依赖的package包/类
@Override
public State mousePressed(Widget widget, WidgetMouseEvent event) {
    // TODO: Solve this differently?
    if (event.getButton() != MouseEvent.BUTTON2) {
        return innerAction.mousePressed(widget, new WidgetMouseEvent(event.getEventID(), new MouseEvent(panel, (int) event.getEventID(), event.getWhen(), event.getModifiersEx(), event.getPoint().x, event.getPoint().y, event.getClickCount(), event.isPopupTrigger(), MouseEvent.BUTTON1)));
    } else {
        return super.mousePressed(widget, event);
    }
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:10,代码来源:ExtendedSelectAction.java

示例8: mousePressed

import org.netbeans.api.visual.action.WidgetAction.State; //导入依赖的package包/类
@Override
public State mousePressed(Widget widget, WidgetMouseEvent event) {
    if (widget.getScene() instanceof AbstractModelerScene) {
        AbstractModelerScene scene = (AbstractModelerScene) widget.getScene();
        scene.clearLockedSelected();
    }

    return State.REJECTED;
}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:10,代码来源:LockSelectionAction.java

示例9: keyTyped

import org.netbeans.api.visual.action.WidgetAction.State; //导入依赖的package包/类
public State keyTyped(Widget widget, WidgetKeyEvent event) {
    if (widget instanceof IEdgeWidget && event.getKeyChar() == KeyEvent.VK_DELETE) {
        GraphPinScene scene = (GraphPinScene) widget.getScene();
        if (widget instanceof IEdgeWidget) {
            ((IEdgeWidget) widget).remove(true);
            return State.CONSUMED;
        }
    }
    return State.REJECTED;
}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:11,代码来源:EdgeDeleteAction.java

示例10: mousePressed

import org.netbeans.api.visual.action.WidgetAction.State; //导入依赖的package包/类
@Override
public State mousePressed(Widget widget, WidgetMouseEvent event) {
    if (widget != actionTarget) {
        Point tmp = widget.convertLocalToScene(event.getPoint());
        tmp = actionTarget.convertSceneToLocal(tmp);
        event.setPoint(tmp);
    }
    State state = delegatedAction.mousePressed((Widget) actionTarget, event);
    actionTarget.getScene().validate();
    return fireWidgetActionHandedEvent(state);
}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:12,代码来源:PaletteButton.java

示例11: mouseReleased

import org.netbeans.api.visual.action.WidgetAction.State; //导入依赖的package包/类
@Override
public State mouseReleased(Widget widget, WidgetMouseEvent event) {
    State state = delegatedAction.mouseReleased(widget, event);
    if (recordedCurrentTool) {
        actionTarget.getScene().setActiveTool(currentTool);
        recordedCurrentTool = false;
    }
    return fireWidgetActionHandedEvent(state);
}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:10,代码来源:PaletteButton.java

示例12: mousePressed

import org.netbeans.api.visual.action.WidgetAction.State; //导入依赖的package包/类
public State mousePressed (Widget widget, WidgetMouseEvent event) {

        if (isLocked ())
            return State.createLocked (widget, this);
        if (event.getButton ()  ==  MouseEvent.BUTTON1 ||  event.getButton () == MouseEvent.BUTTON3)
        {

            rightButton = event.getButton () == MouseEvent.BUTTON3;
            widget.getScene().getView().requestFocus();

            invertSelection = (event.getModifiersEx () & MouseEvent.CTRL_DOWN_MASK) != 0;
            Point localLocation = event.getPoint ();
            if (provider.isSelectionAllowed (widget, localLocation, invertSelection)) {
                aiming = provider.isAimingAllowed (widget, localLocation, invertSelection);
                if (aiming) {
                    updateState (widget, localLocation);
                    return State.createLocked (widget, this);
                } else {
                    provider.select (widget, localLocation, invertSelection);
                    // check if the widget is still selected...
                    Object object = null;
                    if (widget instanceof SelectionWidget)
                    {
                         object = ((ObjectScene)widget.getScene()).findObject ( ((SelectionWidget)widget).getRealWidget() );
                    }
                    else
                    {
                        object = ((ObjectScene)widget.getScene()).findObject (widget);
                    }
                    
                    if (!((ObjectScene)widget.getScene()).getSelectedObjects().contains (object))
                    {
                        return State.CONSUMED;
                    }
                    return State.CHAIN_ONLY;
                }
            }
        }
        return State.REJECTED;
    }
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:41,代码来源:SelectAction.java

示例13: mouseReleased

import org.netbeans.api.visual.action.WidgetAction.State; //导入依赖的package包/类
public State mouseReleased (final Widget widget, final WidgetMouseEvent event) {
    if (aiming) {
        Point point = event.getPoint ();
        updateState (widget, point);
        if (aimedWidget != null)
            provider.select (widget, point, invertSelection);
        updateState (null, null);
        aiming = false;

        if (event.getButton() == MouseEvent.BUTTON3 && rightButton)
        {
            // if there is a PopupMenuAction, use it..

            List<WidgetAction> actions = widget.getActions().getActions();
            for (final WidgetAction action : actions)
            {
                if (action.getClass().getName().contains("PopupMenuAction"))
                {
                    SwingUtilities.invokeLater(new Runnable() {

                        public void run() {
                            action.mousePressed(widget, event);
                            action.mouseReleased(widget, event);
                        }
                    });
                    break;
                }
            }
        }

        return State.CONSUMED;
    }
    return super.mouseReleased (widget, event);
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:35,代码来源:SelectAction.java

示例14: keyTyped

import org.netbeans.api.visual.action.WidgetAction.State; //导入依赖的package包/类
public State keyTyped (Widget widget, WidgetKeyEvent event) {
    if (! aiming  &&  event.getKeyChar () == KeyEvent.VK_SPACE) {
        provider.select (widget, null, (event.getModifiersEx () & MouseEvent.CTRL_DOWN_MASK) != 0);
        return State.CONSUMED;
    }
    return State.REJECTED;
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:8,代码来源:SelectAction.java

示例15: mouseExited

import org.netbeans.api.visual.action.WidgetAction.State; //导入依赖的package包/类
@Override
public State mouseExited(Widget widget, WidgetMouseEvent event) {
    provider.widgetHovered(null);
    return State.REJECTED;
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:6,代码来源:MouseOverAction.java


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