Source code: com/arranger/jarl/shell/models/ViewPrefModel.java
1 package com.arranger.jarl.shell.models;
2
3 import com.arranger.jarl.shell.ShellConfig;
4
5 /**
6 * ViewPrefModel created on Apr 16, 2003
7 */
8 public class ViewPrefModel extends BaseModel {
9
10 public static final String REUSE_FRAME = "reuseFrame";
11 public static final String DEBUG_RENDERING = "debugRendering";
12 public static final String SHOW_JARLOBJ_TREE = "showJarlObjTree";
13 public static final String SHOW_JARLINST_TREE = "showJarlInstTree";
14
15 protected boolean m_reuseFrame;
16 protected boolean m_debugRendering;
17 protected boolean m_showJarlObjTree;
18 protected boolean m_showJarlInstTree;
19
20 public void load(ShellConfig shellConfig) throws Exception {
21 m_reuseFrame = Boolean.valueOf(shellConfig.getProperty(REUSE_FRAME)).booleanValue();
22 m_debugRendering = Boolean.valueOf(shellConfig.getProperty(DEBUG_RENDERING)).booleanValue();
23 m_showJarlObjTree = Boolean.valueOf(shellConfig.getProperty(SHOW_JARLOBJ_TREE)).booleanValue();
24 m_showJarlInstTree = Boolean.valueOf(shellConfig.getProperty(SHOW_JARLINST_TREE)).booleanValue();
25 }
26
27 public void save(ShellConfig shellConfig) throws Exception {
28 shellConfig.setProperty(REUSE_FRAME, String.valueOf(m_reuseFrame));
29 shellConfig.setProperty(DEBUG_RENDERING, String.valueOf(m_debugRendering));
30 shellConfig.setProperty(SHOW_JARLOBJ_TREE, String.valueOf(m_showJarlObjTree));
31 shellConfig.setProperty(SHOW_JARLINST_TREE, String.valueOf(m_showJarlInstTree));
32 }
33
34 public String getStatusText() {
35 StringBuffer buffer = new StringBuffer();
36 buffer.append(REUSE_FRAME).append(": ").append(m_reuseFrame).append(LINE_SEP);
37 buffer.append(DEBUG_RENDERING).append(": ").append(m_debugRendering).append(LINE_SEP);
38 buffer.append(SHOW_JARLOBJ_TREE).append(": ").append(m_showJarlObjTree).append(LINE_SEP);
39 buffer.append(SHOW_JARLINST_TREE).append(": ").append(m_showJarlInstTree).append(LINE_SEP);
40 return buffer.toString();
41 }
42
43 public boolean isReuseFrame() {
44 return m_reuseFrame;
45 }
46
47 public void setReuseFrame(boolean reuseFrame) {
48 if (reuseFrame != m_reuseFrame) {
49 m_reuseFrame = reuseFrame;
50 raiseEvent(REUSE_FRAME);
51 }
52 }
53
54 public boolean isDebugRendering() {
55 return m_debugRendering;
56 }
57
58 public void setDebugRendering(boolean debugRendering) {
59 if (debugRendering != m_debugRendering) {
60 m_debugRendering = debugRendering;
61 raiseEvent(DEBUG_RENDERING);
62 }
63 }
64
65 public boolean isShowJarlObjTree() {
66 return m_showJarlObjTree;
67 }
68
69 public void setShowJarlObjTree(boolean showJarlObjTree) {
70 if (m_showJarlObjTree != showJarlObjTree) {
71 m_showJarlObjTree = showJarlObjTree;
72 raiseEvent(SHOW_JARLOBJ_TREE);
73 }
74 }
75
76 public boolean isShowJarlInstTree() {
77 return m_showJarlInstTree;
78 }
79
80 public void setShowJarlInstTree(boolean showJarlInstTree) {
81 if (m_showJarlInstTree != showJarlInstTree) {
82 m_showJarlInstTree = showJarlInstTree;
83 raiseEvent(SHOW_JARLINST_TREE);
84 }
85 }
86 }