• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java AttributeMap类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jgraph.graph.AttributeMap的典型用法代码示例。如果您正苦于以下问题:Java AttributeMap类的具体用法?Java AttributeMap怎么用?Java AttributeMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AttributeMap类属于org.jgraph.graph包,在下文中一共展示了AttributeMap类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: removeAndInsertGroup

import org.jgraph.graph.AttributeMap; //导入依赖的package包/类
/**
 * Removes the components in <code>remove</code> and insert <code>children</code>
 * in the specified <code>group</code>.
 * 
 * @param remove The <code>components</code> to remove
 * @param group The specified target <code>group</code>
 * @param children The <code>components</code> to add to <code>group</code>
 */
public void removeAndInsertGroup(Object[] remove, Object group,
		Object[] children) {
	// List to store all children that are not in the model
	List newCells = new ArrayList(children.length + 1);
	// If does not exists, add it in the first position
	if (!graphModel.contains(group)) {
		newCells.add(group);
	}
	// Create a parent map for the group and the children, and
	// store the children's attributes in the nested map.
	ParentMap pm = new ParentMap();
	Map nested = new Hashtable();
	for (int i = 0; i < children.length; i++) {
		pm.addEntry(children[i], group);
		if (!graphModel.contains(children[i])) {
			newCells.add(children[i]);
			AttributeMap attrs = graphModel.getAttributes(children[i]);
			if (attrs != null)
				nested.put(children[i], attrs);
		}
	}
	// Edit
	((TBoardModel)graphModel).edit(newCells.toArray(),remove, nested, null, pm, null);
}
 
开发者ID:ProgettoRadis,项目名称:ArasuiteIta,代码行数:33,代码来源:TBoardLayoutCache.java


示例2: clearAllEdgePoints

