129 * @param text The string to display in the text property of controls such
130 * as {@link Button#textProperty() Button}.
131 * @param buttonData The type of button that should be created from this ButtonType.
132 */
133 public ButtonType(@NamedArg("text") String text,
134 @NamedArg("buttonData") ButtonData buttonData) {
135 this(null, text, buttonData);
136 }
137
138 /**
139 * Provide key or text. The other one should be null.
140 */
141 private ButtonType(String key, String text, ButtonData buttonData) {
142 this.key = key;
143 this.text = text;
144 this.buttonData = buttonData;
145 }
146
147 /**
148 * Returns the ButtonData specified for this ButtonType in the constructor.
149 */
150 public final ButtonData getButtonData() { return this.buttonData; }
151
152 /**
153 * Returns the text specified for this ButtonType in the constructor;
154 */
155 public final String getText() {
156 if (text == null && key != null) {
157 return ControlResources.getString(key);
158 } else {
159 return text;
160 }
161 }
162
163 /** {@inheritDoc} */
164 @Override public String toString() {
165 return "ButtonType [text=" + getText() + ", buttonData=" + getButtonData() + "]";
166 }
167 }
|
129 * @param text The string to display in the text property of controls such
130 * as {@link Button#textProperty() Button}.
131 * @param buttonData The type of button that should be created from this ButtonType.
132 */
133 public ButtonType(@NamedArg("text") String text,
134 @NamedArg("buttonData") ButtonData buttonData) {
135 this(null, text, buttonData);
136 }
137
138 /**
139 * Provide key or text. The other one should be null.
140 */
141 private ButtonType(String key, String text, ButtonData buttonData) {
142 this.key = key;
143 this.text = text;
144 this.buttonData = buttonData;
145 }
146
147 /**
148 * Returns the ButtonData specified for this ButtonType in the constructor.
149 * @return the ButtonData specified for this ButtonType in the constructor
150 */
151 public final ButtonData getButtonData() { return this.buttonData; }
152
153 /**
154 * Returns the text specified for this ButtonType in the constructor.
155 * @return the text specified for this ButtonType in the constructor
156 */
157 public final String getText() {
158 if (text == null && key != null) {
159 return ControlResources.getString(key);
160 } else {
161 return text;
162 }
163 }
164
165 /** {@inheritDoc} */
166 @Override public String toString() {
167 return "ButtonType [text=" + getText() + ", buttonData=" + getButtonData() + "]";
168 }
169 }
|