-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
+/*******************************************************************************
+ * 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;\r
-import java.awt.Font;\r
-import java.awt.Graphics2D;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ActionListener;\r
-import java.util.HashSet;\r
-import java.util.Set;\r
-\r
-import javax.swing.JCheckBox;\r
+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<JCheckBox> implements ActionListener {
private static final long serialVersionUID = 3161843367263793336L;
- protected String text;\r
- protected Font font = null;\r
- protected Color color = null;\r
+ protected String text;
+ protected Font font = null;
+ protected Color color = null;
protected transient Set<ActionListener> actionListeners = new HashSet<ActionListener>();
@Override
- public void render(Graphics2D g2d) {\r
- if(component != null && component.getText() != null && component.getText().equals(text) == false)\r
- component.setText(text);\r
+ public void render(Graphics2D g2d) {
+ if(component != null && component.getText() != null && component.getText().equals(text) == false)
+ component.setText(text);
super.render(g2d);
- }\r
+ }
@SyncField("text")
public void setText(String text) {
this.text = text;
- }\r
- \r
+ }
+
@PropertySetter("Font")
- @SyncField("font")\r
- public void setFont(Font font) {\r
- this.font = font;\r
- if (component != null) {\r
- setComponentFont(font);\r
- }\r
- }\r
-\r
- @PropertySetter("Color")\r
- @SyncField("color")\r
- public void setColor(Color color) {\r
- this.color = color;\r
- if (component != null) {\r
- component.setForeground(color);\r
- }\r
- }\r
- \r
- public Font getFont() {\r
- return font;\r
- }\r
+ @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
public void removeActionListener(ActionListener l) {
actionListeners.remove(l);
- }\r
+ }
- @Override\r
- public void init() {\r
- component = new JCheckBox();\r
- component.addActionListener(this);\r
- super.init();\r
+ @Override
+ public void init() {
+ component = new JCheckBox();
+ component.addActionListener(this);
+ super.init();
}
}