BrightSide Workbench Full Report + Source Code
WizardPanel.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2012 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.turro.zkoss.wizard;
20 
21 import org.zkoss.zul.Tabpanel;
22 
27 public class WizardPanel extends Tabpanel {
28 
29  private Object objectValue;
30 
31  protected boolean
32  allowFinish = false,
33  allowNext = true,
34  allowPrior = true,
35  allowCancel = true,
36  shouldSkip = false,
37  skipFirst = false,
38  finalSplash = false;
39 
40  public Object getObjectValue() {
41  return objectValue;
42  }
43 
44  public void setObjectValue(Object objectValue) {
45  this.objectValue = objectValue;
46  }
47 
48  public boolean doEnter() {
49  return getComposer() == null ? false : getComposer().doEnter();
50  }
51 
52  public boolean doLeave(boolean forwards) {
53  return getComposer() == null ? false : getComposer().doLeave(forwards);
54  }
55 
56  public boolean doFinish() {
57  return getComposer() == null ? false : getComposer().doFinish();
58  }
59 
60  public boolean doCancel() {
61  return getComposer() == null ? false : getComposer().doCancel();
62  }
63 
64  public boolean isAllowCancel() {
65  return allowCancel && !finalSplash;
66  }
67 
68  public void setAllowCancel(boolean allowCancel) {
69  this.allowCancel = allowCancel;
70  }
71 
72  public boolean isAllowFinish() {
73  return allowFinish;
74  }
75 
76  public void setAllowFinish(boolean allowFinish) {
77  this.allowFinish = allowFinish;
78  }
79 
80  public boolean isAllowNext() {
81  return allowNext && !finalSplash;
82  }
83 
84  public void setAllowNext(boolean allowNext) {
85  this.allowNext = allowNext;
86  }
87 
88  public boolean isAllowPrior() {
89  return allowPrior && !finalSplash;
90  }
91 
92  public void setAllowPrior(boolean allowPrior) {
93  this.allowPrior = allowPrior;
94  }
95 
96  public boolean isFinalSplash() {
97  return finalSplash;
98  }
99 
100  public void setFinalSplash(boolean finalSplash) {
101  this.finalSplash = finalSplash;
102  if(finalSplash) allowFinish = true;
103  }
104 
105  public boolean isShouldSkip() {
106  return shouldSkip;
107  }
108 
109  public void setShouldSkip(boolean shouldSkip) {
110  this.shouldSkip = shouldSkip;
111  }
112 
113  public boolean isSkipFirst() {
114  return skipFirst;
115  }
116 
117  public void setSkipFirst(boolean skipFirst) {
118  this.skipFirst = skipFirst;
119  }
120 
121  public boolean checkSkipFirst() {
122  if(skipFirst) {
123  skipFirst = false;
124  return true;
125  }
126  return false;
127  }
128 
129  private WizardPanelComposer getComposer() {
130  Object composer = getAttribute("$composer");
131  if(composer instanceof WizardPanelComposer) {
132  return (WizardPanelComposer) composer;
133  }
134  return null;
135  }
136 }
void setAllowCancel(boolean allowCancel)
void setFinalSplash(boolean finalSplash)
void setObjectValue(Object objectValue)
boolean doLeave(boolean forwards)
void setAllowPrior(boolean allowPrior)
void setAllowNext(boolean allowNext)
void setAllowFinish(boolean allowFinish)
void setShouldSkip(boolean shouldSkip)
void setSkipFirst(boolean skipFirst)