shapesdiagram.java

来自「mywork是rcp开发的很好的例子」· Java 代码 · 共 60 行

JAVA
60
字号
/******************************************************************************* * Copyright (c) 2004, 2005 Elias Volanakis and others.�* All rights reserved. This program and the accompanying materials�* are made available under the terms of the Eclipse Public License v1.0�* which accompanies this distribution, and is available at�* http://www.eclipse.org/legal/epl-v10.html�*�* Contributors:�*����Elias Volanakis - initial API and implementation�*******************************************************************************/package net.sf.freenote.model;import java.util.ArrayList;import java.util.List;import net.sf.freenote.FreeNoteConstants;/** * A container for multiple shapes. * This is the "root" of the model data structure. * @author Elias Volanakis */public class ShapesDiagram extends ModelElement implements ShapesContainer {private List children ;/**  * Add a shape to this diagram. * @param s a non-null shape instance * @return true, if the shape was added, false otherwise */public boolean addChild(Shape s) {	if (s != null && getChildren().add(s)) {		firePropertyChange(FreeNoteConstants.CHILD_ADDED_PROP, null, s);		return true;	}	return false;}/** Return a List of Shapes in this diagram.  The returned List should not be modified. */public List getChildren() {	return children == null ? children =new ArrayList():children;}/** * Remove a shape from this diagram. * @param s a non-null shape instance; * @return true, if the shape was removed, false otherwise */public boolean removeChild(Shape s) {	if (s != null && getChildren().remove(s)) {		firePropertyChange(FreeNoteConstants.CHILD_REMOVED_PROP, null, s);		return true;	}	return false;}public void setChildren(List children) {	this.children = children;}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?