Subversion Repository Public Repository

litesoft

Diff Revisions 200 vs 207 for /trunk/Java/core/Anywhere/src/org/litesoft/uispecification/FormState.java

Diff revisions: vs.
  @@ -5,6 +5,7 @@
5 5 {
6 6 // States:
7 7 // View
8 + // Existing
8 9 // Active
9 10 // Search
10 11 // Edit
  @@ -18,13 +19,18 @@
18 19 // Changes
19 20
20 21 private Mode mMode = Mode.Initial;
21 - private boolean mErrors, mChanges;
22 + private ErrorChangeState mErrorChangeState = ErrorChangeState.NoErrors_NoChanges;
22 23
23 24 public boolean isView()
24 25 {
25 26 return mMode == Mode.View;
26 27 }
27 28
29 + public boolean isExisting()
30 + {
31 + return isView() || isEditExisting();
32 + }
33 +
28 34 public boolean isActive()
29 35 {
30 36 return mMode.isActive();
  @@ -52,12 +58,12 @@
52 58
53 59 public boolean hasErrors()
54 60 {
55 - return mErrors;
61 + return mErrorChangeState.hasErrors();
56 62 }
57 63
58 64 public boolean hasChanges()
59 65 {
60 - return mChanges;
66 + return mErrorChangeState.hasChanges();
61 67 }
62 68
63 69 public void setModeView()
  @@ -82,21 +88,32 @@
82 88
83 89 public void setErrors( boolean pYes )
84 90 {
85 - mErrors = pYes;
91 + mErrorChangeState = mErrorChangeState.setErrors( pYes );
86 92 }
87 93
88 94 public void setChanges( boolean pYes )
89 95 {
90 - mChanges = pYes;
96 + mErrorChangeState = mErrorChangeState.setChanges( pYes );
97 + }
98 +
99 + public ErrorChangeState getErrorChangeState()
100 + {
101 + return mErrorChangeState;
102 + }
103 +
104 + public ErrorChangeState setErrorChangeState( ErrorChangeState pErrorChangeState )
105 + {
106 + if ( pErrorChangeState != null )
107 + {
108 + mErrorChangeState = pErrorChangeState;
109 + }
110 + return mErrorChangeState;
91 111 }
92 112
93 113 @Override
94 114 public String toString()
95 115 {
96 - return mMode //
97 - + (mErrors ? "-Errors" : "-NoErrors") //
98 - + (mChanges ? "-Changes" : "-NoChanges") //
99 - ;
116 + return mMode + "-" + mErrorChangeState;
100 117 }
101 118
102 119 private enum Mode