import org.jgraph.graph.AttributeMap; //导入依赖的package包/类
/** Clear all intermediate points from all edges. */
public void clearAllEdgePoints() {
    Map<JCell<G>,AttributeMap> change = new HashMap<>();
    for (JCell<G> jCell : getModel().getRoots()) {
        if (jCell instanceof JEdge) {
            VisualMap visuals = jCell.getVisuals();
            List<Point2D> points = visuals.getPoints();
            // don't make the change directly in the cell,
            // as this messes up the undo history
            List<Point2D> newPoints =
                Arrays.asList(points.get(0), points.get(points.size() - 1));
            AttributeMap newAttributes = new AttributeMap();
            GraphConstants.setPoints(newAttributes, newPoints);
            change.put(jCell, newAttributes);
        }
    }
    getModel().edit(change, null, null, null);
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:19,代码来源:JGraph.java


示例3: positionVertexAt

import org.jgraph.graph.AttributeMap; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static void positionVertexAt (Object vertex,
                                      int x,
                                      int y)
{
    DefaultGraphCell cell = jgAdapter.getVertexCell(vertex);
    AttributeMap attr = cell.getAttributes();
    Rectangle2D bounds = GraphConstants.getBounds(attr);

    Rectangle2D newBounds = new Rectangle2D.Double(
            x,
            y,
            bounds.getWidth(),
            bounds.getHeight());

    GraphConstants.setBounds(attr, newBounds);

    // TODO: Clean up generics once JGraph goes generic
    AttributeMap cellAttr = new AttributeMap();
    cellAttr.put(cell, attr);
    jgAdapter.edit(cellAttr, null, null, null);
}
 
开发者ID:Audiveris,项目名称:audiveris,代码行数:23,代码来源:SIGraphTest.java


示例4: deleteBoardFromAttributes

import org.jgraph.graph.AttributeMap; //导入依赖的package包/类
/**
 * Deletes the specified <code>board</code> from all the model component's
 * attributes. Is used when the <code>board</code> has been deleted from the
 * boards project
 * 
 * @param board The <code>board</code> to be deleted from model component's
 * attributes
 */
public void deleteBoardFromAttributes(TBoard board) {
	if (board == null)
		throw new NullPointerException();
	TBoard followingBoard = null;
	Object[] components = getAll(this);
	for (int i = 0; i < components.length; i++) {
		// Get, if exits, its following board attribute
		String followingBoardName = TBoardConstants
				.getFollowingBoardName(((TComponent)components[i])
						.getAttributes());			
		if (followingBoardName != null){
			followingBoard = TBoardConstants.editor.getProject().getBoard(followingBoardName);
			// If its the same text area remove the send text attributes
			if (followingBoard!= null && followingBoard.equals(board)) {
				AttributeMap attributeMap = new AttributeMap();
				TBoardConstants.setRemoveAttributes(attributeMap,
						new Object[] { TBoardConstants.FOLLOWING_BOARD });
				getAttributes(components[i]).applyMap(attributeMap);
			}
		}
	}
}
 
开发者ID:ProgettoRadis,项目名称:ArasuiteIta,代码行数:31,代码来源:TBoardModel.java


示例5: XMLEncode

import org.jgraph.graph.AttributeMap; //导入依赖的package包/类
/**
 * Generates a XML <code>Node</code> that contains the model board
 * information.
 * 
 * @param doc The <code>Document</code> that represents the
 * entire XML document
 * @return The XML <code>Node</code> generated
 */
public Node XMLEncode(Document doc) {
	// Create model node
	Element modelElement = doc.createElement("model");

	// Append model attributes
	modelElement.appendChild(TAttributeEncoder.XMLEncode(
			(AttributeMap)getAttributes(), doc));

	// Append component nodes
	for (int i = 0; i < getRootCount(); i++)
		/*nuevo mio*/
		if(((TComponent)getRootAt(i)) instanceof TGrid){
			for (int j = 0; j < ((TComponent)getRootAt(i)).getChildCount(); j++){
				modelElement.appendChild(((TComponent)((TComponent)getRootAt(i)).getChildAt(j))
						.XMLEncode(doc));
			}
		}
		else
		/*fin*/
		modelElement.appendChild(((TComponent)getRootAt(i)).XMLEncode(doc));

	// Return the model node
	return modelElement;
}
 
开发者ID:ProgettoRadis,项目名称:ArasuiteIta,代码行数:33,代码来源:TBoardModel.java


示例6: XMLDecode

import org.jgraph.graph.AttributeMap; //导入依赖的package包/类
/**
 * Returns an <code>attributeMap</code> object from the data contained in
 * the XML <code>Element</code>.
 * 
 * @param element The XML <code>Element</code> that contains the
 * <code>attributeMap</code> data
 * @return The generated <code>attributeMap</code>
 * @throws InvalidFormatException If <code>Element</code> has an invalid format
 */
public static AttributeMap XMLDecode(Element element) throws InvalidFormatException {
	if (element.getTagName().equals("attributes")) {
		// Create an empty attribute map
		AttributeMap map = new AttributeMap();
		// Set all attributes
		NodeList attributeNodeList = element.getChildNodes();
		for (int i = 0; i < attributeNodeList.getLength(); i++) {
			Node attributeNode = attributeNodeList.item(i);
			if (attributeNode.getNodeType() == Node.ELEMENT_NODE)
				map.putAll(readAttribute((Element)attributeNode));
		}
		// Return the map
		return map;
	}
	throw new InvalidFormatException();
}
 
开发者ID:ProgettoRadis,项目名称:ArasuiteIta,代码行数:26,代码来源:TAttributeEncoder.java


示例7: reorderRows

import org.jgraph.graph.AttributeMap; //导入依赖的package包/类
/**
 * Returns a <code>map</code> with the pairs <code>gridCell</code> -
 * <code>attributeMap</code> to be aplied that must be used when you want
 * to change the order of the <code>grid</code> to <i>ROWS</i>.
 * 
 * @return The <code>map</code> to apply when the <code>grid</code> order
 * changed to <i>ROWS</i>
 */
public Map reorderRows() {
	Map nested = new Hashtable();

	// For each row get the number of columns of the row and move them to
	// the first positions of the row	
	int rows = getRowsCount();
	for (int currentRow = 1; currentRow <= rows; currentRow++) {
		int currentColumn = 1, lastColumn = 1;
		TGridCell currentCell;
		while ((currentCell = getFollowingRowCell(currentRow,lastColumn)) != null) {
			lastColumn = TBoardConstants.getColumn(currentCell.getAttributes());
			if (lastColumn != currentColumn) {
				Map attributeMap = new AttributeMap();
				TBoardConstants.setColumn(attributeMap,currentColumn);
				nested.put(currentCell,attributeMap);
			}
			lastColumn++;
			currentColumn++;
		}
	}
	
	return nested;
}
 
开发者ID:ProgettoRadis,项目名称:ArasuiteIta,代码行数:32,代码来源:TGrid.java


示例8: reorderColumns

import org.jgraph.graph.AttributeMap; //导入依赖的package包/类
/**
 * Returns a <code>map</code> with the pairs <code>gridCell</code> -
 * <code>attributeMap</code> to be aplied that must be used when you want
 * to change the order of the <code>grid</code> to <i>COLUMNS</i>.
 * 
 * @return The <code>map</code> to apply when the <code>grid</code> order
 * changed to <i>COLUMNS</i>
 */
public Map reorderColumns() {
	Map nested = new Hashtable();

	// For each column get the number of rows of the column and move them to
	// the first positions of the column	
	int columns = getColumnsCount();		
	for (int currentColumn = 1; currentColumn <= columns; currentColumn++) {
		// Initialize the currento row ante the last row of the column
		int currentRow = 1, lastRow = 1;
		TGridCell currentCell;
		// I replace each element on its suposed finar position
		while ((currentCell = getFollowingColumnCell(currentColumn,lastRow)) != null) {
			lastRow = TBoardConstants.getRow(currentCell.getAttributes());
			if (lastRow != currentRow) {
				Map attributeMap = new AttributeMap();
				TBoardConstants.setRow(attributeMap,currentRow);
				nested.put(currentCell,attributeMap);
			}
			lastRow++;
			currentRow++;
		}
	}

	return nested;
}
 
开发者ID:ProgettoRadis,项目名称:ArasuiteIta,代码行数:34,代码来源:TGrid.java


示例9: XMLEncode

import org.jgraph.graph.AttributeMap; //导入依赖的package包/类
public Node XMLEncode(Document doc) {
	// Create component node
	Element componentElement = doc.createElement("component");
	componentElement.setAttribute("type", TYPE);

	// Delete default attributes
	AttributeMap map = (AttributeMap)getAttributes().clone();
	map.remove(TBoardConstants.BROWSEABLE);
	map.remove(TBoardConstants.GROUPOPAQUE);
	// Append component attributes
	componentElement.appendChild(TAttributeEncoder.XMLEncode(map, doc));

	// Append component nodes
	for (int i = 0; i < getChildCount(); i++)

		componentElement.appendChild(((TComponent)getChildAt(i))
				.XMLEncode(doc));
	// Return the component node
	return componentElement;
	
}
 
开发者ID:ProgettoRadis,项目名称:ArasuiteIta,代码行数:22,代码来源:TGrid.java


示例10: actionPerformed

import org.jgraph.graph.AttributeMap; //导入依赖的package包/类
public void actionPerformed(ActionEvent e) {
	Map nested = new Hashtable();
	
	int prevOrder = TBoardConstants.getOrder(grid.getAttributes());
	
	// If the order changes
	if ((order == TGrid.COLUMNS) && (prevOrder != order))
		// And changes to columns, get new order
		nested = grid.reorderColumns();
	else if ((order == TGrid.ROWS) && (prevOrder != order))
		// And changes to rows, get new order
		nested = grid.reorderRows();
	
	// Is the order has to been changed, change it on the TGrid
	if (prevOrder != order) {
		Map attributeMap = new AttributeMap();
		TBoardConstants.setOrder(attributeMap,order);
		nested.put(grid,attributeMap);
	}
	
	// If there is anything to change, change it
	if (!nested.isEmpty())
		getEditor().getCurrentBoard().getGraphLayoutCache()
			.edit(nested, null, null, null);
}
 
开发者ID:ProgettoRadis,项目名称:ArasuiteIta,代码行数:26,代码来源:TChangeGridOrderAction.java


示例11: getAttributes

import org.jgraph.graph.AttributeMap; //导入依赖的package包/类
/**
 * Creates an <code>AttributeMap</code> with the tool bar's selected format
 * parameters and the alternative border parameters.
 * 
 * @return The tool bar's format <code>AttributeMap</code>
 */
public AttributeMap getAttributes() {
	AttributeMap map = new AttributeMap();

	Color backgroundColor = backgroundColorComboBox.getColor();
	if (backgroundColor != null)
		TBoardConstants.setBackground(map, backgroundColor);

	Color gradientColor = gradientColorComboBox.getColor();
	if (gradientColor != null)
		TBoardConstants.setGradientColor(map, gradientColor);

	Color borderColor = borderColorComboBox.getColor();
	if (borderColor != null)
		TBoardConstants.setBorderColor(map, borderColor);

	TBoardConstants.setLineWidth(map, borderSizeComboBox.getBorderSize());
	
	TBoardConstants.setAlternativeBorderColor(map, TBoardConstants.DEFAULT_ALTERNATIVE_BORDERCOLOR);
	TBoardConstants.setAlternativeLinewidth(map, TBoardConstants.DEFAULT_ALTERNATIVE_LINEWIDTH);

	return map;
}
 
开发者ID:ProgettoRadis,项目名称:ArasuiteIta,代码行数:29,代码来源:TFormatToolBar.java


示例12: getAttributes

import org.jgraph.graph.AttributeMap; //导入依赖的package包/类
/**
 * Creates an <code>AttributeMap</code> with the tool bar's selected text format
 * parameters.
 * 
 * @return The tool bar's text format <code>AttributeMap</code>
 */
public AttributeMap getAttributes() {
	AttributeMap attributeMap = new AttributeMap();

	int style = 0;

	if (textBoldButton.isSelected())
		style |= Font.BOLD;
	if (textItalicButton.isSelected())
		style |= Font.ITALIC;

	TBoardConstants.setFont(attributeMap, new Font(fontFaceComboBox
			.getFontFace(), style, fontSizeComboBox.getFontSize()));

	Color fontColor = fontColorComboBox.getColor();

	if (fontColor != null)
		TBoardConstants.setForeground(attributeMap, fontColor);

	return attributeMap;
}
 
开发者ID:ProgettoRadis,项目名称:ArasuiteIta,代码行数:27,代码来源:TTextToolBar.java


示例13: createTextComponentComboBox

import org.jgraph.graph.AttributeMap; //导入依赖的package包/类
private void createTextComponentComboBox(TBoard board) {
	textReceiverComboBox = new JComboBox();
	textReceiverComboBox.setPreferredSize(new Dimension(120,20));

	// Get the list of the text areas in the board
	Vector componentList = new Vector();
	componentList.add(null);

	Object[] components = board.getGraphLayoutCache().getCells(
			board.getGraphLayoutCache().getCellViews());
	for (int i = 0; i < components.length; i++) {
		AttributeMap map = ((TComponent)components[i]).getAttributes();
		if (map != null)
			if (TBoardConstants.isTextReceiver(map))
				componentList.add(components[i]);
	}

	textReceiverComboBox.setModel(new DefaultComboBoxModel(componentList));
	textReceiverComboBox.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			updateComponents();
		}
	});
}
 
