本文整理汇总了Java中org.netbeans.api.visual.widget.LayerWidget类的典型用法代码示例。如果您正苦于以下问题:Java LayerWidget类的具体用法?Java LayerWidget怎么用?Java LayerWidget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LayerWidget类属于org.netbeans.api.visual.widget包,在下文中一共展示了LayerWidget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAllNodeWidgets
import org.netbeans.api.visual.widget.LayerWidget; //导入依赖的package包/类
private static List<Widget> getAllNodeWidgets(Widget widget, List<Widget> widgetList) {
if (widgetList == null) {
widgetList = new ArrayList<Widget>();
}
if (widget instanceof LayerWidget && widget.getChildren().size() > 0) //widget has children
{
widgetList.addAll(widget.getChildren());
for (Widget child : widget.getChildren()) {
getAllNodeWidgets(child, widgetList);
}
}
return widgetList;
}
示例2: testLayerPreferredLocation
import org.netbeans.api.visual.widget.LayerWidget; //导入依赖的package包/类
public void testLayerPreferredLocation () {
Scene scene = new Scene ();
scene.addChild (new LayerWidget (scene));
LayerWidget layer = new LayerWidget (scene);
layer.setPreferredLocation (new Point (100, 100));
scene.addChild (layer);
Widget widget = new Widget (scene);
widget.setPreferredBounds (new Rectangle (-20, -10, 100, 50));
widget.setOpaque (true);
widget.setBackground (Color.RED);
layer.addChild (widget);
Color color = (Color) (new DefaultLookFeel()).getBackground();
assertScene (scene, color, new Rectangle (80, 90, 100, 50));
}
示例3: testOffscreenRendering
import org.netbeans.api.visual.widget.LayerWidget; //导入依赖的package包/类
public void testOffscreenRendering () {
Scene scene = new Scene ();
LayerWidget layer = new LayerWidget (scene);
layer.setPreferredBounds (new Rectangle (0, 0, 80, 80));
scene.addChild (layer);
LabelWidget widget = new LabelWidget (scene, "Hi");
widget.setVerticalAlignment (LabelWidget.VerticalAlignment.CENTER);
widget.setAlignment (LabelWidget.Alignment.CENTER);
widget.setBorder (BorderFactory.createLineBorder ());
widget.setPreferredLocation (new Point (20, 20));
widget.setPreferredBounds (new Rectangle (0, 0, 40, 40));
layer.addChild (widget);
BufferedImage image = dumpSceneOffscreenRendering (scene);
Color backgroundColor = (Color) (new DefaultLookFeel()).getBackground();
Color foregroundColor = (new DefaultLookFeel()).getForeground();
assertCleaness (testCleaness (image, backgroundColor, foregroundColor), image, null);
assertScene (scene, backgroundColor, new Rectangle (19, 19, 42, 42));
}
示例4: TLScene
import org.netbeans.api.visual.widget.LayerWidget; //导入依赖的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);
}
示例5: PoshScene
import org.netbeans.api.visual.widget.LayerWidget; //导入依赖的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: ControlFlowScene
import org.netbeans.api.visual.widget.LayerWidget; //导入依赖的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));
}
示例7: movementStarted
import org.netbeans.api.visual.widget.LayerWidget; //导入依赖的package包/类
@Override
public void movementStarted(Widget widget) {
locationChanged = false;
INodeWidget nodeWidget = (INodeWidget) widget;
NBModelerUtil.hideContextPalette(nodeWidget.getModelerScene());
nodeWidget.hideResizeBorder();
LayerWidget interractionLayer = ((IModelerScene) widget.getScene()).getInterractionLayer();
LayerWidget connectionLayer = ((IModelerScene) widget.getScene()).getConnectionLayer();
interractionLayer.bringToFront();
connectionLayer.bringToFront();
Object object = scene.findObject(widget);
if (scene.isNode(object)) {
for (Object o : scene.getSelectedObjects()) {
if (scene.isNode(o)) {
Widget w = scene.findWidget(o);
if (w != null) {
originals.put(w, w.getPreferredLocation());
}
}
}
} else {
originals.put(widget, widget.getPreferredLocation());
}
}
示例8: AbstractPModelerScene
import org.netbeans.api.visual.widget.LayerWidget; //导入依赖的package包/类
public AbstractPModelerScene() {
setKeyEventProcessingType(EventProcessingType.FOCUSED_WIDGET_AND_ITS_CHILDREN);
backgroundLayer = new LayerWidget(this);
mainLayer = new LayerWidget(this);
connectionLayer = new LayerWidget(this);
interractionLayer = new LayerWidget(this);
labelLayer = new LayerWidget(this);
addChild(backgroundLayer);
addChild(mainLayer);
addChild(interractionLayer);
addChild(connectionLayer);
addChild(labelLayer);
connectionLayer.bringToFront();
labelLayer.bringToFront();
router = new OrthogonalSearchRouter(new WidgetsCollisionCollector (mainLayer, connectionLayer));//RouterFactory.createFreeRouter();
satelliteView = this.createSatelliteView();
setActiveTool(DesignerTools.SELECT);
}
示例9: WorkspaceScene
import org.netbeans.api.visual.widget.LayerWidget; //导入依赖的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));
}
示例10: GraphSceneGlassPane
import org.netbeans.api.visual.widget.LayerWidget; //导入依赖的package包/类
public GraphSceneGlassPane() {
this.scene = new ObjectScene();
this.scene.setOpaque(false);
this.mainLayer = new LayerWidget(this.scene);
this.connectionLayer = new LayerWidget(this.scene);
this.constraintsLayer = new LayerWidget(this.scene);
this.jScroolPane = new JScrollPane();
this.jScroolPane.setOpaque(false);
this.scene.addChild(Costanti.INDEX_MAIN_LAYER,this.mainLayer);
this.scene.addChild(Costanti.INDEX_CONNECTION_LAYER,this.connectionLayer);
this.scene.addChild(Costanti.INDEX_CONSTRAINTS_LAYER,this.constraintsLayer);
this.view = scene.createView();
this.view.setVisible(true);
this.view.setOpaque(false);
this.setLayout(new BorderLayout());
this.add(this.view, BorderLayout.CENTER);
}
示例11: createCorrespondenceJoinCondition
import org.netbeans.api.visual.widget.LayerWidget; //导入依赖的package包/类
public void createCorrespondenceJoinCondition(LayerWidget mainLayer, Widget sourceWidget, Widget targetWidget, boolean source) {
CaratteristicheWidgetTree caratteristicheWidgetTreeSource = (CaratteristicheWidgetTree) mainLayer.getChildConstraint(sourceWidget);
CaratteristicheWidgetTree caratteristicheWidgetTreeTarget = (CaratteristicheWidgetTree) mainLayer.getChildConstraint(targetWidget);
PathExpression sourcePathExpression = generatePathFromNode.generatePathFromRoot(caratteristicheWidgetTreeSource.getINode());
PathExpression targetPathExpression = generatePathFromNode.generatePathFromRoot(caratteristicheWidgetTreeTarget.getINode());
JoinCondition joinCondition = new JoinCondition(sourcePathExpression, targetPathExpression);
MappingTask mappingTask = (MappingTask) modello.getBean(Costanti.MAPPINGTASK_SHOWED);
IDataSourceProxy DTsource = null;
if (source) {
DTsource = mappingTask.getSourceProxy();
} else {
DTsource = mappingTask.getTargetProxy();
}
try {
Boolean success = DTsource.addJoinCondition(joinCondition);
checkAddJoincondition(success);
if (success != null) {
constraintCreator.creaWidgetJoinCondition(joinCondition, DTsource, source);
}
} catch (Exception iae) {
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(NbBundle.getMessage(Costanti.class, Costanti.JOINCONDITION_NO), DialogDescriptor.ERROR_MESSAGE));
}
}
示例12: deleteConnection
import org.netbeans.api.visual.widget.LayerWidget; //导入依赖的package包/类
private void deleteConnection() {
LayerWidget connectionLayer = (LayerWidget) connection.getParentWidget();
ConnectionInfo connectionInfo = (ConnectionInfo) connectionLayer.getChildConstraint(connection);
LayerWidget mainLayer = (LayerWidget) connectionInfo.getSourceWidget().getParentWidget();
AbstractCaratteristicheWidgetComposition caratteristicheWidgetCompositionSource = (AbstractCaratteristicheWidgetComposition) mainLayer.getChildConstraint(connectionInfo.getSourceWidget());
AbstractCaratteristicheWidgetComposition caratteristicheWidgetCompositionTarget = (AbstractCaratteristicheWidgetComposition) mainLayer.getChildConstraint(connectionInfo.getTargetWidget());
MutableMappingTask mutableMappingTaskSource = caratteristicheWidgetCompositionSource.getMutableMappingTask();
MutableMappingTask mutableMappingTaskTarget = caratteristicheWidgetCompositionTarget.getMutableMappingTask();
mutableMappingTaskSource.getMutableMappingTasks().remove(mutableMappingTaskTarget);
mutableMappingTaskTarget.getMutableMappingTasks().remove(mutableMappingTaskSource);
// if (connectionInfo.getTargetWidget() instanceof ChainWidget) {
caratteristicheWidgetCompositionTarget.removeSourceScenario((ICompositionWidget) connectionInfo.getSourceWidget());
caratteristicheWidgetCompositionSource.getTargetList().remove((ICompositionWidget) connectionInfo.getTargetWidget());
// } else if (connectionInfo.getTargetWidget() instanceof MergeWidget) {
// }
connection.removeFromParent();
StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(Costanti.class, Costanti.DELETE_CONNECTION));
}
示例13: createConnectionToTargetImpl
import org.netbeans.api.visual.widget.LayerWidget; //导入依赖的package包/类
private ConnectionInfo createConnectionToTargetImpl(Widget sourceWidget, Widget targetWidget, LayerWidget mainLayer, LayerWidget connectionLayer, Stroke stroke) {
ConnectionWidget connection = new ConnectionWidget(sourceWidget.getScene());
connection.setTargetAnchorShape(AnchorShape.TRIANGLE_FILLED);
connection.setSourceAnchor(AnchorFactory.createRectangularAnchor(sourceWidget));
connection.setTargetAnchor(AnchorFactory.createRectangularAnchor(targetWidget));
connection.setStroke(stroke);
CaratteristicheWidgetInterConst caratteristicheWidget = (CaratteristicheWidgetInterConst) mainLayer.getChildConstraint(sourceWidget);
connection.getActions().addAction(ActionFactory.createPopupMenuAction(new MyPopupProviderConnectionConst(sourceWidget.getScene(), caratteristicheWidget)));
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.setTargetWidget(targetWidget);
connectionInfo.setConnectionWidget(connection);
caratteristicheWidget.addConnectionInfo(connectionInfo);
connectionLayer.addChild(connection, connectionInfo);
return connectionInfo;
}
示例14: creaSourceValue
import org.netbeans.api.visual.widget.LayerWidget; //导入依赖的package包/类
private void creaSourceValue(VariableCorrespondence variableCorrespondence) {
ISourceValue sourceValue = variableCorrespondence.getSourceValue();
Scene scene = glassPane.getScene();
LayerWidget mainLayer = glassPane.getMainLayer();
LayerWidget connectionLayer = glassPane.getConnectionLayer();
Point point = calculateRandomPoint(glassPane);
Widget sourceWidget = widgetCreator.createConstantWidgetFromSourceValue(scene, mainLayer, connectionLayer, pannelloPrincipale, point, sourceValue, glassPane);
IDataSourceProxy target = mappingTask.getTargetProxy();
// INode targetNode = finder.findNodeInSchema(variableCorrespondence.getTargetPath(), target);
INode targetNode = finder.findNodeInSchema(variableCorrespondence.getTargetPath().getAbsolutePath(), target);
Widget targetWidget = (Widget) targetNode.getAnnotation(Costanti.PIN_WIDGET_TREE_TGD);
CaratteristicheWidgetInterConst caratteristicheWidget = (CaratteristicheWidgetInterConst) mainLayer.getChildConstraint(sourceWidget);
impostaTipo(sourceValue, caratteristicheWidget);
ConnectionInfo connectionInfo = connectionCreator.createConnectionToTarget(sourceWidget, targetWidget, mainLayer, connectionLayer);
connectionInfo.setVariableCorrespondence(variableCorrespondence);
// connectionInfo.setValueCorrespondence(variableCorrespondence.);
// analisiFiltro.creaWidgetEsisteFiltro(connectionInfo.getConnectionWidget(), connectionInfo);
scene.validate();
}
示例15: creaSourceValue
import org.netbeans.api.visual.widget.LayerWidget; //导入依赖的package包/类
private void creaSourceValue(ValueCorrespondence valueCorrespondence, VariableCorrespondence variableCorrespondence, MappingTask mappingTask) {
ISourceValue sourceValue = valueCorrespondence.getSourceValue();
Scene scene = glassPane.getScene();
LayerWidget mainLayer = glassPane.getMainLayer();
LayerWidget connectionLayer = glassPane.getConnectionLayer();
Point point = calculateRandomPoint(glassPane);
Widget sourceWidget = widgetCreator.createConstantWidgetFromSourceValue(scene, mainLayer, connectionLayer, pannelloPrincipale, point, sourceValue, glassPane);
IDataSourceProxy target = mappingTask.getTargetProxy();
INode targetNode = finder.findNodeInSchema(valueCorrespondence.getTargetPath(), target);
Widget targetWidget = (Widget) targetNode.getAnnotation(Costanti.PIN_WIDGET_TREE);
CaratteristicheWidgetInterConst caratteristicheWidget = (CaratteristicheWidgetInterConst) mainLayer.getChildConstraint(sourceWidget);
impostaTipo(sourceValue, caratteristicheWidget);
ConnectionInfo connectionInfo = connectionCreator.createConnectionToTarget(sourceWidget, targetWidget, mainLayer, connectionLayer);
connectionInfo.setValueCorrespondence(valueCorrespondence);
// analisiFiltro.creaWidgetEsisteFiltro(connectionInfo.getConnectionWidget(), connectionInfo);
scene.validate();
}