Methods Summary |
---|
private void | addChildMenuItem(MenuItem child)
if (this.style != MenuItem.STYLE_MENU) {
throw new RuntimeException("cannot add to non-container MenuItem");
}
this.children.add(child);
|
public void | addFillListener(MenuItemFillListener listener)
fill_listeners.add(listener);
|
public void | addListener(MenuItemListener l)
listeners.add(l);
|
public void | addMultiListener(MenuItemListener l)
m_listeners.add(l);
|
public java.lang.Object | getData()
return (data);
|
public org.gudy.azureus2.plugins.ui.Graphic | getGraphic()
return (graphic);
|
public MenuItem | getItem(java.lang.String key)
if (this.style != MenuItem.STYLE_MENU) {
return null;
}
java.util.Iterator itr = this.children.iterator();
MenuItem result = null;
while (itr.hasNext()) {
result = (MenuItem) itr.next();
if (key.equals(result.getResourceKey())) {
return result;
}
}
return null;
|
public MenuItem[] | getItems()
if (this.style != MenuItem.STYLE_MENU) {
return null;
}
return (MenuItem[]) this.children.toArray(new MenuItem[this.children
.size()]);
|
public java.lang.String | getMenuID()
return sMenuID;
|
public MenuItem | getParent()
return this.parent;
|
public java.lang.String | getResourceKey()
return sName;
|
public int | getStyle()
return (style);
|
public java.lang.String | getText()
if (this.display_text == null) {
return MessageText.getString(this.getResourceKey());
}
return this.display_text;
|
public void | invokeListenersMulti(java.lang.Object[] rows)
// We invoke the multi listeners first...
invokeListenersOnList(this.m_listeners, rows);
if (rows == null) {invokeListenersSingle(null); return;}
for (int i=0; i<rows.length; i++) {
invokeListenersSingle(rows[i]);
}
|
protected void | invokeListenersOnList(java.util.List listeners_to_notify, java.lang.Object o)
for (int i = 0; i < listeners_to_notify.size(); i++) {
try {
((MenuItemListener) (listeners_to_notify.get(i))).selected(
this, o);
} catch (Throwable e) {
Debug.printStackTrace(e);
}
}
|
private void | invokeListenersSingle(java.lang.Object o)
invokeListenersOnList(this.listeners, o);
|
public void | invokeMenuWillBeShownListeners(java.lang.Object o)
for (int i = 0; i < fill_listeners.size(); i++) {
try {
((MenuItemFillListener) (fill_listeners.get(i)))
.menuWillBeShown(this, o);
} catch (Throwable e) {
Debug.printStackTrace(e);
}
}
|
public boolean | isEnabled()
return (enabled);
|
public boolean | isSelected()
if (style != STYLE_CHECK && style != STYLE_RADIO) {
throw new RuntimeException("Style is not STYLE_CHECK or STYLE_RADIO");
}
if (data == null) {
throw new RuntimeException("Item is neither selected or deselected");
}
if (!(data instanceof Boolean)) {
throw new RuntimeException("Invalid data assigned to menu item, should be boolean: " + data);
}
return ((Boolean)data).booleanValue();
|
public boolean | isVisible()return visible;
|
public void | remove()
removeWithEvents(UIManagerEvent.ET_REMOVE_MENU_ITEM, UIManagerEvent.ET_REMOVE_SUBMENU_ITEM);
|
public void | removeAllChildItems()
// This should make this.children be empty...
MenuItem[] children = this.getItems();
if (children != null) {
for (int i=0; i<children.length; i++) {children[i].remove();}
}
|
public void | removeFillListener(MenuItemFillListener listener)
fill_listeners.remove(listener);
|
public void | removeListener(MenuItemListener l)
listeners.remove(l);
|
public void | removeMultiListener(MenuItemListener l)
m_listeners.remove(l);
|
protected void | removeWithEvents(int root_menu_event, int sub_menu_event)
removeAllChildItems();
if (this.parent != null) {
UIManagerImpl.fireEvent(sub_menu_event, new Object[]{this.parent, this});
parent.children.remove(this);
this.parent = null;
}
else {
UIManagerImpl.fireEvent(root_menu_event, this);
}
this.data = null;
this.graphic = null;
this.listeners.clear();
this.fill_listeners.clear();
this.m_listeners.clear();
|
public void | setData(java.lang.Object _data)
data = _data;
|
public void | setEnabled(boolean _enabled)
enabled = _enabled;
|
public void | setGraphic(org.gudy.azureus2.plugins.ui.Graphic _graphic)
graphic = _graphic;
|
public void | setStyle(int _style)
if (this.style == MenuItem.STYLE_MENU && _style != MenuItem.STYLE_MENU) {
throw new RuntimeException(
"cannot revert menu style MenuItem object to another style");
}
style = _style;
|
public void | setText(java.lang.String text)
this.display_text = text;
|
public void | setVisible(boolean visible)this.visible = visible;
|