开发者ID:ProgettoRadis,项目名称:ArasuiteIta,代码行数:25,代码来源:TSendTextChooser.java


示例14: positionVertexAt

import org.jgraph.graph.AttributeMap; //导入依赖的package包/类
@SuppressWarnings("unchecked") // FIXME hb 28-nov-05: See FIXME below
private void positionVertexAt(Object vertex, int x, int y)
{
    DefaultGraphCell cell = jgAdapter.getVertexCell(vertex);
    AttributeMap attr = cell.getAttributes();
    Rectangle2D bounds = GraphConstants.getBounds(attr);

    Rectangle2D newBounds =
        new Rectangle2D.Double(
            x,
            y,
            bounds.getWidth(),
            bounds.getHeight());

    GraphConstants.setBounds(attr, newBounds);

    // TODO: Clean up generics once JGraph goes generic
    AttributeMap cellAttr = new AttributeMap();
    cellAttr.put(cell, attr);
    jgAdapter.edit(cellAttr, null, null, null);
}
 
开发者ID:marcvanzee,项目名称:mdp-plan-revision,代码行数:22,代码来源:DrawPanel_old.java


示例15: createBounds

import org.jgraph.graph.AttributeMap; //导入依赖的package包/类
public static Map createBounds(AttributeMap map, double x, double y, Dimension dimension, Color c, boolean moveable)
	{
//		final int ALPHA = 255;
		GraphConstants.setBounds(map, map.createRect(x, y, dimension.getWidth(), dimension.getHeight()));
//		GraphConstants.setBorder(map, BorderFactory.createBevelBorder(BevelBorder.RAISED));
		GraphConstants.setForeground(map, Color.BLACK.darker().darker());//new Color(ALPHA - c.getRed(), ALPHA - c.getGreen(), ALPHA - c.getBlue(), ALPHA));
		GraphConstants.setBackground(map, c.darker());
		// Add a nice looking gradient background
		GraphConstants.setGradientColor(map, c.darker());
		// Make sure the cell is resized on insert
//		GraphConstants.setSize();
//		GraphConstants.setResize(map, true);
		// Add a Border Color Attribute to the Map
		GraphConstants.setBorderColor(map, Color.BLACK.darker().darker());
		GraphConstants.setFont(map, GraphConstants.DEFAULTFONT.deriveFont(Font.BOLD, 12));
		GraphConstants.setMoveable(map, moveable);
		GraphConstants.setOpaque(map, true);
		GraphConstants.setResize(map, false);
		GraphConstants.setAutoSize(map, true);
		return map;
	}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:22,代码来源:UIHelper.java


