179 // PSEUDO_CLASS_OPENVERTICALLY should be set from the start.
180 pseudoClassStateChanged(PSEUDO_CLASS_OPENVERTICALLY, true);
181 }
182
183 /***************************************************************************
184 * *
185 * Properties *
186 * *
187 **************************************************************************/
188 private final ObservableList<MenuItem> items = FXCollections.<MenuItem>observableArrayList();
189
190 /**
191 * The items to show within this buttons menu. If this ObservableList is modified
192 * at runtime, the Menu will update as expected.
193 * <p>
194 * Commonly used controls include including {@code MenuItem},
195 * {@code CheckMenuItem}, {@code RadioMenuItem},
196 * and of course {@code Menu}, which if added to a menu, will become a sub
197 * menu. {@link SeparatorMenuItem} is another commonly used Node in the Menu's items
198 * ObservableList.
199 */
200 public final ObservableList<MenuItem> getItems() {
201 return items;
202 }
203
204 // --- Showing
205 /**
206 * Indicates whether the {@link ContextMenu} is currently visible.
207 */
208 private ReadOnlyBooleanWrapper showing = new ReadOnlyBooleanWrapper(this, "showing", false) {
209 @Override protected void invalidated() {
210 pseudoClassStateChanged(PSEUDO_CLASS_SHOWING, get());
211 super.invalidated();
212 }
213 };
214 private void setShowing(boolean value) {
215 // these events will not fire if the showing property is bound
216 Event.fireEvent(this, value ? new Event(ComboBoxBase.ON_SHOWING) :
217 new Event(ComboBoxBase.ON_HIDING));
218 showing.set(value);
|
179 // PSEUDO_CLASS_OPENVERTICALLY should be set from the start.
180 pseudoClassStateChanged(PSEUDO_CLASS_OPENVERTICALLY, true);
181 }
182
183 /***************************************************************************
184 * *
185 * Properties *
186 * *
187 **************************************************************************/
188 private final ObservableList<MenuItem> items = FXCollections.<MenuItem>observableArrayList();
189
190 /**
191 * The items to show within this buttons menu. If this ObservableList is modified
192 * at runtime, the Menu will update as expected.
193 * <p>
194 * Commonly used controls include including {@code MenuItem},
195 * {@code CheckMenuItem}, {@code RadioMenuItem},
196 * and of course {@code Menu}, which if added to a menu, will become a sub
197 * menu. {@link SeparatorMenuItem} is another commonly used Node in the Menu's items
198 * ObservableList.
199 * @return the list of menu items within this buttons menu
200 */
201 public final ObservableList<MenuItem> getItems() {
202 return items;
203 }
204
205 // --- Showing
206 /**
207 * Indicates whether the {@link ContextMenu} is currently visible.
208 */
209 private ReadOnlyBooleanWrapper showing = new ReadOnlyBooleanWrapper(this, "showing", false) {
210 @Override protected void invalidated() {
211 pseudoClassStateChanged(PSEUDO_CLASS_SHOWING, get());
212 super.invalidated();
213 }
214 };
215 private void setShowing(boolean value) {
216 // these events will not fire if the showing property is bound
217 Event.fireEvent(this, value ? new Event(ComboBoxBase.ON_SHOWING) :
218 new Event(ComboBoxBase.ON_HIDING));
219 showing.set(value);
|