X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.g2d%2Fsrc%2Forg%2Fsimantics%2Fg2d%2Flayers%2FSimpleLayer.java;fp=bundles%2Forg.simantics.g2d%2Fsrc%2Forg%2Fsimantics%2Fg2d%2Flayers%2FSimpleLayer.java;h=eeb91725a888366feea061415d55dce056bb072d;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=3d426fbbd0b3acc1bc1d64d4424a0ac6e0755591;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/layers/SimpleLayer.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/layers/SimpleLayer.java index 3d426fbbd..eeb91725a 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/layers/SimpleLayer.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/layers/SimpleLayer.java @@ -1,85 +1,85 @@ -/******************************************************************************* - * 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.layers; - -import java.util.concurrent.CopyOnWriteArrayList; - -/** - * @author Antti Villberg - */ -public class SimpleLayer implements IEditableLayer { - - private CopyOnWriteArrayList listeners = new CopyOnWriteArrayList(); - - private String name; - - public SimpleLayer(String name) { - if (name == null) - throw new IllegalArgumentException("null name"); - this.name = name; - } - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - if (name == null) - throw new IllegalArgumentException("null name"); - String oldName = this.name; - this.name = name; - if (!name.equals(oldName)) { - fireLayerChanged(new LayerChangeEvent(this, PROP_NAME, oldName, name)); - } - } - - @Override - public int hashCode() { - return name.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - SimpleLayer other = (SimpleLayer) obj; - return name.equals(other.name); - } - - @Override - public void addLayerListener(ILayerListener l) { - listeners.add(l); - } - - @Override - public void removeLayerListener(ILayerListener l) { - listeners.remove(l); - } - - protected void fireLayerChanged(LayerChangeEvent event) { - for (ILayerListener l : listeners) { - l.layerChanged(event); - } - } - - @Override - public String toString() { - return getClass().getSimpleName() + "[" + name + "]"; - } - -} +/******************************************************************************* + * 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.layers; + +import java.util.concurrent.CopyOnWriteArrayList; + +/** + * @author Antti Villberg + */ +public class SimpleLayer implements IEditableLayer { + + private CopyOnWriteArrayList listeners = new CopyOnWriteArrayList(); + + private String name; + + public SimpleLayer(String name) { + if (name == null) + throw new IllegalArgumentException("null name"); + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public void setName(String name) { + if (name == null) + throw new IllegalArgumentException("null name"); + String oldName = this.name; + this.name = name; + if (!name.equals(oldName)) { + fireLayerChanged(new LayerChangeEvent(this, PROP_NAME, oldName, name)); + } + } + + @Override + public int hashCode() { + return name.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + SimpleLayer other = (SimpleLayer) obj; + return name.equals(other.name); + } + + @Override + public void addLayerListener(ILayerListener l) { + listeners.add(l); + } + + @Override + public void removeLayerListener(ILayerListener l) { + listeners.remove(l); + } + + protected void fireLayerChanged(LayerChangeEvent event) { + for (ILayerListener l : listeners) { + l.layerChanged(event); + } + } + + @Override + public String toString() { + return getClass().getSimpleName() + "[" + name + "]"; + } + +}