The Meta-Environment API

nl.cwi.sen1.gui.component
Interface StudioComponent

All Known Implementing Classes:
StudioComponentImpl

public interface StudioComponent

The (visual) interface to a tab (window) that is hosted in a MetaStudio.


Method Summary
 void addNameChangedListener(NameChangedListener l)
          Register a NameChangedListener.
 void addStudioComponentListener(StudioComponentListener l)
          Register a listener (usually the plugin that this Component belongs to, and the MetaStudio).
 void addTooltipChangedListener(TooltipChangedListener l)
          Register a TooltipChangedListener.
 void close()
          Closes a component.
 javax.swing.Icon getIcon()
          Tabs can be labelled with small icons too.
 java.lang.String getName()
          The name is used to construct labels of tabs.
 javax.swing.JComponent[] getStatusBarComponents()
          The MetaStudio has a status bar at the bottom.
 java.lang.String getTooltip()
          The tooltip is used to show when hovering the mouse over tabs.
 javax.swing.JComponent getViewComponent()
          The bridge to Swing is made here.
 void receiveFocus()
          Receive the focus.
 void removeNameChangedListener(NameChangedListener l)
          Unregister a NameChangedListener.
 void removeStudioComponentListener(StudioComponentListener l)
          Unregister a listener.
 void removeTooltipChangedListener(TooltipChangedListener l)
          Unregister a TooltipChangedListener.
 void requestClose()
          Request to close the window.
 void setName(java.lang.String name)
          The name can be changed.
 void setTooltip(java.lang.String tooltip)
          The tooltip can be changed.
 

Method Detail

getName

java.lang.String getName()
The name is used to construct labels of tabs.

Returns:
the label of a tab.

setName

void setName(java.lang.String name)
The name can be changed.

Parameters:
name - new name for this component.

getTooltip

java.lang.String getTooltip()
The tooltip is used to show when hovering the mouse over tabs.

Returns:
the tooltip of a tab.

setTooltip

void setTooltip(java.lang.String tooltip)
The tooltip can be changed.

Parameters:
tooltip - new tooltip for this component.

getIcon

javax.swing.Icon getIcon()
Tabs can be labelled with small icons too.

Returns:
an icon to be used by the Studio

getViewComponent

javax.swing.JComponent getViewComponent()
The bridge to Swing is made here. The returned JComponent will fill exactly one tab. Any JComponent will do.


addStudioComponentListener

void addStudioComponentListener(StudioComponentListener l)
Register a listener (usually the plugin that this Component belongs to, and the MetaStudio). The studio and the plugin listen to important changes in the state of a component. This may be used to implement window management, by the plugin, or by the Studio.

Parameters:
l - the listener to register.

removeStudioComponentListener

void removeStudioComponentListener(StudioComponentListener l)
Unregister a listener.


requestClose

void requestClose()
                  throws CloseAbortedException
Request to close the window. The controls on a tab window are implemented by the @see MetaStudio. If a user clicks the close icon on a tab, the component will be notified using this method. This gives the component the chance to save resources, or start save/cancel dialogs if necessary.

Throws:
CloseAbortedException - if the component can not be closed (for example when the user chooses to cancel.

close

void close()
Closes a component. This makes the component invisible immediately.


receiveFocus

void receiveFocus()
Receive the focus. When a component receives the focus, there is sometimes something to do, like reset or set the focus to a particular part of the component.


getStatusBarComponents

javax.swing.JComponent[] getStatusBarComponents()
The MetaStudio has a status bar at the bottom. When a component receives the focus, the status bar will show the returned JComponents from left to right in a certain part of the status bar.

Returns:
an array of JComponents to show in the status bar.

addNameChangedListener

void addNameChangedListener(NameChangedListener l)
Register a NameChangedListener. If a tab wants to change its name, it should notify all NameChangedListeners. The MetaStudio itself uses it to update the label on the tab.


removeNameChangedListener

void removeNameChangedListener(NameChangedListener l)
Unregister a NameChangedListener.


addTooltipChangedListener

void addTooltipChangedListener(TooltipChangedListener l)
Register a TooltipChangedListener. If a tab wants to change its tooltip, it should notify all TooltipChangedListeners. The MetaStudio itself uses it to update the tooltip off the tab.


removeTooltipChangedListener

void removeTooltipChangedListener(TooltipChangedListener l)
Unregister a TooltipChangedListener.


The Meta-Environment API