示例16: createBounds

import org.jgraph.graph.AttributeMap; //导入依赖的package包/类
public static Map createBounds(AttributeMap map, double x, double y, Dimension dimension, Color c, boolean moveable)
{
	//		final int ALPHA = 255;
	GraphConstants.setBounds(map, map.createRect(x, y, dimension.getWidth(), dimension.getHeight()));
	//		GraphConstants.setBorder(map, BorderFactory.createBevelBorder(BevelBorder.RAISED));
	GraphConstants.setForeground(map, Color.BLACK.darker().darker());//new Color(ALPHA - c.getRed(), ALPHA - c.getGreen(), ALPHA - c.getBlue(), ALPHA));
	GraphConstants.setBackground(map, c.darker());
	// Add a nice looking gradient background
	GraphConstants.setGradientColor(map, c.darker());
	// Make sure the cell is resized on insert
	//		GraphConstants.setSize();
	//		GraphConstants.setResize(map, true);
	// Add a Border Color Attribute to the Map
	GraphConstants.setBorderColor(map, Color.BLACK.darker().darker());
	GraphConstants.setFont(map, GraphConstants.DEFAULTFONT.deriveFont(Font.BOLD, 12));
	GraphConstants.setMoveable(map, moveable);
	GraphConstants.setOpaque(map, true);
	GraphConstants.setResize(map, false);
	GraphConstants.setAutoSize(map, true);
	return map;
}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:22,代码来源:UIHelper.java


