X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=inline;f=bundles%2Forg.simantics.g2d%2Fsrc%2Forg%2Fsimantics%2Fg2d%2Felement%2Fhandler%2Fimpl%2FFillColorImpl.java;h=4f7cacfcf317f08cc7aa57e75a4cced3a465685a;hb=3598f987e691cb4f35ab8f283d4dfd760bcdd410;hp=10abe6f981ff43a89de47f212674dee133f3ae38;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/FillColorImpl.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/FillColorImpl.java index 10abe6f98..4f7cacfcf 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/FillColorImpl.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/FillColorImpl.java @@ -1,72 +1,72 @@ -/******************************************************************************* - * 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.impl; - -import java.awt.Color; - -import org.simantics.g2d.diagram.IDiagram; -import org.simantics.g2d.element.ElementHints; -import org.simantics.g2d.element.IElement; -import org.simantics.g2d.element.handler.FillColor; -import org.simantics.g2d.element.handler.LifeCycle; - -/** - * - * @See {@link Color} - * @author Toni Kalajainen - */ -public class FillColorImpl implements FillColor, LifeCycle { - - private static final long serialVersionUID = 2241631816115855117L; - public static final FillColorImpl UNSET = new FillColorImpl(null); - public static final FillColorImpl BLACK = new FillColorImpl(java.awt.Color.BLACK); - public static final FillColorImpl WHITE = new FillColorImpl(java.awt.Color.WHITE); - public static final FillColorImpl RED = new FillColorImpl(java.awt.Color.RED); - public static final FillColorImpl BLUE = new FillColorImpl(java.awt.Color.BLUE); - - public synchronized static FillColorImpl handlerOf(java.awt.Color c) - { - return new FillColorImpl(c); - } - - java.awt.Color defaultColor = java.awt.Color.BLACK; - - public FillColorImpl() {} - public FillColorImpl(java.awt.Color defaultColor) { - this.defaultColor = defaultColor; - } - - @Override - public java.awt.Color getFillColor(IElement e) { - return e.getHint(ElementHints.KEY_FILL_COLOR); - } - - @Override - public void setFillColor(IElement e, java.awt.Color c) { - e.setHint(ElementHints.KEY_FILL_COLOR, c); - } - - @Override - public void onElementActivated(IDiagram d, IElement e) { - } - @Override - public void onElementCreated(IElement e) { - if (defaultColor!=null) - e.setHint(ElementHints.KEY_FILL_COLOR, defaultColor); - } - @Override - public void onElementDeactivated(IDiagram d, IElement e) { - } - @Override - public void onElementDestroyed(IElement e) { - } -} +/******************************************************************************* + * 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.impl; + +import java.awt.Color; + +import org.simantics.g2d.diagram.IDiagram; +import org.simantics.g2d.element.ElementHints; +import org.simantics.g2d.element.IElement; +import org.simantics.g2d.element.handler.FillColor; +import org.simantics.g2d.element.handler.LifeCycle; + +/** + * + * @See {@link Color} + * @author Toni Kalajainen + */ +public class FillColorImpl implements FillColor, LifeCycle { + + private static final long serialVersionUID = 2241631816115855117L; + public static final FillColorImpl UNSET = new FillColorImpl(null); + public static final FillColorImpl BLACK = new FillColorImpl(java.awt.Color.BLACK); + public static final FillColorImpl WHITE = new FillColorImpl(java.awt.Color.WHITE); + public static final FillColorImpl RED = new FillColorImpl(java.awt.Color.RED); + public static final FillColorImpl BLUE = new FillColorImpl(java.awt.Color.BLUE); + + public synchronized static FillColorImpl handlerOf(java.awt.Color c) + { + return new FillColorImpl(c); + } + + java.awt.Color defaultColor = java.awt.Color.BLACK; + + public FillColorImpl() {} + public FillColorImpl(java.awt.Color defaultColor) { + this.defaultColor = defaultColor; + } + + @Override + public java.awt.Color getFillColor(IElement e) { + return e.getHint(ElementHints.KEY_FILL_COLOR); + } + + @Override + public void setFillColor(IElement e, java.awt.Color c) { + e.setHint(ElementHints.KEY_FILL_COLOR, c); + } + + @Override + public void onElementActivated(IDiagram d, IElement e) { + } + @Override + public void onElementCreated(IElement e) { + if (defaultColor!=null) + e.setHint(ElementHints.KEY_FILL_COLOR, defaultColor); + } + @Override + public void onElementDeactivated(IDiagram d, IElement e) { + } + @Override + public void onElementDestroyed(IElement e) { + } +}