本文整理汇总了Java中org.jgraph.graph.GraphConstants.setIcon方法的典型用法代码示例。如果您正苦于以下问题:Java GraphConstants.setIcon方法的具体用法?Java GraphConstants.setIcon怎么用?Java GraphConstants.setIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jgraph.graph.GraphConstants
的用法示例。
在下文中一共展示了GraphConstants.setIcon方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rotateComponent
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
/**
* Method that rotate components
*
* author Giuseppe De Cicco & Fabio Granara
*/
public void rotateComponent(Object[] cells) {
if (cells == null) {
cells = graph.getSelectionCells();
}
for (Object cell : cells) {
if ((cell instanceof BlockingRegion) || cell instanceof JmtEdge) {
continue;
}
JmtCell current = (JmtCell) cell;
Map<Object, Map> nested = new Hashtable<Object, Map>();
Map attributeMap = new Hashtable();
ImageIcon icon;
if (current.isLeftInputCell()) {
icon = JMTImageLoader.loadImage(current.getIcon(), ImageLoader.MODIFIER_MIRROR);
} else {
icon = JMTImageLoader.loadImage(current.getIcon());
}
GraphConstants.setIcon(attributeMap, icon);
nested.put(cell, attributeMap);
current.setLeftInputCell(!current.isLeftInputCell());
current.updatePortPositions(nested, icon, current.getSize(graph));
graph.getGraphLayoutCache().edit(nested);
}
avoidOverlappingCell(cells);
}
示例2: rotateComponent
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
/**
* Method that rotate components
*
* author Giuseppe De Cicco & Fabio Granara
*/
public void rotateComponent(Object[] cells) {
if (cells == null) {
cells = graph.getSelectionCells();
}
for (Object cell : cells) {
if ((cell instanceof BlockingRegion) || cell instanceof JmtEdge) {
continue;
}
JmtCell current = (JmtCell) cell;
Map<Object, Map> nested = new Hashtable<Object, Map>();
Map attributeMap = new Hashtable();
ImageIcon icon;
if (current.isLeftInputCell()) {
icon = JMTImageLoader.loadImage(current.getIcon(), ImageLoader.MODIFIER_MIRROR);
} else {
icon = JMTImageLoader.loadImage(current.getIcon());
}
GraphConstants.setIcon(attributeMap, icon);
nested.put(cell, attributeMap);
current.setLeftInputCell(!current.isLeftInputCell());
current.updatePortPositions(nested, icon, current.getSize(graph));
// _____DA INSERIRE QUI L AGGIORNAMENTO DELLA DECORAZIONE DELLA
// FRECCIA______
graph.getGraphLayoutCache().edit(nested);
}
avoidOverlappingCell(cells);
}
示例3: setVisual
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
public void setVisual() {
Element graphics = data.getChild("graphics");
ImageIcon icon = null;
switch(transitionType){
case NORMAL_TRANSITION:{
if(data.getChild("toolspecific").getChild("graphics").getChildText("color").equals("black"))
icon = new ImageIcon("resources/images/basicTransition_black.png");
else if(data.getChild("toolspecific").getChild("graphics").getChildText("color").equals("green"))
icon = new ImageIcon("resources/images/basicTransition_green.png");
}
break;
case IMPORT_TRANSITION:{
if(data.getChild("toolspecific").getChild("graphics").getChildText("color").equals("black"))
icon = new ImageIcon("resources/images/importTransition_black.png");
else if(data.getChild("toolspecific").getChild("graphics").getChildText("color").equals("green"))
icon = new ImageIcon("resources/images/importTransition_green.png");
}
break;
case EXPORT_TRANSITION:{
if(data.getChild("toolspecific").getChild("graphics").getChildText("color").equals("black"))
icon = new ImageIcon("resources/images/exportTransition_back.png");
else if(data.getChild("toolspecific").getChild("graphics").getChildText("color").equals("green"))
icon = new ImageIcon("resources/images/exportTransition_green.png");
}
break;
}
GraphConstants.setIcon(getAttributes(), icon);
int x = Integer.parseInt(graphics.getChild("position").getAttributeValue("x"));
int y = Integer.parseInt(graphics.getChild("position").getAttributeValue("y")) + yOffSet;
GraphConstants.setBounds(getAttributes(), new Rectangle2D.Double(x,y,50,50));
}
示例4: setVisual
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
public void setVisual() {
Element graphics = data.getChild("graphics");
ImageIcon icon = new ImageIcon("resources/images/" + graphics.getChildText("icon"));
GraphConstants.setIcon(getAttributes(), icon);
int x = Integer.parseInt(graphics.getChild("position").getAttributeValue("x"));
int y = Integer.parseInt(graphics.getChild("position").getAttributeValue("y"));
int width = Integer.parseInt(graphics.getChild("size").getAttributeValue("width"));
int height = Integer.parseInt(graphics.getChild("size").getAttributeValue("height"));
GraphConstants.setBounds(getAttributes(), new Rectangle2D.Double(x,y,width,height));
}
示例5: setVisual
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
public void setVisual() {
Element graphics = data.getChild("graphics");
ImageIcon icon = new ImageIcon(ItSIMPLE.getIconsPathElement().getText() + graphics.getChildText("icon"));
GraphConstants.setIcon(this.getAttributes(), icon);
int x = Integer.parseInt(graphics.getChild("position").getAttributeValue("x"));
int y = Integer.parseInt(graphics.getChild("position").getAttributeValue("y"));
int width = Integer.parseInt(graphics.getChild("size").getAttributeValue("width"));
int height = Integer.parseInt(graphics.getChild("size").getAttributeValue("height"));
GraphConstants.setBounds(this.getAttributes(), new Rectangle2D.Double(x,y,width,height));
}
示例6: setVisual
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
public void setVisual() {
Element graphics = data.getChild("graphics");
ImageIcon icon = new ImageIcon(ItSIMPLE.getIconsPathElement().getText() + graphics.getChildText("icon"));
GraphConstants.setIcon(this.getAttributes(), icon);
int x = Integer.parseInt(graphics.getChild("position").getAttributeValue("x"));
int y = Integer.parseInt(graphics.getChild("position").getAttributeValue("y"));
int width = Integer.parseInt(graphics.getChild("size").getAttributeValue("width"));
int height = Integer.parseInt(graphics.getChild("size").getAttributeValue("height"));
GraphConstants.setBounds(this.getAttributes(), new Rectangle2D.Double(x,y,width,height));
}
示例7: setVisual
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
public void setVisual() {
Element graphics = data.getChild("graphics");
ImageIcon icon = new ImageIcon(ItSIMPLE.getIconsPathElement().getText() + graphics.getChildText("icon"));
GraphConstants.setIcon(this.getAttributes(), icon);
internalState = data.getChildText("condition");
int x = Integer.parseInt(graphics.getChild("position").getAttributeValue("x"));
int y = Integer.parseInt(graphics.getChild("position").getAttributeValue("y"));
int width = Integer.parseInt(graphics.getChild("size").getAttributeValue("width"));
int height = Integer.parseInt(graphics.getChild("size").getAttributeValue("height"));
GraphConstants.setBounds(this.getAttributes(), new Rectangle2D.Double(x,y,width,height));
}
示例8: setVisual
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
public void setVisual() {
Element graphics = data.getChild("graphics");
ImageIcon icon = new ImageIcon("resources/images/" + graphics.getChildText("icon"));
GraphConstants.setIcon(getAttributes(), icon);
int x = Integer.parseInt(graphics.getChild("position").getAttributeValue("x"));
int y = Integer.parseInt(graphics.getChild("position").getAttributeValue("y"));
int width = Integer.parseInt(graphics.getChild("size").getAttributeValue("width"));
int height = Integer.parseInt(graphics.getChild("size").getAttributeValue("height"));
GraphConstants.setBounds(getAttributes(), new Rectangle2D.Double(x,y,width,height));
}
示例9: JmtCell
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
/**
* Creates a graph cell and initializes it with the specified user object.
*
* @param userObject an Object provided by the user that constitutes
* the cell's data
*
* Conti Andrea 01-09-2003
* Bertoli Marco 04-giu-2005
*/
public JmtCell(String icon, Object userObject) {
super(userObject);
ImageIcon ico = JMTImageLoader.loadImage(icon);
GraphConstants.setIcon(attributes, ico);
imageDimension = new Dimension(ico.getIconWidth(), ico.getIconHeight());
GraphConstants.setSizeable(attributes, false);
GraphConstants.setSize(attributes, imageDimension);
}
示例10: JmtCell
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
/**
* Creates a graph cell and initializes it with the specified user object.
*
* @param userObject an Object provided by the user that constitutes
* the cell's data
*
* Conti Andrea 01-09-2003
* Bertoli Marco 04-giu-2005
*/
public JmtCell(String icon, Object userObject) {
super(userObject);
ImageIcon ico = JMTImageLoader.loadImage(icon);
GraphConstants.setIcon(attributes, ico);
imageDimension = new Dimension(ico.getIconWidth(), ico.getIconHeight());
GraphConstants.setSizeable(attributes, false);
GraphConstants.setSize(attributes, imageDimension);
}
示例11: setVisual
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
public void setVisual() {
Iterator literalsIter = data.getChild("literals").getChildren("literal").iterator();
literals = "";
String text = "";
while(literalsIter.hasNext()){
Element literal = (Element)literalsIter.next();
String eachLiteral = literal.getChildText("name");
//Final format
text = (text + "<font size='3' face='Arial'>" + eachLiteral + "</font>");
if (literalsIter.hasNext()){
text = text+"<br>";
}
}
literals = "<html>"+text+"</html>";
Element graphics = reference.getChild("graphics");
Element dataGraphics = data.getChild("graphics");
ImageIcon icon = new ImageIcon(ItSIMPLE.getIconsPathElement().getText() + dataGraphics.getChildText("icon"));
GraphConstants.setIcon(getAttributes(), icon);
int x = Integer.parseInt(graphics.getChild("position").getAttributeValue("x"));
int y = Integer.parseInt(graphics.getChild("position").getAttributeValue("y"));
int width = Integer.parseInt(graphics.getChild("size").getAttributeValue("width"));
int height = Integer.parseInt(graphics.getChild("size").getAttributeValue("height"));
GraphConstants.setBounds(getAttributes(), new Rectangle2D.Double(x,y,width,height));
}