net.sf.jaxodraw.gui.panel
Class JaxoTabbedCanvasPanel

java.lang.Object
  extended by java.awt.event.MouseAdapter
      extended by net.sf.jaxodraw.gui.panel.JaxoTabbedCanvasPanel
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.util.EventListener, JaxoLocalized

public class JaxoTabbedCanvasPanel
extends java.awt.event.MouseAdapter
implements JaxoLocalized

A tabbed panel.

Since:
2.0

Constructor Summary
JaxoTabbedCanvasPanel(JaxoMainPanel panel)
          Constructor: adds MouseListener and ChangeListener to the tabbedPane.
 
Method Summary
 void fileEvent(int i)
          Executes the methods defined as file events in JaxoConstants.
 javax.swing.JComponent getRoot()
          Root component displaying current tabs and a way to switch between them.
 JaxoTab getSelectedTab()
          Return the currently active tab.
 int getSelectedTabIndex()
          Returns the index of the currently active tab.
 JaxoTab getTabAt(int index)
          Returns the tab at given index.
 int getTabCount()
          Gets the current number of tabs.
 int getTabIndex(JaxoTab t)
          Get the index of the given tab.
 JaxoTab getTabWithSaveFileName(java.lang.String name)
          (An arbitrary) Tab with the given saveFileName, or 'null' if none exists.
 void initTabs()
          Initialize tabs (show a default untitled tab if there is not).
 void initTabs(java.lang.String initialFileName)
          Initialize tabs (open 'initialFile', or, if it fails, and there is no tab, show a default untitled tab.
 void mousePressed(java.awt.event.MouseEvent e)
          Processes the right-click to show the popup menu on the canvas tab.
 void open(java.lang.String fileName)
          Open given file in a new tab.
 void openOrImport(java.lang.String fileName)
          Open given file (JaxoDraw or plugin based on extension) in a new tab.
 void renameTab()
          Brings up a dialog to rename the current tab.
 void setSelectedTab(JaxoTab value)
          Sets the given tab as currently selected.
 void setSelectedTabIndex(int value)
          Sets the tab at given index as currently active.
 void updateLanguage()
          Updates the component with the current language as set in the preferences (JaxoPrefs.PREF_LANGUAGE).
 
Methods inherited from class java.awt.event.MouseAdapter
mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseReleased, mouseWheelMoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JaxoTabbedCanvasPanel

public JaxoTabbedCanvasPanel(JaxoMainPanel panel)
Constructor: adds MouseListener and ChangeListener to the tabbedPane.

Parameters:
panel - Instance of the main panel
Method Detail

initTabs

public void initTabs()
Initialize tabs (show a default untitled tab if there is not).


initTabs

public void initTabs(java.lang.String initialFileName)
Initialize tabs (open 'initialFile', or, if it fails, and there is no tab, show a default untitled tab.

Parameters:
initialFileName - The file to open.

getRoot

public final javax.swing.JComponent getRoot()
Root component displaying current tabs and a way to switch between them.

Returns:
The root component.

getTabCount

public final int getTabCount()
Gets the current number of tabs.

Returns:
The current number of tabs.

getTabAt

public final JaxoTab getTabAt(int index)
Returns the tab at given index.

Parameters:
index - The index of tab to get.
Returns:
The tab

getTabIndex

public int getTabIndex(JaxoTab t)
Get the index of the given tab.

Parameters:
t - The tab.
Returns:
The index of the tab.

getSelectedTab

public final JaxoTab getSelectedTab()
Return the currently active tab.

Returns:
The active tab.

getSelectedTabIndex

public final int getSelectedTabIndex()
Returns the index of the currently active tab.

Returns:
The index of the tab.

setSelectedTab

public void setSelectedTab(JaxoTab value)
Sets the given tab as currently selected.

Parameters:
value - True for selected.

setSelectedTabIndex

public void setSelectedTabIndex(int value)
Sets the tab at given index as currently active.

Parameters:
value - The index.

getTabWithSaveFileName

public final JaxoTab getTabWithSaveFileName(java.lang.String name)
(An arbitrary) Tab with the given saveFileName, or 'null' if none exists.

Parameters:
name - The save file name of the tab.
Returns:
The tab with given name, or 'null' if if name does not exist.

updateLanguage

public final void updateLanguage()
Updates the component with the current language as set in the preferences (JaxoPrefs.PREF_LANGUAGE).

Specified by:
updateLanguage in interface JaxoLocalized

fileEvent

public final void fileEvent(int i)
Executes the methods defined as file events in JaxoConstants.

Parameters:
i - Integer specifying the file event.

renameTab

public void renameTab()
Brings up a dialog to rename the current tab.


open

public void open(java.lang.String fileName)
Open given file in a new tab.

Parameters:
fileName - The file to open.

openOrImport

public void openOrImport(java.lang.String fileName)
Open given file (JaxoDraw or plugin based on extension) in a new tab.

Parameters:
fileName - The file to open or import.

mousePressed

public final void mousePressed(java.awt.event.MouseEvent e)
Processes the right-click to show the popup menu on the canvas tab.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Overrides:
mousePressed in class java.awt.event.MouseAdapter
Parameters:
e - The mouse event.


Licensed under GPL. For more information, see http://jaxodraw.sourceforge.net/license.html or the LICENSE file in the jaxodraw distribution.