本文整理汇总了Java中edu.uci.ics.jung.visualization.control.ModalGraphMouse.Mode类的典型用法代码示例。如果您正苦于以下问题:Java Mode类的具体用法?Java Mode怎么用?Java Mode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Mode类属于edu.uci.ics.jung.visualization.control.ModalGraphMouse包,在下文中一共展示了Mode类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MouseTransformPickPopupMenuListener
import edu.uci.ics.jung.visualization.control.ModalGraphMouse.Mode; //导入依赖的package包/类
/**
* Method setPlaysheet. Sets the playsheet that the listener will access.
*
* @param ps IPlaySheet
* @param m
*/
public MouseTransformPickPopupMenuListener( VisualizationViewer ps, Mode m ) {
super( ( Mode.TRANSFORMING == m ? "Move" : "Pick" ) + " Graph" );
String desc = ( Mode.TRANSFORMING == m
? "Move entire graph as a single unit" : "Pick specific nodes" );
putValue( Action.SHORT_DESCRIPTION, desc );
this.ps = ps;
mode = m;
}
示例2: actionPerformed
import edu.uci.ics.jung.visualization.control.ModalGraphMouse.Mode; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
// changes mouse based on what is selected
GraphPlaySheet ps2 = (GraphPlaySheet)ps;
((ModalGraphMouse)ps2.getView().getGraphMouse()).setMode(Mode.TRANSFORMING);
}
示例3: actionPerformed
import edu.uci.ics.jung.visualization.control.ModalGraphMouse.Mode; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
// changes mouse based on what is selected
GraphPlaySheet ps2 = (GraphPlaySheet)ps;
((ModalGraphMouse)ps2.getView().getGraphMouse()).setMode(Mode.PICKING);
}
示例4: JungVisualizationViewer
import edu.uci.ics.jung.visualization.control.ModalGraphMouse.Mode; //导入依赖的package包/类
public JungVisualizationViewer(GraphMatrixWrapper<N, E> graph, boolean showNodeLabels, boolean showEdgeLabels) {
super(graph.getGraphMatrix().getGUIObject());
this.graph = graph;
this.graphMatrix = graph.getGraphMatrix();
this.matrixGUIObject = (MatrixGUIObject) graphMatrix.getGUIObject();
this.showNodeLabels = showNodeLabels;
this.showEdgeLabels = showEdgeLabels;
if (graph.getVertexCount() < 1000) {
layout = new FRLayout<N, EdgeWrapper<E>>(graph);
} else {
layout = new ISOMLayout<N, EdgeWrapper<E>>(graph);
}
VisualizationModel<N, EdgeWrapper<E>> visualizationModel = new DefaultVisualizationModel<N, EdgeWrapper<E>>(
layout);
vv = new VisualizationViewer<N, EdgeWrapper<E>>(visualizationModel);
vv.setForeground(new Color(0, 0, 0, 150));
vv.setBackground(Color.WHITE);
DefaultModalGraphMouse<N, E> graphMouse = new DefaultModalGraphMouse<N, E>();
vv.setGraphMouse(graphMouse);
graphMouse.setMode(Mode.PICKING);
RenderContext<N, EdgeWrapper<E>> rc = vv.getRenderContext();
emptyNodeLabelTransformer = rc.getVertexLabelTransformer();
emptyEdgeLabelTransformer = rc.getEdgeLabelTransformer();
rc.setVertexIconTransformer(new VertexIconTransformer<N>(vv.getPickedVertexState()));
rc.setVertexFillPaintTransformer(new ColorTransformer<N>(vv.getPickedVertexState()));
rc.setVertexLabelRenderer(new DefaultVertexLabelRenderer(UIDefaults.SELECTEDCOLOR));
rc.setEdgeDrawPaintTransformer(new ColorTransformer<EdgeWrapper<E>>(vv.getPickedEdgeState()));
rc.setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(UIDefaults.SELECTEDCOLOR));
rc.setArrowFillPaintTransformer(new ColorTransformer<EdgeWrapper<E>>(vv.getPickedEdgeState()));
rc.setArrowDrawPaintTransformer(new ColorTransformer<EdgeWrapper<E>>(vv.getPickedEdgeState()));
vv.getRenderer().getVertexLabelRenderer().setPositioner(new InsidePositioner());
vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.AUTO);
if (showNodeLabels) {
rc.setVertexLabelTransformer(new ToStringLabeller<N>());
}
if (showEdgeLabels) {
rc.setEdgeLabelTransformer(new ToStringLabeller<EdgeWrapper<E>>());
}
vv.setVertexToolTipTransformer(new ToStringLabeller<N>());
setLayout(new BorderLayout());
add(vv, BorderLayout.CENTER);
vv.addMouseListener(this);
addComponentListener(this);
vv.addGraphMouseListener(this);
if (graph instanceof GraphMatrixWrapper) {
((MatrixGUIObject) ((GraphMatrixWrapper<N, E>) graph).getGraphMatrix().getGUIObject())
.addTableModelListener(this);
}
}
示例5: getListCellRendererComponent
import edu.uci.ics.jung.visualization.control.ModalGraphMouse.Mode; //导入依赖的package包/类
public Component getListCellRendererComponent(JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus) {
if(value.equals(Mode.TRANSFORMING))
{
setText("Pan");
}
else if (value.equals(Mode.PICKING))
{
setText("Grab");
}
Color background;
Color foreground;
// check if this cell represents the current DnD drop location
JList.DropLocation dropLocation = list.getDropLocation();
if (dropLocation != null
&& !dropLocation.isInsert()
&& dropLocation.getIndex() == index) {
background = Color.BLUE;
foreground = Color.WHITE;
// check if this cell is selected
} else if (isSelected) {
background = Color.RED;
foreground = Color.WHITE;
// unselected, and not the DnD drop location
} else {
background = Color.WHITE;
foreground = Color.BLACK;
};
setBackground(background);
setForeground(foreground);
return this;
}
示例6: addTransformingModeOptions
import edu.uci.ics.jung.visualization.control.ModalGraphMouse.Mode; //导入依赖的package包/类
private HBox addTransformingModeOptions() {
HBox hBox = new HBox();
hBox.setPadding(new Insets(15, 12, 15, 12));
hBox.setSpacing(10);
hBox.setStyle("-fx-background-color: #66FFFF;");
final ToggleGroup optionGroup = new ToggleGroup();
Label lblMouseMode = new Label("Mouse Mode: ");
lblMouseMode.setPrefSize(100, 20);
RadioButton rbTransform = new RadioButton("Pan & Zoom");
rbTransform.setPrefSize(100, 20);
rbTransform.setToggleGroup(optionGroup);
rbTransform.setUserData("T");
rbTransform.setSelected(true);
RadioButton rbPick = new RadioButton("Picking");
rbPick.setPrefSize(100, 20);
rbPick.setUserData("P");
rbPick.setToggleGroup(optionGroup);
optionGroup.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
@Override
public void changed(ObservableValue<? extends Toggle> observable,
Toggle oldValue, Toggle newValue) {
if (optionGroup.getSelectedToggle() != null){
DefaultModalGraphMouse dmg = (DefaultModalGraphMouse) vv.getGraphMouse();
if (optionGroup.getSelectedToggle().getUserData().equals("T")){
dmg.setMode(Mode.TRANSFORMING);
} else if (optionGroup.getSelectedToggle().getUserData().equals("P")){
dmg.setMode(Mode.PICKING);
}
}
}
});
hBox.getChildren().addAll(lblMouseMode, rbTransform, rbPick);
return hBox;
}