19 package org.turro.phase;
21 import java.util.ArrayList;
22 import java.util.SortedSet;
23 import org.turro.elephant.util.Images;
24 import org.turro.i18n.I_;
25 import org.turro.zkoss.label.LabelTypes;
26 import org.zkoss.zk.ui.Component;
27 import org.zkoss.zk.ui.event.Event;
28 import org.zkoss.zk.ui.event.Events;
29 import org.zkoss.zul.Hlayout;
30 import org.zkoss.zul.Label;
31 import org.zkoss.zul.Space;
32 import org.zkoss.zul.Toolbarbutton;
41 private final ArrayList<Component> comps =
new ArrayList<>();
52 private void addComponents() {
53 if(phase ==
null)
return;
54 setSclass(
"z-valign-middle");
56 for(Component c : comps) {
60 comps.add(LabelTypes.getSoftLabel(I_.get(
"Phase")));
63 if(!possible.isEmpty()) {
64 comps.add(
new Space());
65 comps.add(LabelTypes.getSoftLabel(I_.get(
"Change to")));
67 for(
final PhaseDefinition e : possible) {
69 Toolbarbutton button =
new Toolbarbutton(
70 I_.get(e.getName()), Images.getImage(
"forward"));
71 button.addEventListener(Events.ON_CLICK, (Event event) -> {
74 Events.postEvent(new Event(Events.ON_CHANGE));
81 Component first = getFirstChild();
82 for(Component c : comps) {
83 insertBefore(c, first);
void setPhase(Phase phase)
PhaseDefinition getCurrent()
SortedSet< PhaseDefinition > getPossiblePhases()
boolean canChangeTo(PhaseDefinition newPhase)