本文整理汇总了Java中org.netbeans.api.visual.action.ActionFactory类的典型用法代码示例。如果您正苦于以下问题:Java ActionFactory类的具体用法?Java ActionFactory怎么用?Java ActionFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActionFactory类属于org.netbeans.api.visual.action包,在下文中一共展示了ActionFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: VMDGraphScene
import org.netbeans.api.visual.action.ActionFactory; //导入依赖的package包/类
/**
* 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));
}
示例2: TestScene
import org.netbeans.api.visual.action.ActionFactory; //导入依赖的package包/类
public TestScene() {
addChild(mainLayer);
addChild(connectionLayer);
addChild(interractionLayer);
getActions().addAction(createAction);
//mainLayer.addChild(new LabelWidget(this, "Click on background to create a node. Drag a node to create a connection."));
// do not change label nor location because it is hard coded in test cases
//addNode("Label 0").setPreferredLocation(new Point(100, 100));
Widget label0Widget = addNode("Label 0");
label0Widget.setPreferredLocation(new Point(100, 100));
label0Widget.getActions().addAction(ActionFactory.createPopupMenuAction(new MyPopupProvider()));
label0Widget.getActions().addAction(new LabelAction());
Widget label1Widget = addNode("Label 1");
label1Widget.setPreferredLocation(new Point(300, 100));
LabelWidget movableWidget = new LabelWidget(this, "Movable Widget");
movableWidget.setPreferredLocation(new Point(100, 150));
movableWidget.getActions().addAction(moveAction);
addChild(movableWidget);
}
示例3: TLScene
import org.netbeans.api.visual.action.ActionFactory; //导入依赖的package包/类
public TLScene(TLDatabase db) {
LayoutFactory.SerialAlignment ALIGNMENT = LayoutFactory.SerialAlignment.LEFT_TOP;
Layout flowLayout = LayoutFactory.createVerticalFlowLayout(ALIGNMENT, 10);
getActions().addAction(ActionFactory.createPanAction());
// add main layer
this.mainLayer = new LayerWidget(this);
this.mainLayer.setLayout(flowLayout);
this.addChild(mainLayer);
// add overlay layer
this.overlayLayer = new LayerWidget(this);
this.addChild(overlayLayer);
// add CurrentTimeWidget to over
// currentTimeWidget = new CurrentTimeWidget(this, db);
// overlayLayer.addChild(currentTimeWidget);
// add widget showing ticks above
ticsWidgety = new TimeTicsWidget(this);
this.mainLayer.addChild(ticsWidgety);
}
示例4: attachPresenterToWidget
import org.netbeans.api.visual.action.ActionFactory; //导入依赖的package包/类
/**
* Register widget as the moveable drag and drop plus register accept
* providers from presenter.
*
* @param <LAP_ELEMENT>
* @param widget widget that will be moveable and on whcih can be
* @param presenter presenter that is used to get accept actions for widget.
* @param element element that is used for drag and drop.
*/
private <LAP_ELEMENT extends PoshElement> void attachPresenterToWidget(ShedWidget widget, IPresenter presenter, LAP_ELEMENT element) {
WidgetAction editAction = presenter.getEditAction();
if (editAction != null) {
widget.getActions().addAction(editAction);
}
widget.getActions().addAction(ActionFactory.createMoveAction(
ActionFactory.createFreeMoveStrategy(),
new DragAndDropMoveProvider<LAP_ELEMENT>(lapScene, widget, element)));
AbstractAcceptAction[] acceptActions = presenter.getAcceptProviders();
if (acceptActions != null) {
for (AbstractAcceptAction acceptAction : acceptActions) {
widget.getActions().addAction(ActionFactory.createAcceptAction(acceptAction));
}
}
presenter.register();
}
示例5: PoshScene
import org.netbeans.api.visual.action.ActionFactory; //导入依赖的package包/类
/**
* Create a new PoshScene, add default Pan and Zoom actions to the scene
*/
public PoshScene() {
this.setKeyEventProcessingType(EventProcessingType.FOCUSED_WIDGET_AND_ITS_CHILDREN);
getActions().addAction(ActionFactory.createPanAction());
getActions().addAction(ActionFactory.createZoomAction(1.25, false));
mainLayer = new LayerWidget(this);
this.addChild(mainLayer);
connectionLayer = new LayerWidget(this);
this.addChild(connectionLayer);
dndLayer = new LayerWidget(this);
this.addChild(dndLayer);
validate();
}
示例6: setRootWidget
import org.netbeans.api.visual.action.ActionFactory; //导入依赖的package包/类
/**
* Set root widget of the scene.
*
* TODO: maybe clearsubtree instead of just widget.
* @param node
*/
public void setRootWidget(PoshWidget<? extends PoshElement> node) {
this.connectionLayer.setVisible(true);
this.mainLayer.setVisible(true);
if (rootWidget != null) {
this.deletePoshWidget(rootWidget);
}
rootWidget = node;
// add menu
node.getActions().addAction(ActionFactory.createPopupMenuAction(node));
node.getActions().addAction(ActionFactory.createMoveAction(ActionFactory.createFreeMoveStrategy(), new DnDMoveProvider(this)));
mainLayer.addChild(node);
// validate scene
validate();
}
示例7: addPoshWidget
import org.netbeans.api.visual.action.ActionFactory; //导入依赖的package包/类
/**
* Add widget and its connection widget to the scene.
* Validate it afterwards, consolidate if parameter set.
*
* @param newWidget widget that is being added to the tree
* @param consolidate should the method automaticaly consolidate the tree?
*/
public void addPoshWidget(PoshWidget newWidget, boolean consolidate) {
// add menu provider
newWidget.getActions().addAction(ActionFactory.createPopupMenuAction(newWidget));
// Add DnD move provider so I can drag widget from one part of tree to another and drop it there
newWidget.getActions().addAction(ActionFactory.createMoveAction(ActionFactory.createFreeMoveStrategy(), new DnDMoveProvider(this)));
// add widget
mainLayer.addChild(newWidget);
connectionLayer.addChild(newWidget.getConnection());
this.validate();
if (consolidate) {
this.consolidate();
}
}
示例8: CfgScene
import org.netbeans.api.visual.action.ActionFactory; //导入依赖的package包/类
public CfgScene(final JScrollPane scrollPane, final ControlFlowGraph cfg) {
addChild(clusterLayer);
addChild(mainLayer);
addChild(interractionLayer);
addChild(connectionLayer);
this.scrollPane = scrollPane;
this.loadModel(new CfgEnv(cfg));
this.getInputBindings().setZoomActionModifiers(0);
this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
this.getActions().addAction(ActionFactory.createPanAction());
this.getActions().addAction(ActionFactory.createRectangularSelectAction(
this.createSelectDecorator(this),
interractionLayer,
this.createRectangularSelectProvider()));
this.getActions().addAction(this.contextPopupAction);
this.addSceneListener(createSceneListener(this));
this.validate();
getPreferences().addPreferenceChangeListener(preferenceChangeListener);
this.loadDefaults();
}
示例9: LoopClusterWidget
import org.netbeans.api.visual.action.ActionFactory; //导入依赖的package包/类
public LoopClusterWidget(CfgScene scene, int loopdepth, final int loopindex) {
super(scene);
this.cfgscene = scene;
this.loopIndex = loopindex;
this.loopDepth = loopdepth;
this.setBorder(BorderFactory.createDashedBorder(color, DASHSIZE, DASHSIZE/2, true));
this.getActions().addAction(ActionFactory.createEditAction( new EditProvider() { //double click action
public void edit(Widget w) {
if(w instanceof LoopClusterWidget){
for(LoopInfo info : cfgscene.getCfgEnv().getLoopMap().values()){
if(info.getLoopIndex() == loopindex){
cfgscene.setNodeSelection(info.getMembers());
break;
}
}
}
}
}));
}
示例10: EdgeSwitchWidget
import org.netbeans.api.visual.action.ActionFactory; //导入依赖的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());
}
示例11: ControlFlowScene
import org.netbeans.api.visual.action.ActionFactory; //导入依赖的package包/类
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));
}
示例12: setNodeWidgetAction
import org.netbeans.api.visual.action.ActionFactory; //导入依赖的package包/类
@Override
public void setNodeWidgetAction(final INodeWidget nodeWidget) {
WidgetAction selectAction = ActionFactory.createSelectAction(NODE_WIDGET_SELECT_PROVIDER);
WidgetAction moveAction = new MoveAction(nodeWidget, null, MOVE_PROVIDER_DEFAULT, ALIGNSTRATEGY_PROVIDER, ALIGNSTRATEGY_PROVIDER);
WidgetAction popupMenuAction = ActionFactory.createPopupMenuAction(nodeWidget.getPopupMenuProvider());
WidgetAction snapMoveAction = ActionFactory.createMoveAction(ActionFactory.createSnapToGridMoveStrategy(5, 5), null);
WidgetAction acceptAction = ActionFactory.createAcceptAction(new PinWidgetAcceptProvider(file.getModelerScene()));
WidgetAction.Chain selectActionTool = nodeWidget.createActions(DesignerTools.SELECT);
selectActionTool.addAction(selectAction);
// selectActionTool.addAction(NODE_DELETE_ACTION);
selectActionTool.addAction(moveAction);
selectActionTool.addAction(nodeWidget.getModelerScene().createWidgetHoverAction());
selectActionTool.addAction(acceptAction);
selectActionTool.addAction(popupMenuAction);
selectActionTool.addAction(snapMoveAction);
}
示例13: setEdgeWidgetAction
import org.netbeans.api.visual.action.ActionFactory; //导入依赖的package包/类
@Override
public void setEdgeWidgetAction(IEdgeWidget edgeWidget) {
WidgetAction.Chain actions = edgeWidget.getActions();
actions.addAction(ActionFactory.createAddRemoveControlPointAction());
if (edgeWidget instanceof PEdgeWidget) {
actions.addAction(ActionFactory.createMoveControlPointAction(ActionFactory.createFreeMoveControlPointProvider(), ConnectionWidget.RoutingPolicy.DISABLE_ROUTING_UNTIL_END_POINT_IS_MOVED));
} else {
actions.addAction(new MoveControlPointAction(new FreeMoveControlPointProvider(), null)); // Working
}
actions.addAction(file.getModelerScene().createWidgetHoverAction());
actions.addAction(ActionFactory.createSelectAction(EDGE_WIDGET_SELECT_PROVIDER));
actions.addAction(ActionFactory.createReconnectAction(ActionFactory.createDefaultReconnectDecorator(), new SequenceFlowReconnectProvider(file.getModelerScene())));
actions.addAction(ActionFactory.createPopupMenuAction(edgeWidget.getPopupMenuProvider()));
}
示例14: WorkspaceScene
import org.netbeans.api.visual.action.ActionFactory; //导入依赖的package包/类
/**
*
* @param ws
* @param file
*/
public WorkspaceScene(Workspace ws, WorkspaceFile file) {
this.file = file;
backgroundLayer = new LayerWidget(this);
addChild(backgroundLayer);
mainLayer = new LayerWidget(this);
addChild(mainLayer);
connectionLayer = new LayerWidget(this);
addChild(connectionLayer);
this.ws = ws;
load();
MyDropTargetListener dtl = new MyDropTargetListener();
if (this.getView() == null) {
this.createView();
}
DropTarget dt = new DropTarget(this.getView(), dtl);
dt.setDefaultActions(DnDConstants.ACTION_COPY);
dt.setActive(true);
buildToolbar();
getActions().addAction(ActionFactory.createZoomAction());
getActions().addAction(ActionFactory.createPanAction());
getActions().addAction(ActionFactory.createWheelPanAction());
getActions().addAction(ActionFactory.createRectangularSelectAction(this, backgroundLayer));
}
示例15: createComponents
import org.netbeans.api.visual.action.ActionFactory; //导入依赖的package包/类
private void createComponents() {
JScrollPane shapePane = new javax.swing.JScrollPane();
this.setLayout(new BorderLayout());
add(shapePane, java.awt.BorderLayout.CENTER);
this.glassPane = new GraphSceneGlassPane();
this.glassPane.setOpaque(false);
this.glassPane.getScene().setOpaque(true);
this.setOpaque(false);
this.glassPane.getScene().getActions().addAction(ActionFactory.createPopupMenuAction(new MyPopupProviderCompositionZone(this.glassPane)));
JComponent myView = this.glassPane.getView();
shapePane.setViewportView(myView);
// myView.setOpaque(true);
this.add(this.glassPane.getScene().createSatelliteView(), BorderLayout.WEST);
}