X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scenegraph.swing%2Fsrc%2Forg%2Fsimantics%2Fscenegraph%2Fswing%2FCheckBoxNode.java;h=39a03265bb816a62a097c351be9297ba84b6330c;hb=refs%2Fchanges%2F38%2F238%2F2;hp=8704d70b92c214a748932bce8f676774550d48d4;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scenegraph.swing/src/org/simantics/scenegraph/swing/CheckBoxNode.java b/bundles/org.simantics.scenegraph.swing/src/org/simantics/scenegraph/swing/CheckBoxNode.java index 8704d70b9..39a03265b 100644 --- a/bundles/org.simantics.scenegraph.swing/src/org/simantics/scenegraph/swing/CheckBoxNode.java +++ b/bundles/org.simantics.scenegraph.swing/src/org/simantics/scenegraph/swing/CheckBoxNode.java @@ -1,69 +1,69 @@ -/******************************************************************************* - * 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 - *******************************************************************************/ +/******************************************************************************* + * 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.scenegraph.swing; -import java.awt.Color; -import java.awt.Font; -import java.awt.Graphics2D; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.HashSet; -import java.util.Set; - -import javax.swing.JCheckBox; +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics2D; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.HashSet; +import java.util.Set; + +import javax.swing.JCheckBox; public class CheckBoxNode extends ComponentNode implements ActionListener { private static final long serialVersionUID = 3161843367263793336L; - protected String text; - protected Font font = null; - protected Color color = null; + protected String text; + protected Font font = null; + protected Color color = null; protected transient Set actionListeners = new HashSet(); @Override - public void render(Graphics2D g2d) { - if(component != null && component.getText() != null && component.getText().equals(text) == false) - component.setText(text); + public void render(Graphics2D g2d) { + if(component != null && component.getText() != null && component.getText().equals(text) == false) + component.setText(text); super.render(g2d); - } + } @SyncField("text") public void setText(String text) { this.text = text; - } - + } + @PropertySetter("Font") - @SyncField("font") - public void setFont(Font font) { - this.font = font; - if (component != null) { - setComponentFont(font); - } - } - - @PropertySetter("Color") - @SyncField("color") - public void setColor(Color color) { - this.color = color; - if (component != null) { - component.setForeground(color); - } - } - - public Font getFont() { - return font; - } + @SyncField("font") + public void setFont(Font font) { + this.font = font; + if (component != null) { + setComponentFont(font); + } + } + + @PropertySetter("Color") + @SyncField("color") + public void setColor(Color color) { + this.color = color; + if (component != null) { + component.setForeground(color); + } + } + + public Font getFont() { + return font; + } @ServerSide @Override @@ -78,12 +78,12 @@ public class CheckBoxNode extends ComponentNode implements ActionList public void removeActionListener(ActionListener l) { actionListeners.remove(l); - } + } - @Override - public void init() { - component = new JCheckBox(); - component.addActionListener(this); - super.init(); + @Override + public void init() { + component = new JCheckBox(); + component.addActionListener(this); + super.init(); } }