X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.g2d%2Fsrc%2Forg%2Fsimantics%2Fg2d%2Felement%2Fhandler%2FChildren.java;h=368668f3229696739d3508b5e59c0136b73619f2;hp=08134750962ff655c74115a7717752f1333b3243;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/Children.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/Children.java index 081347509..368668f32 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/Children.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/Children.java @@ -1,68 +1,68 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * 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: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.g2d.element.handler; - -import java.util.Collection; - -import org.simantics.g2d.element.IElement; -import org.simantics.g2d.element.ElementClass.Single; - -/** - * A handler for retrieving the child elements of an element. - * - * @author Tuukka Lehtonen - */ -@Single -public interface Children extends ElementHandler { - - public static class ChildEvent { - public final IElement parent; - public final Collection removed; - public final Collection added; - - public ChildEvent(IElement parent, Collection removed, Collection added) { - this.parent = parent; - this.removed = removed; - this.added = added; - } - - @Override - public String toString() { - return getClass().getSimpleName() + "[parent=" + parent + ", removed=" + removed + ", added=" + added + "]"; - } - } - - public interface ChildListener { - void elementChildrenChanged(ChildEvent event); - } - - /** - * @param element the element to check for child elements - * @param result the collection to populate with the results or - * null to allocate a new collection. The results shall - * be appended to the provided collection. - * @return all child elements of the specified IElement or null - * if result was null and no children exist - */ - Collection getChildren(IElement element, Collection result); - - /** - * @param listener - */ - void addChildListener(IElement element, ChildListener listener); - - /** - * @param listener - */ - void removeChildListener(IElement element, ChildListener listener); - -} +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * 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: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.g2d.element.handler; + +import java.util.Collection; + +import org.simantics.g2d.element.IElement; +import org.simantics.g2d.element.ElementClass.Single; + +/** + * A handler for retrieving the child elements of an element. + * + * @author Tuukka Lehtonen + */ +@Single +public interface Children extends ElementHandler { + + public static class ChildEvent { + public final IElement parent; + public final Collection removed; + public final Collection added; + + public ChildEvent(IElement parent, Collection removed, Collection added) { + this.parent = parent; + this.removed = removed; + this.added = added; + } + + @Override + public String toString() { + return getClass().getSimpleName() + "[parent=" + parent + ", removed=" + removed + ", added=" + added + "]"; + } + } + + public interface ChildListener { + void elementChildrenChanged(ChildEvent event); + } + + /** + * @param element the element to check for child elements + * @param result the collection to populate with the results or + * null to allocate a new collection. The results shall + * be appended to the provided collection. + * @return all child elements of the specified IElement or null + * if result was null and no children exist + */ + Collection getChildren(IElement element, Collection result); + + /** + * @param listener + */ + void addChildListener(IElement element, ChildListener listener); + + /** + * @param listener + */ + void removeChildListener(IElement element, ChildListener listener); + +}