本文整理汇总了Java中org.jgraph.event.GraphModelListener类的典型用法代码示例。如果您正苦于以下问题:Java GraphModelListener类的具体用法?Java GraphModelListener怎么用?Java GraphModelListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GraphModelListener类属于org.jgraph.event包,在下文中一共展示了GraphModelListener类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TBoard
import org.jgraph.event.GraphModelListener; //导入依赖的package包/类
/**
* Creates a new <code>TBoard</code> with the specified initial
* <code>model</code>.
*
* @param model The specified initial <code>model</code>
*/
public TBoard(TBoardModel model) {
super();
// Set the Tolerance to 2 Pixel
setTolerance(2);
// Allows resize
setSizeable(true);
// Allows control-drag
setCloneable(false);
// Does not allow connections
setConnectable(false);
setDisconnectable(false);
setBendable(false);
// Does not allow in-place editing
setEditable(false);
// Set anti-aliased
setAntiAliased(true);
// Set layout cache
setGraphLayoutCache(new TBoardLayoutCache());
// Set model
model.addGraphModelListener(new GraphModelListener() {
public void graphChanged(GraphModelEvent e) {
// Check if model size has been modified and update the board
// minimum size
Map attributes = (Map)e.getChange().getAttributes();
if (attributes != null)
attributes = (Map)attributes.get(getModel());
if (attributes != null)
if (attributes.containsKey(TBoardConstants.SIZE))
setMinimumSize(TBoardConstants.getSize(attributes));
// Fire change
fireBoardChange();
}
});
setModel(model);
// Set minimum size
setMinimumSize(TBoardConstants.getSize(getAttributes(null)));
}
示例2: getRefreshGraphListener
import org.jgraph.event.GraphModelListener; //导入依赖的package包/类
private GraphModelListener getRefreshGraphListener() {
if (this.refreshListener == null) {
this.refreshListener = new RefreshGraphListener();
}
return this.refreshListener;
}