本文整理汇总了Java中org.netbeans.api.visual.layout.LayoutFactory类的典型用法代码示例。如果您正苦于以下问题:Java LayoutFactory类的具体用法?Java LayoutFactory怎么用?Java LayoutFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LayoutFactory类属于org.netbeans.api.visual.layout包,在下文中一共展示了LayoutFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ListWidget
import org.netbeans.api.visual.layout.LayoutFactory; //导入依赖的package包/类
/**
* Creates a list widget.
* @param scene the scene
*/
public ListWidget (Scene scene) {
super (scene);
LookFeel lookFeel = scene.getLookFeel ();
setOpaque (true);
setBackground (lookFeel.getBackground ());
setBorder (BorderFactory.createLineBorder ());
setLayout (LayoutFactory.createVerticalFlowLayout ());
header = new Widget (scene);
header.setLayout (LayoutFactory.createHorizontalFlowLayout (LayoutFactory.SerialAlignment.CENTER, 0));
header.addChild (imageWidget = new ImageWidget (scene));
header.addChild (labelWidget = new LabelWidget (scene));
addChild (header);
addChild (new SeparatorWidget (scene, SeparatorWidget.Orientation.HORIZONTAL));
setState (ObjectState.createNormal ());
}
示例2: select
import org.netbeans.api.visual.layout.LayoutFactory; //导入依赖的package包/类
public void select (Widget widget, Point localLocation, boolean invertSelection) {
Widget currentActiveCard = LayoutFactory.getActiveCard (cardLayoutWidget);
List<Widget> children = cardLayoutWidget.getChildren ();
int i = children.indexOf (currentActiveCard);
i ++;
if (i >= children.size ())
i = 0;
Widget newActiveCard = children.get (i);
if (currentActiveCard == newActiveCard)
return;
LayoutFactory.setActiveCard (cardLayoutWidget, newActiveCard);
// notifyCardSwitched (currentActiveCard, newActiveCard);
}
示例3: calculateBestCenterAlignment
import org.netbeans.api.visual.layout.LayoutFactory; //导入依赖的package包/类
private LayoutFactory.ConnectionWidgetLayoutAlignment calculateBestCenterAlignment(Point point, Rectangle bounds) {
LayoutFactory.ConnectionWidgetLayoutAlignment retVal = LayoutFactory.ConnectionWidgetLayoutAlignment.NONE;
if(bounds != null) {
if(point.x <= bounds.x) {
retVal = LayoutFactory.ConnectionWidgetLayoutAlignment.CENTER_LEFT;
} else if(point.x >= (bounds.x + bounds.width)) {
retVal = LayoutFactory.ConnectionWidgetLayoutAlignment.CENTER_RIGHT;
} else if(point.y <= bounds.y) {
retVal = LayoutFactory.ConnectionWidgetLayoutAlignment.TOP_CENTER;
} else if(point.y >= (bounds.y + bounds.height)) {
retVal = LayoutFactory.ConnectionWidgetLayoutAlignment.BOTTOM_CENTER;
}
}
return retVal;
}
示例4: VMDGraphScene
import org.netbeans.api.visual.layout.LayoutFactory; //导入依赖的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));
}
示例5: ListWidget
import org.netbeans.api.visual.layout.LayoutFactory; //导入依赖的package包/类
/**
* Creates a list widget.
* @param scene the scene
*/
public ListWidget (Scene scene) {
super (scene);
GeomUtil.LOG.warning ("org.netbeans.api.visual.widget.general.ListWidget class is deprecated. Use org.netbeans.modules.visual.experimental.widget.general.ListWidget class instead. Since it is an experimental class outside of public-API packages, you have to set an implementation dependency on the org.netbeans.api.visual module."); // NOI18N
LookFeel lookFeel = scene.getLookFeel ();
setOpaque (true);
setBackground (lookFeel.getBackground ());
setBorder (BorderFactory.createLineBorder ());
setLayout (LayoutFactory.createVerticalFlowLayout ());
header = new Widget (scene);
header.setLayout (LayoutFactory.createHorizontalFlowLayout (LayoutFactory.SerialAlignment.CENTER, 0));
header.addChild (imageWidget = new ImageWidget (scene));
header.addChild (labelWidget = new LabelWidget (scene));
addChild (header);
addChild (new SeparatorWidget (scene, SeparatorWidget.Orientation.HORIZONTAL));
setState (ObjectState.createNormal ());
}
示例6: IconNodeWidget
import org.netbeans.api.visual.layout.LayoutFactory; //导入依赖的package包/类
/**
* Creates an icon node widget with a specified orientation.
* @param scene the scene
* @param orientation the text orientation
*/
public IconNodeWidget (Scene scene, TextOrientation orientation) {
super (scene);
LookFeel lookFeel = getScene ().getLookFeel ();
switch (orientation) {
case BOTTOM_CENTER:
setLayout (LayoutFactory.createVerticalFlowLayout (LayoutFactory.SerialAlignment.CENTER, - lookFeel.getMargin () + 1));
break;
case RIGHT_CENTER:
setLayout (LayoutFactory.createHorizontalFlowLayout (LayoutFactory.SerialAlignment.CENTER, - lookFeel.getMargin () + 1));
break;
}
imageWidget = new ImageWidget (scene);
addChild (imageWidget);
labelWidget = new LabelWidget (scene);
labelWidget.setFont (scene.getDefaultFont ().deriveFont (14.0f));
addChild (labelWidget);
setState (ObjectState.createNormal ());
}
示例7: TLScene
import org.netbeans.api.visual.layout.LayoutFactory; //导入依赖的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);
}
示例8: AxisWidget
import org.netbeans.api.visual.layout.LayoutFactory; //导入依赖的package包/类
AxisWidget(Scene scene, TLEntity entity, String text, int stripHeight, Border border) {
super(scene, entity);
this.setLayout(LayoutFactory.createAbsoluteLayout());
this.stripHeight = stripHeight;
this.nameWidget = new LabelWidget(scene, text);
this.addChild(nameWidget);
this.revalidate();
this.updateNameLocation();
this.stripWidget = new StripWidget(scene, entity, border);
this.addChild(stripWidget);
this.revalidate();
this.updateStripRange();
}
示例9: EntityWidget
import org.netbeans.api.visual.layout.LayoutFactory; //导入依赖的package包/类
public EntityWidget(TLScene scene, TLEntity entity) {
super(scene);
this.entity = entity;
setLayout(LayoutFactory.createVerticalFlowLayout());
// create a strip widget
this.stripWidget = new EntityAxisStrip(scene, entity);
this.addChild(stripWidget);
entity.addListener(updateEndTimeListener);
entity.addListener(addLogRecorderListener);
for (TLLogRecorder logRecorder : entity.getLogRecorders()) {
this.addLogCategoryWidget(logRecorder);
}
scene.validate();
}
示例10: childElementRemoved
import org.netbeans.api.visual.layout.LayoutFactory; //导入依赖的package包/类
@Override
public void childElementRemoved(TRIGGER_OWNER triggerOwner, PoshElement child, int removedChildIndex) {
if (isSense(child)) {
// XXX: This is rather unpleasant hack, I should use custom layout or something. What I want is to have gap when trigger has at least one sense in it, but no gap, when there is not sense in the trigger.
if (trigger.isEmpty()) {
triggerEnvelope.getParentWidget().setLayout(LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.LEFT_TOP, 0));
}
ShedSenseWidget removedSenseWidget = triggerEnvelope.getChild(removedChildIndex);
triggerEnvelope.remove(removedSenseWidget);
boolean triggerIsEmpty = (triggerEnvelope.numberOfChildren() == 0);
boolean removedSenseWasLast = (removedChildIndex == triggerEnvelope.numberOfChildren());
boolean triggerIsMissingArrow = (!triggerIsEmpty && !removedSenseWasLast);
if (triggerIsMissingArrow) {
Anchor sourceAnchor = getAnchorBeforePosition(removedChildIndex);
Anchor targetAnchor = triggerEnvelope.getChild(removedChildIndex).getCommonAnchor();
scene.addArrow(sourceAnchor, targetAnchor);
}
scene.update();
}
}
示例11: GhostWidget
import org.netbeans.api.visual.layout.LayoutFactory; //导入依赖的package包/类
/**
* Create a new GhostWidget based on information about original widget
* @param original widget we will use info (headline, comment) from.
*/
GhostWidget(PoshWidget original) {
super(original.getPoshScene());
associatedWidget = original;
scene = original.getPoshScene();
headline = new LabelWidget(original.getPoshScene(),
original.getHeadlineText());
comment = new LabelWidget(original.getPoshScene(),
original.getCommentText());
headline.setFont(headlineFont);
comment.setFont(commentFont);
this.setBorder(BorderFactory.createRoundedBorder(15, 15, 4, 4, original.getType().getColor(), Color.DARK_GRAY));
this.setForeground(Color.BLACK);
this.setPreferredLocation(original.getLocation());
this.setMinimumSize(new Dimension(120, 10));
this.setLayout(LayoutFactory.createVerticalFlowLayout());
this.addChild(headline);
this.addChild(comment);
}
示例12: setSceneLayout
import org.netbeans.api.visual.layout.LayoutFactory; //导入依赖的package包/类
public void setSceneLayout(int newLayout) {
GraphLayout<CfgNode, CfgEdge> graphLayout = null;
switch (newLayout) {
case CfgEditorContext.LAYOUT_HIERARCHICALNODELAYOUT:
graphLayout = new HierarchicalNodeLayout(this);
break;
case CfgEditorContext.LAYOUT_HIERARCHICALCOMPOUNDLAYOUT:
graphLayout = new HierarchicalCompoundLayout(this);
break;
}
this.currentLayout = newLayout;
if (graphLayout != null) {
this.sceneLayout = LayoutFactory.createSceneGraphLayout(this, graphLayout);
}
getPreferences().putInt(PREFERENCE_LAYOUT, newLayout);
sceneLayout.invokeLayoutImmediately();
}
示例13: ControlFlowScene
import org.netbeans.api.visual.layout.LayoutFactory; //导入依赖的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));
}
示例14: LabelConnectionWidget
import org.netbeans.api.visual.layout.LayoutFactory; //导入依赖的package包/类
public LabelConnectionWidget(Scene scene, String name) {
super(scene);
this.scene = (IModelerScene) scene;
labelWidget = new MultilineEditableCompartmentWidget(scene, name, null,
this, "getResourcePath()", name);
labelWidget.setAlignment(LabelWidget.Alignment.CENTER);
label = labelWidget;
setLayout(LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.CENTER, 1)); // use vertical layout
setBorder(NON_SELECTED_BORDER);
// labelWidget = (LabelWidget) label;
addChild(label);
// setLayout(LayoutFactory.createVerticalFlowLayout());
initActions();
}
示例15: AbstractNodeWidget
import org.netbeans.api.visual.layout.LayoutFactory; //导入依赖的package包/类
/**
* Creates an icon node widget with a specified orientation.
*
* @param scene the scene
* @param orientation the text orientation
* @param textDesign
*/
public AbstractNodeWidget(IModelerScene scene, TextOrientation orientation, ITextDesign textDesign) {
super((Scene) scene);
this.textDesign = textDesign;
LookFeel lookFeel = getScene().getLookFeel();
switch (orientation) {
case BOTTOM_CENTER:
setLayout(LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.CENTER, -lookFeel.getMargin() + 1));
break;
case RIGHT_CENTER:
setLayout(LayoutFactory.createHorizontalFlowLayout(LayoutFactory.SerialAlignment.CENTER, -lookFeel.getMargin() + 1));
break;
}
setState(ObjectState.createNormal());
}