X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.diagram%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fsymbolcontribution%2FCompositeSymbolGroup.java;h=fc9c80650c6d9513fd680d0795db1449274cc076;hp=27d286f8779ec10c2f9086dfc20ed5c1e591adb0;hb=refs%2Fchanges%2F38%2F238%2F2;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/symbolcontribution/CompositeSymbolGroup.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/symbolcontribution/CompositeSymbolGroup.java index 27d286f87..fc9c80650 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/symbolcontribution/CompositeSymbolGroup.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/symbolcontribution/CompositeSymbolGroup.java @@ -1,61 +1,61 @@ -/******************************************************************************* - * 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.diagram.symbolcontribution; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; - -import org.simantics.diagram.symbollibrary.ISymbolGroup; -import org.simantics.diagram.symbollibrary.ISymbolItem; - -/** - * @author Hannu Niemistö - */ -public class CompositeSymbolGroup extends ModifiableSymbolGroup { - - Collection groups = new ArrayList(4); - - public CompositeSymbolGroup(Object identification, String name, String description) { - super(identification, name, description); - } - - public void add(ISymbolGroup group) { - groups.add(group); - } - - public Collection getGroups() { - return groups; - } - - @Override - public ISymbolItem[] getItems() { - ArrayList items = new ArrayList(); - for(ISymbolGroup group : groups) - for(ISymbolItem item : group.getItems()) - items.add(new GroupProxySymbolItem(item, this)); - Collections.sort(items, new Comparator() { - @Override - public int compare(ISymbolItem o1, ISymbolItem o2) { - return o1.getName().compareTo(o2.getName()); - } - }); - return items.toArray(new ISymbolItem[items.size()]); - } - - @Override - public String toString() { - return super.toString() + "[composed group count=" + groups.size() + "]"; - } - -} +/******************************************************************************* + * 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.diagram.symbolcontribution; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; + +import org.simantics.diagram.symbollibrary.ISymbolGroup; +import org.simantics.diagram.symbollibrary.ISymbolItem; + +/** + * @author Hannu Niemistö + */ +public class CompositeSymbolGroup extends ModifiableSymbolGroup { + + Collection groups = new ArrayList(4); + + public CompositeSymbolGroup(Object identification, String name, String description) { + super(identification, name, description); + } + + public void add(ISymbolGroup group) { + groups.add(group); + } + + public Collection getGroups() { + return groups; + } + + @Override + public ISymbolItem[] getItems() { + ArrayList items = new ArrayList(); + for(ISymbolGroup group : groups) + for(ISymbolItem item : group.getItems()) + items.add(new GroupProxySymbolItem(item, this)); + Collections.sort(items, new Comparator() { + @Override + public int compare(ISymbolItem o1, ISymbolItem o2) { + return o1.getName().compareTo(o2.getName()); + } + }); + return items.toArray(new ISymbolItem[items.size()]); + } + + @Override + public String toString() { + return super.toString() + "[composed group count=" + groups.size() + "]"; + } + +}