示例17: isMinor

import org.jgraph.graph.AttributeMap; //导入依赖的package包/类
/** Checks if a given edit event is minor, such as a layout action.
 * A minor edit causes fewer refresh actions to to be done as a consequence.
 */
private boolean isMinor(UndoableEdit e) {
    boolean minor = true;
    // only process edits that really changed anything
    if (e instanceof GraphLayoutCacheChange) {
        GraphModelChange edit = (GraphModelChange) e;
        Object[] inserted = edit.getInserted();
        Object[] removed = edit.getRemoved();
        Object[] changed = edit.getChanged();
        ConnectionSet connections = edit.getConnectionSet();
        minor = (connections == null || connections.isEmpty())
            && (inserted == null || inserted.length == 0)
            && (removed == null || removed.length == 0);
        if (minor && changed != null) {
            for (Object in : changed) {
                AttributeMap attrs = (AttributeMap) edit.getAttributes()
                    .get(in);
                if (GraphConstants.getValue(attrs) != null) {
                    minor = false;
                    break;
                }
            }
        }
    } else {
        minor = false;
    }
    return minor;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:31,代码来源:GraphEditorTab.java


示例18: clone

import org.jgraph.graph.AttributeMap; //导入依赖的package包/类
@Override
public Object clone() {
    AttributeMap result = new AttributeMap();
    for (Map.Entry<?,?> entry : entrySet()) {
        result.applyValue(entry.getKey(), entry.getValue());
    }
    return result;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:9,代码来源:VisualAttributeMap.java


示例19: updateAutoSize

import org.jgraph.graph.AttributeMap; //导入依赖的package包/类
/**
 * Overwritten to freeze nodes to their center on
 * size changes.
 */
@Override
public void updateAutoSize(CellView view) {
    if (view != null && !isEditing()) {
        Rectangle2D bounds =
            (view.getAttributes() != null) ? GraphConstants.getBounds(view.getAttributes())
                : null;
        AttributeMap attrs = getModel().getAttributes(view.getCell());
        if (bounds == null) {
            bounds = GraphConstants.getBounds(attrs);
        }
        if (bounds != null) {
            boolean autosize = GraphConstants.isAutoSize(view.getAllAttributes());
            boolean resize = GraphConstants.isResize(view.getAllAttributes());
            if (autosize || resize) {
                Dimension2D d = getPreferredSize(view);
                int inset = 2 * GraphConstants.getInset(view.getAllAttributes());
                // adjust the x,y corner so that the center stays in place
                double shiftX = (bounds.getWidth() - d.getWidth() - inset) / 2;
                double shiftY = (bounds.getHeight() - d.getHeight() - inset) / 2;
                bounds.setFrame(bounds.getX() + shiftX, bounds.getY() + shiftY, d.getWidth(),
                    d.getHeight());
                // Remove resize attribute
                snap(bounds);
                if (resize) {
                    if (view.getAttributes() != null) {
                        view.getAttributes().remove(GraphConstants.RESIZE);
                    }
                    attrs.remove(GraphConstants.RESIZE);
                }
                view.refresh(getGraphLayoutCache(), getGraphLayoutCache(), false);
            }
        }
    }
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:39,代码来源:JGraph.java


示例20: getAttributes

import org.jgraph.graph.AttributeMap; //导入依赖的package包/类
@Override
public AttributeMap getAttributes(Object node) {
    AttributeMap result;
    if (node instanceof JCell) {
        result = ((JCell<?>) node).getAttributes();
    } else {
        result = super.getAttributes(node);
    }
    assert result != null : String.format("Cell %s has no attributes", node);
    return result;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:12,代码来源:JModel.java



注:本文中的org.jgraph.graph.AttributeMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java QueueStateProto类代码示例发布时间:2022-05-22
下一篇:
Java RMStateStoreFactory类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap