本文整理汇总了Java中org.netbeans.modeler.widget.pin.IPinWidget类的典型用法代码示例。如果您正苦于以下问题:Java IPinWidget类的具体用法?Java IPinWidget怎么用?Java IPinWidget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPinWidget类属于org.netbeans.modeler.widget.pin包,在下文中一共展示了IPinWidget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: attachEdgeTargetAnchor
import org.netbeans.modeler.widget.pin.IPinWidget; //导入依赖的package包/类
/**
* Called by the setEdgeTarget method to notify about the changing the edge
* target in the graph model. The method is responsible for attaching a new
* target pin to the edge in the visual representation.
* <p>
* Usually it is implemented as:
* <pre>
* Widget targetPinWidget = findWidget (targetPin);
* Anchor targetAnchor = AnchorFactory.createRectangularAnchor (targetPinWidget)
* ConnectionWidget edgeWidget = (ConnectionWidget) findWidget (edge);
* edgeWidget.setTargetAnchor (targetAnchor);
* </pre>
*
* @param edge the edge which target is changed in graph model
* @param oldTargetPin the old target pin
* @param targetPin the new target pin
*/
@Override
protected void attachEdgeTargetAnchor(EdgeWidgetInfo edgeWidgetInfo, PinWidgetInfo oldTargetPin, PinWidgetInfo targetPinInfo) {
IEdgeWidget edgeWidget = (IEdgeWidget) findWidget(edgeWidgetInfo);
if (targetPinInfo == null) {//called in case of edge remove
edgeWidget.setTargetAnchor(null);
return;
}
IPinWidget targetPinWidget = (IPinWidget) findWidget(targetPinInfo);
if (targetPinWidget != null) {
NBModelerUtil.attachEdgeTargetAnchor((IModelerScene) this, edgeWidget, targetPinWidget);
} else {
INodeWidget targetNodeWidget = (INodeWidget) findWidget(getPinNode(targetPinInfo));
NBModelerUtil.attachEdgeTargetAnchor((IModelerScene) this, edgeWidget, targetNodeWidget);
}
if (edgeWidget instanceof IBaseElementWidget) {
((IBaseElementWidget) edgeWidget).init();
}
}
示例2: createPinWidget
import org.netbeans.modeler.widget.pin.IPinWidget; //导入依赖的package包/类
@Override
public IPinWidget createPinWidget(NodeWidgetInfo node, PinWidgetInfo pin) {
IPinWidget pinWidget = (IPinWidget) this.addPin(node, pin);
if (pinWidget instanceof IBaseElementWidget) {
if (pin.getBaseElementSpec() != null) {
((IBaseElementWidget) pinWidget).setBaseElementSpec(pin.getBaseElementSpec());
}
((IBaseElementWidget) pinWidget).init();
}
if (pinWidget != null) {
pinWidget.getModelerScene().getModelerFile().getModelerDiagramEngine().setPinWidgetAction(pinWidget);
}
return pinWidget;
}
示例3: setText
import org.netbeans.modeler.widget.pin.IPinWidget; //导入依赖的package包/类
@Override
public void setText(Widget widget, String text) {
if (connector instanceof INodeWidget) {
((INodeWidget) connector).setLabel(text);
if (connector instanceof IFlowNodeWidget) {
((IFlowNodeWidget) connector).setName(text);
}
((INodeWidget) connector).getModelerScene().getModelerPanelTopComponent().changePersistenceState(false);
} else if (connector instanceof IEdgeWidget) {
((IEdgeWidget) connector).setLabel(text);
if (connector instanceof IFlowEdgeWidget) {
((IFlowEdgeWidget) connector).setName(text);
}
((IEdgeWidget) connector).getModelerScene().getModelerPanelTopComponent().changePersistenceState(false);
} else if (connector instanceof IPinWidget) {
((IPinWidget) connector).setLabel(text);
if (connector instanceof IFlowPinWidget) {
((IFlowPinWidget) connector).setName(text);
}
((IPinWidget) connector).getModelerScene().getModelerPanelTopComponent().changePersistenceState(false);
}
}
示例4: select
import org.netbeans.modeler.widget.pin.IPinWidget; //导入依赖的package包/类
@Override
public void select(Widget widget, Point localLocation, boolean invertSelection) {
IPinWidget pinWidget = (IPinWidget) widget;
IModelerScene modelerScene = pinWidget.getModelerScene();
Object object = modelerScene.findObject(widget);
modelerScene.setFocusedObject(object);
if (object != null) {
if (!invertSelection && modelerScene.getSelectedObjects().contains(object)) {
return;
}
modelerScene.userSelectionSuggested(Collections.singleton(object), invertSelection);
} else {
modelerScene.userSelectionSuggested(Collections.emptySet(), invertSelection);
}
NBModelerUtil.showContextPalette(pinWidget.getModelerScene(), pinWidget);
pinWidget.exploreProperties();
}
示例5: cleanReference
import org.netbeans.modeler.widget.pin.IPinWidget; //导入依赖的package包/类
private void cleanReference(List<Widget> children) { //PinWidget children lost after NodeWidget remove method called
if (this.getPropertyManager() != null) {
this.getPropertyManager().getElementPropertySet().clearGroups();//clear ElementSupportGroup
}
for (Widget childWidget : children) {
if (childWidget instanceof IPinWidget) {
((IPinWidget) childWidget).cleanReference();
}
}
this.getModelerScene().getModelerFile().getModelerDiagramEngine().clearNodeWidgetAction(this);
cleanActions(getNodeNameWidget().getActions());
cleanActions(getHeader().getActions());
cleanActions(getMinimizeButton().getActions());
cleanActions(getImageWidget().getActions());
}
示例6: addMoveModel
import org.netbeans.modeler.widget.pin.IPinWidget; //导入依赖的package包/类
private static void addMoveModel(ContextPaletteModel contextPaletteModel, IPinWidget pinWidget) {
ContextPaletteButtonModel upModel = new DefaultPaletteButtonModel();
upModel.setImage(UP_ICON);
upModel.setTooltip("Move Up");
upModel.setPaletteModel(contextPaletteModel);
upModel.setMouseListener(getMoveWidgetAction(pinWidget, -1));
upModel.checkVisibility(() -> checkMoveWidgetVisibility(pinWidget, -1));
contextPaletteModel.getChildren().add(upModel);
ContextPaletteButtonModel downModel = new DefaultPaletteButtonModel();
downModel.setImage(DOWN_ICON);
downModel.setTooltip("Move Down");
downModel.setPaletteModel(contextPaletteModel);
downModel.setMouseListener(getMoveWidgetAction(pinWidget, 1));
downModel.checkVisibility(() -> checkMoveWidgetVisibility(pinWidget, 1));
contextPaletteModel.getChildren().add(downModel);
}
示例7: print
import org.netbeans.modeler.widget.pin.IPinWidget; //导入依赖的package包/类
public void print() {
StringBuilder message = new StringBuilder();
signalList.keySet().stream().forEach((signalKey) -> {
message.append(signalList.get(signalKey)).append(". ").append('\n');
});
IWidgetStateHandler handler = widget instanceof INodeWidget ? ((IPNodeWidget) widget).getWidgetStateHandler() : (widget instanceof IPinWidget ? ((IPinWidget) widget).getWidgetStateHandler() : null);
ImageWidget imageWidget = widget instanceof INodeWidget ? ((IPNodeWidget) widget).getImageWidget() : (widget instanceof IPinWidget ? ((IPinWidget) widget).getImageWidget() : null);
if (message.length() != 0) {
if (imageWidget != null) {
imageWidget.setToolTipText(message.toString());
}
if (handler != null) {
handler.applyState(getStateType());
}
} else {
if (imageWidget != null) {
imageWidget.setToolTipText(null);
}
if (handler != null) {
handler.clearState(getStateType());
}
manager.signalNext();
}
}
示例8: deletePinWidget
import org.netbeans.modeler.widget.pin.IPinWidget; //导入依赖的package包/类
@Override
public void deletePinWidget(IPinWidget pinWidget) {
if (this.isPin(pinWidget.getPinWidgetInfo())) {
this.removePin(pinWidget.getPinWidgetInfo());
if (pinWidget instanceof IBaseElementWidget) {
((IBaseElementWidget) pinWidget).destroy();
}
} else {
LOG.warning("pin not found");
}
}
示例9: getPinAnchor
import org.netbeans.modeler.widget.pin.IPinWidget; //导入依赖的package包/类
@Override
public Anchor getPinAnchor(IPinWidget pin) {
if (pin == null) {
return null;//nodeWidget.getNodeAnchor();
}
IPNodeWidget nodeWidget = pin.getPNodeWidget();
Anchor anchor;
anchor = AnchorFactory.createDirectionalAnchor((Widget) pin, AnchorFactory.DirectionalAnchorKind.HORIZONTAL, 8);
anchor = nodeWidget.createAnchorPin(anchor);
return anchor;
}
示例10: isAcceptable
import org.netbeans.modeler.widget.pin.IPinWidget; //导入依赖的package包/类
@Override
public ConnectorState isAcceptable(Widget widget, Point point, Transferable transferable) {
ConnectorState retVal = ConnectorState.ACCEPT;
if (isWidgetMove(transferable)) {
Widget[] target = new Widget[]{getWidget(transferable)};
for (Widget curWidget : target) {
if (curWidget instanceof NodeWidget) {
NodeWidget nodeWidget = (NodeWidget) curWidget;
if (nodeWidget.getNodeWidgetInfo().getModelerDocument().getFlowDimension() == FlowDimensionType.BOUNDARY) {
retVal = ConnectorState.REJECT;
return retVal;
}
}
}
} else if (isPaletteItem(transferable)) {
SubCategoryNodeConfig subCategoryInfo = getSubCategory(transferable);
Image dragImage = subCategoryInfo.getImage();
JComponent view = scene.getView();
Graphics2D g2 = (Graphics2D) view.getGraphics();
Rectangle visRect = scene.getBounds();//view.getVisibleRect();//
view.paintImmediately(0, 0, visRect.width - visRect.x, visRect.height - visRect.y);//(visRect.x, visRect.y, visRect.width, visRect.height);
g2.drawImage(dragImage,
AffineTransform.getTranslateInstance(point.getLocation().getX() - visRect.x,
point.getLocation().getY() - visRect.y),
null);
if (subCategoryInfo.getModelerDocument().getFlowDimension() == FlowDimensionType.BOUNDARY
|| IPinWidget.class.isAssignableFrom(subCategoryInfo.getModelerDocument().getWidget())) {
scene.repaint();
return ConnectorState.REJECT;
}
}
return retVal;
}
示例11: installUI
import org.netbeans.modeler.widget.pin.IPinWidget; //导入依赖的package包/类
@Override
public void installUI(IPinWidget widget) {
widget.setBorder(OPAQUE_BORDER);
Rectangle bound = widget.getBounds();
if (bound != null) {
GradientPaint gp = new GradientPaint(bound.x, bound.y, PIN_WIDGET_BACKGROUND, bound.x, bound.height, PIN_WIDGET_LBACKGROUND);
widget.setBackground(gp);
}
widget.getPinNameWidget().setForeground(widget.getTextDesign().getColor()!=null?widget.getTextDesign().getColor():PIN_WIDGET_TEXT_COLOR);
Font font = widget.getPinNameWidget().getFont()!=null?widget.getPinNameWidget().getFont():widget.getScene().getDefaultFont();
widget.getPinNameWidget().setFont(font.deriveFont(widget.getTextDesign().getStyle(), widget.getTextDesign().getSize()));
}
示例12: installUI
import org.netbeans.modeler.widget.pin.IPinWidget; //导入依赖的package包/类
@Override
public void installUI(IPinWidget widget) {
widget.setBorder(BORDER_PIN);
widget.setBackground(COLOR60_HOVER_BACKGROUND);
widget.getPinNameWidget().setForeground(widget.getTextDesign().getColor()!=null?widget.getTextDesign().getColor():Color.BLACK);
Font font = widget.getPinNameWidget().getFont()!=null?widget.getPinNameWidget().getFont():widget.getScene().getDefaultFont();
widget.getPinNameWidget().setFont(font.deriveFont(widget.getTextDesign().getStyle(), widget.getTextDesign().getSize()));
}
示例13: updateUI
import org.netbeans.modeler.widget.pin.IPinWidget; //导入依赖的package包/类
@Override
public void updateUI(IPinWidget widget, ObjectState previousState, ObjectState state) {
widget.setOpaque(state.isHovered() || state.isFocused());
if (state.isSelected()) {
widget.setBorder(BORDER60_PIN_SELECT);
} else {
widget.setBorder(BORDER_PIN);
}
}
示例14: installUI
import org.netbeans.modeler.widget.pin.IPinWidget; //导入依赖的package包/类
@Override
public void installUI(IPinWidget widget) {
widget.setBorder(OPAQUE_BORDER);
widget.setBackground(PIN_WIDGET_BACKGROUND);
widget.getPinNameWidget().setForeground(widget.getTextDesign().getColor()!=null?widget.getTextDesign().getColor():PIN_WIDGET_TEXT_COLOR);
Font font = widget.getPinNameWidget().getFont()!=null?widget.getPinNameWidget().getFont():widget.getScene().getDefaultFont();
widget.getPinNameWidget().setFont(font.deriveFont(widget.getTextDesign().getStyle(), widget.getTextDesign().getSize()));
}
示例15: installUI
import org.netbeans.modeler.widget.pin.IPinWidget; //导入依赖的package包/类
@Override
public void installUI(IPinWidget widget) {
widget.setBorder(BORDER_PIN);
widget.setBackground(PIN_WIDGET_HOVER_BACKGROUND);
widget.getPinNameWidget().setForeground(widget.getTextDesign().getColor()!=null?widget.getTextDesign().getColor():WIDGET_HOVER_BACKGROUND);
Font font = widget.getPinNameWidget().getFont()!=null?widget.getPinNameWidget().getFont():widget.getScene().getDefaultFont();
widget.getPinNameWidget().setFont(font.deriveFont(widget.getTextDesign().getStyle(), widget.getTextDesign().getSize()));
}