org.gnu.gtk

Class UIManager

public class UIManager extends GObject

A class to construct a user interface (menus and toolbars) from one or more UI definitions, which reference actions from one or more action groups. The UI definitions are specified in an XML format. See the GTK documentation of GtkUIManager for details of this class and the UI definitions XML format.
Constructor Summary
UIManager()
Method Summary
voidaddListener(UIManagerListener listener)
Register an object to handle spin events.
voidaddUI(int mergeId, String path, String name, String action, UIManagerItemType type, boolean top)
intaddUIFromFile(String filename)
Parses a file containing a UI definition and merges it with the current contents of self.
intaddUIFromReader(Reader reader)
Parse the contents of a Reader that contains a UI definition and merges it with the current contents of self.
intaddUIFromString(String ui)
Parses a string containing a UI definition and merges it with the current contents of self.
voidensureUpdate()
AccelGroupgetAccelGroup()
ActiongetAction(String path)
ListgetActionGroups()
booleangetAddTearoffs()
ClassgetEventListenerClass(String signal)
EventTypegetEventType(String signal)
Widget[]getToplevels(UIManagerItemType types)
StringgetUI()
WidgetgetWidget(String path)
voidinsertActionGroup(ActionGroup group, int position)
intnewMergeId()
voidremoveActionGroup(ActionGroup group)
voidremoveListener(UIManagerListener listener)
Removes a listener
voidremoveUI(int mergeId)
Unmerges the part of this UIManager's content identified by mergeId.
voidsetAddTearoffs(boolean addTearoffs)

Constructor Detail

UIManager

public UIManager()

Method Detail

addListener

public void addListener(UIManagerListener listener)
Register an object to handle spin events.

See Also: SpinListener

addUI

public void addUI(int mergeId, String path, String name, String action, UIManagerItemType type, boolean top)

addUIFromFile

public int addUIFromFile(String filename)
Parses a file containing a UI definition and merges it with the current contents of self.

Returns: The merge id for the merged UI. The merge id can be used to unmerge the UI with {@link #removeUI}.

Throws: RuntimeException If an error occurred adding the UI from the given String.

addUIFromReader

public int addUIFromReader(Reader reader)
Parse the contents of a Reader that contains a UI definition and merges it with the current contents of self. The reader will be wrapped in an efficient Reader implementation before the contents are read. The reader will not be closed by this method.

This method reads the contents of the Reader into a String and calls {@link #addUIFromString}. You may be interested in using an InputStreamReader here if your contents come from an InputStream (such as when using getClass().getResourceAsStream() or a URL).

Returns: The merge id for the merged UI. The merge id can be used to unmerge the UI with {@link #removeUI}.

Throws: RuntimeException If an error occurred adding the UI from the given String. java.io.IOException If there was an error reading the contents of the reader.

addUIFromString

public int addUIFromString(String ui)
Parses a string containing a UI definition and merges it with the current contents of self. An enclosing <ui> element is added if it is missing.

Returns: The merge id for the merged UI. The merge id can be used to unmerge the UI with {@link #removeUI}.

Throws: RuntimeException If an error occurred adding the UI from the given String.

ensureUpdate

public void ensureUpdate()

getAccelGroup

public AccelGroup getAccelGroup()

getAction

public Action getAction(String path)

getActionGroups

public List getActionGroups()

getAddTearoffs

public boolean getAddTearoffs()

getEventListenerClass

public Class getEventListenerClass(String signal)

getEventType

public EventType getEventType(String signal)

getToplevels

public Widget[] getToplevels(UIManagerItemType types)

getUI

public String getUI()

getWidget

public Widget getWidget(String path)

insertActionGroup

public void insertActionGroup(ActionGroup group, int position)

newMergeId

public int newMergeId()

removeActionGroup

public void removeActionGroup(ActionGroup group)

removeListener

public void removeListener(UIManagerListener listener)
Removes a listener

See Also: addListener

removeUI

public void removeUI(int mergeId)
Unmerges the part of this UIManager's content identified by mergeId.

setAddTearoffs

public void setAddTearoffs(boolean addTearoffs)