X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.g2d%2Fsrc%2Forg%2Fsimantics%2Fg2d%2Felement%2Fhandler%2Fimpl%2FTextColorImpl.java;fp=bundles%2Forg.simantics.g2d%2Fsrc%2Forg%2Fsimantics%2Fg2d%2Felement%2Fhandler%2Fimpl%2FTextColorImpl.java;h=02f57cebd956c0fb85b06a20a45437b2f3e562ed;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=b74f85e4372716855129f0fe78b0ec5f6ff3fbff;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/TextColorImpl.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/TextColorImpl.java index b74f85e43..02f57cebd 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/TextColorImpl.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/TextColorImpl.java @@ -1,71 +1,71 @@ -/******************************************************************************* - * 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 org.simantics.g2d.diagram.IDiagram; -import org.simantics.g2d.element.ElementHints; -import org.simantics.g2d.element.IElement; -import org.simantics.g2d.element.handler.LifeCycle; -import org.simantics.g2d.element.handler.TextColor; - -/** - * - * @See {@link TextColor} - * @author Toni Kalajainen - */ -public class TextColorImpl implements TextColor, LifeCycle { - - private static final long serialVersionUID = -3684758508037189899L; - - public static final TextColorImpl UNSET = new TextColorImpl(null); - public static final TextColorImpl BLACK = new TextColorImpl(java.awt.Color.BLACK); - public static final TextColorImpl WHITE = new TextColorImpl(java.awt.Color.WHITE); - public static final TextColorImpl RED = new TextColorImpl(java.awt.Color.RED); - public static final TextColorImpl BLUE = new TextColorImpl(java.awt.Color.BLUE); - - public synchronized static TextColorImpl handlerOf(java.awt.Color c) - { - return new TextColorImpl(c); - } - - java.awt.Color defaultColor = java.awt.Color.BLACK; - - public TextColorImpl() {} - public TextColorImpl(java.awt.Color defaultColor) { - this.defaultColor = defaultColor; - } - - @Override - public java.awt.Color getTextColor(IElement e) { - return e.getHint(ElementHints.KEY_TEXT_COLOR); - } - - @Override - public void setTextColor(IElement e, java.awt.Color c) { - e.setHint(ElementHints.KEY_TEXT_COLOR, c); - } - - @Override - public void onElementActivated(IDiagram d, IElement e) { - } - @Override - public void onElementCreated(IElement e) { - if (defaultColor!=null) - e.setHint(ElementHints.KEY_TEXT_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 org.simantics.g2d.diagram.IDiagram; +import org.simantics.g2d.element.ElementHints; +import org.simantics.g2d.element.IElement; +import org.simantics.g2d.element.handler.LifeCycle; +import org.simantics.g2d.element.handler.TextColor; + +/** + * + * @See {@link TextColor} + * @author Toni Kalajainen + */ +public class TextColorImpl implements TextColor, LifeCycle { + + private static final long serialVersionUID = -3684758508037189899L; + + public static final TextColorImpl UNSET = new TextColorImpl(null); + public static final TextColorImpl BLACK = new TextColorImpl(java.awt.Color.BLACK); + public static final TextColorImpl WHITE = new TextColorImpl(java.awt.Color.WHITE); + public static final TextColorImpl RED = new TextColorImpl(java.awt.Color.RED); + public static final TextColorImpl BLUE = new TextColorImpl(java.awt.Color.BLUE); + + public synchronized static TextColorImpl handlerOf(java.awt.Color c) + { + return new TextColorImpl(c); + } + + java.awt.Color defaultColor = java.awt.Color.BLACK; + + public TextColorImpl() {} + public TextColorImpl(java.awt.Color defaultColor) { + this.defaultColor = defaultColor; + } + + @Override + public java.awt.Color getTextColor(IElement e) { + return e.getHint(ElementHints.KEY_TEXT_COLOR); + } + + @Override + public void setTextColor(IElement e, java.awt.Color c) { + e.setHint(ElementHints.KEY_TEXT_COLOR, c); + } + + @Override + public void onElementActivated(IDiagram d, IElement e) { + } + @Override + public void onElementCreated(IElement e) { + if (defaultColor!=null) + e.setHint(ElementHints.KEY_TEXT_COLOR, defaultColor); + } + @Override + public void onElementDeactivated(IDiagram d, IElement e) { + } + @Override + public void onElementDestroyed(IElement e) { + } +}