本文整理汇总了Java中org.netbeans.api.visual.action.ConnectorState类的典型用法代码示例。如果您正苦于以下问题:Java ConnectorState类的具体用法?Java ConnectorState怎么用?Java ConnectorState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConnectorState类属于org.netbeans.api.visual.action包,在下文中一共展示了ConnectorState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveTargetWidgetCoreDive
import org.netbeans.api.visual.action.ConnectorState; //导入依赖的package包/类
private boolean resolveTargetWidgetCoreDive (Widget[] result, Widget widget, Point parentLocation) {
if (interractionLayer.equals (widget))
return false;
Point widgetLocation = widget.getLocation ();
Point location = new Point (parentLocation.x - widgetLocation.x, parentLocation.y - widgetLocation.y);
if (! widget.getBounds ().contains (location))
return false;
java.util.List<Widget> children = widget.getChildren ();
for (int i = children.size () - 1; i >= 0; i --) {
if (resolveTargetWidgetCoreDive (result, children.get (i), location))
return true;
}
if (! widget.isHitAt (location))
return false;
ConnectorState state = provider.isTargetWidget (sourceWidget, widget);
if (state == ConnectorState.REJECT)
return false;
if (state == ConnectorState.ACCEPT)
result[0] = widget;
return true;
}
示例2: isTargetWidget
import org.netbeans.api.visual.action.ConnectorState; //导入依赖的package包/类
public ConnectorState isTargetWidget(Widget source, Widget target) {
//TODO implementare acnhe la condizione verso una funzione
if ((source instanceof VMDPinWidgetSource && target instanceof VMDPinWidgetTarget) && (source != target) && (target.isEnabled())) {
return ConnectorState.ACCEPT;
}
if ((source instanceof VMDPinWidgetSource && target instanceof FunctionWidget) && (source != target)) {
return ConnectorState.ACCEPT;
}
if ((source instanceof VMDPinWidgetSource && target instanceof VMDPinWidgetSource) && (source != target) && (target.isEnabled())) {
return ConnectorState.ACCEPT;
}
if ((source instanceof VMDPinWidgetSource && target instanceof FunctionalDependencyWidget) && (source != target) && (target.isEnabled())) {
CaratteristicheWidgetInterFunctionalDep caratteristiche = (CaratteristicheWidgetInterFunctionalDep) target.getParentWidget().getChildConstraint(target);
if (caratteristiche.isSource() == null || caratteristiche.isSource()) {
caratteristiche.setSource(Boolean.TRUE);
return ConnectorState.ACCEPT;
}
}
return ConnectorState.REJECT_AND_STOP;
}
示例3: isTargetWidget
import org.netbeans.api.visual.action.ConnectorState; //导入依赖的package包/类
public ConnectorState isTargetWidget(Widget sourceWidget, Widget targetWidget) {
if ((sourceWidget instanceof ChainWidget && targetWidget instanceof ChainWidget) && (sourceWidget != targetWidget)) {
CaratteristicheWidgetChainComposition caratteristicheWidgetChainCompositionSource = (CaratteristicheWidgetChainComposition) mainLayer.getChildConstraint(sourceWidget);
CaratteristicheWidgetChainComposition caratteristicheWidgetChainCompositionTarget = (CaratteristicheWidgetChainComposition) mainLayer.getChildConstraint(targetWidget);
MutableMappingTask mutableMappingTaskSource = caratteristicheWidgetChainCompositionSource.getMutableMappingTask();
MutableMappingTask mutableMappingTaskTarget = caratteristicheWidgetChainCompositionTarget.getMutableMappingTask();
if ((caratteristicheWidgetChainCompositionTarget.getSourceScenario() == null) && !mutableMappingTaskTarget.mutableMappingTasksContains(mutableMappingTaskSource) && !mutableMappingTaskSource.mutableMappingTasksContains(mutableMappingTaskTarget)) {
return ConnectorState.ACCEPT;
}
} else if ((sourceWidget instanceof ChainWidget && targetWidget instanceof MergeWidget) && (sourceWidget != targetWidget)) {
// CaratteristicheWidgetComposition caratteristicheWidgetCompositionSource = (CaratteristicheWidgetComposition) mainLayer.getChildConstraint(sourceWidget);
// CaratteristicheWidgetMergeComposition CaratteristicheWidgetMergeCompositionTarget = (CaratteristicheWidgetMergeComposition) mainLayer.getChildConstraint(targetWidget);
// MutableMappingTask mutableMappingTaskSource = caratteristicheWidgetCompositionSource.getMutableMappingTask();
// MutableMappingTask mutableMappingTaskTarget = CaratteristicheWidgetMergeCompositionTarget.getMutableMappingTask();
// if (||!mutableMappingTaskTarget.mutableMappingTasksContains(mutableMappingTaskSource) && !mutableMappingTaskSource.mutableMappingTasksContains(mutableMappingTaskTarget)) {
return ConnectorState.ACCEPT;
// }
}
return ConnectorState.REJECT_AND_STOP;
}
示例4: dragEnter
import org.netbeans.api.visual.action.ConnectorState; //导入依赖的package包/类
public State dragEnter (Widget widget, WidgetDropTargetDragEvent event) {
ConnectorState acceptable = provider.isAcceptable (widget, event.getPoint (), event.getTransferable ());
if (acceptable == ConnectorState.ACCEPT) {
event.acceptDrag (DnDConstants.ACTION_COPY_OR_MOVE);
return State.CONSUMED;
} else if (acceptable == ConnectorState.REJECT_AND_STOP) {
event.rejectDrag ();
return State.CONSUMED;
}
return State.REJECTED;
}
示例5: dragOver
import org.netbeans.api.visual.action.ConnectorState; //导入依赖的package包/类
public State dragOver (Widget widget, WidgetDropTargetDragEvent event) {
ConnectorState acceptable = provider.isAcceptable (widget, event.getPoint (), event.getTransferable ());
if (acceptable == ConnectorState.ACCEPT) {
event.acceptDrag (DnDConstants.ACTION_COPY_OR_MOVE);
return State.CONSUMED;
} else if (acceptable == ConnectorState.REJECT_AND_STOP) {
event.rejectDrag ();
return State.CONSUMED;
}
return State.REJECTED;
}
示例6: dropActionChanged
import org.netbeans.api.visual.action.ConnectorState; //导入依赖的package包/类
public State dropActionChanged (Widget widget, WidgetDropTargetDragEvent event) {
ConnectorState acceptable = provider.isAcceptable (widget, event.getPoint (), event.getTransferable ());
if (acceptable == ConnectorState.ACCEPT) {
event.acceptDrag (DnDConstants.ACTION_COPY_OR_MOVE);
return State.CONSUMED;
} else if (acceptable == ConnectorState.REJECT_AND_STOP) {
event.rejectDrag ();
return State.CONSUMED;
}
return State.REJECTED;
}
示例7: drop
import org.netbeans.api.visual.action.ConnectorState; //导入依赖的package包/类
public State drop (Widget widget, WidgetDropTargetDropEvent event) {
ConnectorState acceptable = provider.isAcceptable (widget, event.getPoint (), event.getTransferable ());
if (acceptable == ConnectorState.ACCEPT) {
event.acceptDrop (DnDConstants.ACTION_COPY_OR_MOVE);
provider.accept (widget, event.getPoint (), event.getTransferable ());
return State.CONSUMED;
} else if (acceptable == ConnectorState.REJECT_AND_STOP) {
event.rejectDrop ();
return State.CONSUMED;
}
return State.REJECTED;
}
示例8: isTargetWidget
import org.netbeans.api.visual.action.ConnectorState; //导入依赖的package包/类
public ConnectorState isTargetWidget(Widget sourceWidget, Widget targetWidget) {
Object object = findObject(targetWidget);
target = isNode(object) ? (String) object : null;
if (target != null) {
return !source.equals(target) ? ConnectorState.ACCEPT : ConnectorState.REJECT_AND_STOP;
}
return object != null ? ConnectorState.REJECT_AND_STOP : ConnectorState.REJECT;
}
示例9: isReplacementWidget
import org.netbeans.api.visual.action.ConnectorState; //导入依赖的package包/类
public ConnectorState isReplacementWidget(ConnectionWidget connectionWidget, Widget replacementWidget, boolean reconnectingSource) {
Object object = findObject(replacementWidget);
replacementNode = isNode(object) ? (String) object : null;
if (replacementNode != null) {
return ConnectorState.ACCEPT;
}
return object != null ? ConnectorState.REJECT_AND_STOP : ConnectorState.REJECT;
}
示例10: isAcceptable
import org.netbeans.api.visual.action.ConnectorState; //导入依赖的package包/类
/**
* Does @transferable support {@link #dataFlavor}?
*
* @param transferable Transferable that is being tested if it supports the
* data flavor that is accepted by this action.
* @return True if transferable can be dropped on this.
*/
@Override
public final ConnectorState isAcceptable(Widget arg0, Point arg1, Transferable transferable) {
if (transferable.isDataFlavorSupported(dataFlavor)) {
return ConnectorState.ACCEPT;
}
return ConnectorState.REJECT;
}
示例11: isAcceptable
import org.netbeans.api.visual.action.ConnectorState; //导入依赖的package包/类
@Override
public final ConnectorState isAcceptable(Widget arg0, Point arg1, Transferable transferable) {
if (transferable.isDataFlavorSupported(dataFlavor)) {
return ConnectorState.ACCEPT;
}
return ConnectorState.REJECT;
}
示例12: isAcceptable
import org.netbeans.api.visual.action.ConnectorState; //导入依赖的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;
}
示例13: isAcceptable
import org.netbeans.api.visual.action.ConnectorState; //导入依赖的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.paintImmediately(0, 0, visRect.width - visRect.x, visRect.height - visRect.y);
point = scene.convertSceneToView(point);
g2.drawImage(dragImage,
AffineTransform.getTranslateInstance(widget.getLocation().x + point.getLocation().getX(),
widget.getLocation().y + point.getLocation().getY()),
null);
if (subCategoryInfo.getModelerDocument().getFlowDimension() == FlowDimensionType.BOUNDARY
|| INodeWidget.class.isAssignableFrom(subCategoryInfo.getModelerDocument().getWidget())//INodeWidget item skipped
|| !((IPNodeWidget) widget).isValidPinWidget(subCategoryInfo)) {
return ConnectorState.REJECT;
}
}
return retVal;
}
示例14: isReplacementWidget
import org.netbeans.api.visual.action.ConnectorState; //导入依赖的package包/类
@Override
public ConnectorState isReplacementWidget(ConnectionWidget connectionWidget, Widget replacementWidget, boolean reconnectingSource) {
Object object = scene.findObject(replacementWidget);
replacementNode = scene.isNode(object) ? (NodeWidgetInfo) object : null;
if (replacementNode != null) {
return ConnectorState.ACCEPT;
}
return object != null ? ConnectorState.REJECT_AND_STOP : ConnectorState.REJECT;
}
示例15: isTargetWidget
import org.netbeans.api.visual.action.ConnectorState; //导入依赖的package包/类
@Override
public ConnectorState isTargetWidget(Widget src, Widget trg) {
if (trg instanceof IStartFlowNodeWidget || src instanceof IEndFlowNodeWidget) {
return ConnectorState.REJECT;
} else {
return src != trg && trg instanceof AbstractNodeWidget ? ConnectorState.ACCEPT : ConnectorState.REJECT;
}
}