BrightSide Workbench Full Report + Source Code
DialogButton.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2011 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 package org.turro.zkoss.dialog;
19 
20 import java.util.EnumSet;
21 import java.util.Set;
22 import org.turro.i18n.I_;
23 import org.zkoss.zul.Button;
24 
29 public enum DialogButton {
30 
31  BUTTON_OK("/_zul/images/ok.png", "Ok"),
32  BUTTON_CANCEL("/_zul/images/cancel.png", "Cancel"),
33  BUTTON_CLOSE("/_zul/images/close.png", "Close");
34 
35  private String image, label;
36 
37  private DialogButton(String image, String label) {
38  this.image = image;
39  this.label = label;
40  }
41 
42  public String getImage() {
43  return image;
44  }
45 
46  public String getLabel() {
47  return label;
48  }
49 
50  public Button getButton() {
51  Button button = new Button(I_.get(label));
52  if(image != null) {
53  button.setImage(image);
54  }
55  return button;
56  }
57 
58  public static Set<DialogButton> getOkCancelButtons() {
59  return EnumSet.of(BUTTON_OK, BUTTON_CANCEL);
60  }
61 
62  public static Set<DialogButton> getCloseButtons() {
63  return EnumSet.of(BUTTON_CLOSE);
64  }
65 
66 }
static String get(String msg)
Definition: I_.java:41
static Set< DialogButton > getCloseButtons()
static Set< DialogButton > getOkCancelButtons()