1 16 package com.buchuki.ensmer.builtin; 17 18 import java.io.Serializable ; 19 import com.buchuki.ensmer.object.*; 20 import com.sun.j3d.utils.geometry.Text2D; 21 import java.awt.Font ; 22 import java.awt.event.KeyEvent ; 23 import javax.media.j3d.Appearance; 24 import javax.media.j3d.BranchGroup; 25 import javax.media.j3d.PolygonAttributes; 26 import javax.vecmath.Color3f; 27 28 38 public class Static extends Backend { 39 40 43 public Static() { 44 filename = "table.wrl"; } 46 47 52 public Static(Serializable data) { 53 this(); 54 Object [] arr = (Object []) data; 55 this.filename = (String ) arr[0]; 56 this.selectable = (Boolean ) arr[1]; 57 } 58 59 64 @Override 65 public Serializable getSerializable() { 66 return new Object [] {filename, selectable}; 67 } 68 69 74 public String getFilename() { 75 return filename; 76 } 77 78 83 public boolean isSelectable() { 84 return selectable; 85 } 86 87 92 public void setFilename(String filename) { 93 this.filename = filename; 94 fireChangeEvent(); 95 } 96 97 103 public void setSelectable(boolean selectable) { 104 this.selectable = selectable; 105 fireChangeEvent(); 106 } 107 108 116 @Override 117 public static BranchGroup getRepresentation() { 118 Text2D text = new Text2D("Static", new Color3f(0f, 0f, 1f), "Times", 16, Font.BOLD); 119 BranchGroup ret = new BranchGroup(); 120 Appearance app = text.getAppearance(); 121 PolygonAttributes poly = new PolygonAttributes(); 122 poly.setCullFace(poly.CULL_NONE); 123 app.setPolygonAttributes(poly); 124 ret.addChild(text); 125 return ret; 126 } 127 128 132 private String filename; 133 134 137 private boolean selectable = true; 138 } 139 | Popular Tags |