80 public Parent<MenuItem> asMenuParent() {
81 if (parent == null) {
82 parent = new MenuItemParent(this) {
83
84 @Override
85 protected List getControls() {
86 return new FutureAction<>(getEnvironment(), () -> getControl().getItems()).get();
87 }
88 };
89 }
90 return parent;
91 }
92
93 /**
94 * @return
95 * @see MenuBarWrap#asMenuOwner()
96 */
97 @As(MenuItem.class)
98 public StringMenuOwner<MenuItem> asMenuOwner() {
99 if (menuOwner == null) {
100 menuOwner = new StringMenuOwnerImpl(this, this.as(Parent.class, Menu.class)) {
101
102 @Override
103 protected void prepare() {
104 if (!isShowing()) {
105 mouse().click();
106 getEnvironment().getWaiter(WAIT_STATE_TIMEOUT).ensureValue(true,
107 showingState);
108 }
109 }
110 };
111 }
112 return menuOwner;
113 }
114
115 private Expandable expandable = null;
116 private State<Boolean> showingState = this::isShowing;
117
118 /**
119 * Clicks on the button if the menu is not visible.
120 *
|
80 public Parent<MenuItem> asMenuParent() {
81 if (parent == null) {
82 parent = new MenuItemParent(this) {
83
84 @Override
85 protected List getControls() {
86 return new FutureAction<>(getEnvironment(), () -> getControl().getItems()).get();
87 }
88 };
89 }
90 return parent;
91 }
92
93 /**
94 * @return
95 * @see MenuBarWrap#asMenuOwner()
96 */
97 @As(MenuItem.class)
98 public StringMenuOwner<MenuItem> asMenuOwner() {
99 if (menuOwner == null) {
100 menuOwner = new StringMenuOwnerImpl(this, (Parent <Menu>)this.as(Parent.class, Menu.class)) {
101
102 @Override
103 protected void prepare() {
104 if (!isShowing()) {
105 mouse().click();
106 getEnvironment().getWaiter(WAIT_STATE_TIMEOUT).ensureValue(true,
107 showingState);
108 }
109 }
110 };
111 }
112 return menuOwner;
113 }
114
115 private Expandable expandable = null;
116 private State<Boolean> showingState = this::isShowing;
117
118 /**
119 * Clicks on the button if the menu is not visible.
120 *
|