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:
ActionListener, MouseListener, MouseMotionListener, MouseWheelListener, PropertyChangeListener, EventListener, JaxoLocalized

public class JaxoTabbedCanvasPanel
extends MouseAdapter
implements ActionListener, PropertyChangeListener, JaxoLocalized

A tabbed panel. This holds properties that are common for the whole application, eg the collection of tabs, the canvas (which is unique for all tabs), etc.

Since:
2.0

Constructor Summary
JaxoTabbedCanvasPanel(JaxoCommunicator panel, Component parent)
          Constructor: adds MouseListener and ChangeListener to the tabbedPane.
 
Method Summary
 void actionPerformed(ActionEvent e)
          
 JaxoDrawingArea getCanvas()
          Returns an instance of the canvas.
 JComponent getRoot()
          Root component displaying current tabs and a way to switch between them.
 JaxoTab getSelectedTab()
          Return 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(String name)
          (An arbitrary) Tab with the given saveFileName, or 'null' if none exists.
 boolean isAntialiasEnabled()
          Indicates whether antialiasing is active or not.
 void mousePressed(MouseEvent e)
          Processes the right-click to show the popup menu on the canvas tab.
 void openOrImport(String fileName)
          Open given file (JaxoDraw or plugin based on extension) in a new tab.
 void performAction(int mode)
          Performs the action corresponding to the given mode.
 void propertyChange(PropertyChangeEvent evt)
          
 void setAntialiasEnabled(boolean on)
          Switches antialiasing on or off.
 void setSelectedTab(JaxoTab value)
          Sets the given tab as currently selected.
 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(JaxoCommunicator panel,
                             Component parent)
Constructor: adds MouseListener and ChangeListener to the tabbedPane.

Parameters:
panel - Instance of the main panel
parent - the parent component of this panel.
Method Detail

getCanvas

public JaxoDrawingArea getCanvas()
Returns an instance of the canvas.

Returns:
The canvas.

getRoot

public final 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.

setSelectedTab

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

Parameters:
value - True for selected.

getTabWithSaveFileName

public final JaxoTab getTabWithSaveFileName(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

performAction

public void performAction(int mode)
Performs the action corresponding to the given mode.

Parameters:
mode - A mode as defined in JaxoConstants.

openOrImport

public void openOrImport(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(MouseEvent e)
Processes the right-click to show the popup menu on the canvas tab.

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

isAntialiasEnabled

public boolean isAntialiasEnabled()
Indicates whether antialiasing is active or not.

Returns:
True when antialiasing is active, false otherwise.
Since:
2.1

setAntialiasEnabled

public void setAntialiasEnabled(boolean on)
Switches antialiasing on or off.

Parameters:
on - A boolean variable that indicates whether antialising is on or not.
Since:
2.1

actionPerformed

public void actionPerformed(ActionEvent e)

Specified by:
actionPerformed in interface ActionListener
Parameters:
e - the ActionEvent.

propertyChange

public void propertyChange(PropertyChangeEvent evt)

Specified by:
propertyChange in interface PropertyChangeListener


Copyright © 2003-2011 The JaxoDraw team. All Rights Reserved.