at.tuwien.ifs.somtoolbox.apps
Class PaletteEditor

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by at.tuwien.ifs.somtoolbox.apps.PaletteEditor
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class PaletteEditor
extends JFrame

This class allows you to quickly view, edit, create and export palettes. It can be used embedded into the SOMViewer or started Standalone.

Version:
$Id: PaletteEditor.java 3877 2010-11-02 15:43:17Z frank $
Author:
Rudolf Mayer, Jakob Frank
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private  JToggleButton btnAddColor
           
private  JButton btnApply
           
private  JButton btnClose
           
private  JToggleButton btnDelColor
           
private  JButton btnNew
           
private  JButton btnSaveJava
           
private  JButton btnSaveMatLab
           
private  JButton btnSaveXML
           
private  JPanel centerPanel
           
private  JCheckBox chkInterpol
           
private  JCheckBox chkUseGradientPoints
           
private  JCheckBox chkVisible
           
private  JComboBox cmbPalettes
           
private  JPanel colorPanel
           
private  Palette displayedPalette
           
private  JLabel jLabel
           
private  JLabel jLabel1
           
private  JLabel jLabel2
           
private  JLabel jLabel3
           
private  JLabel jLabel4
           
private  JLabel jLabel5
           
private  JLabel lblColors
           
private  JLabel lblWhatToDo
           
private  JPanel mainPanel
           
private  int mode
           
private  JPanel northPanel
           
private  PaletteDisplayer paletteDrawingPanel
           
private  JPanel pnlAddRemoveColors
           
private  JPanel pnlColors
           
private  JPanel pnlSeperator
           
private  JPanel pnlSettings
           
private  JScrollPane scpColors
           
private  JScrollPane scpDescription
           
private  JPanel selectPanel
           
private static long serialVersionUID
           
private  SOMViewer somViewer
           
private static int SOMVIEWER
           
private  JPanel southPanel
           
private  JSpinner spnTargetColorCount
           
private static int STANDALONE
           
private  CommonSOMViewerStateData state
           
private  JTextArea txtDescription
           
private  JTextField txtGroup
           
private  JTextField txtLongname
           
private  JTextField txtShortname
           
private  JTextField xmlFile
           
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PaletteEditor()
          Creates a new PaletteEditor in the Standalone-mode.
PaletteEditor(SOMViewer somViewer, CommonSOMViewerStateData state)
          Creates a new PaletteEditor in the Embedded-mode, used together with the SOMViewer.
 
Method Summary
private  JButton createColorButton(int i, Color c)
           
private  JSpinner createGradientSpinner(int i, double value, double lBound, double uBound)
           
private  JToggleButton getBtnAddColor()
          This method initializes btnAddColor
private  JButton getBtnApply()
          This method initializes btnApply
private  JButton getBtnClose()
          This method initializes btnClose
private  JToggleButton getBtnDelColor()
          This method initializes btnDelColor
private  JButton getBtnNew()
          This method initializes btnNew
private  JButton getBtnSaveJava()
          This method initializes btnSaveJava
private  JButton getBtnSaveMatLab()
          This method initializes btnSaveMatLab
private  JButton getBtnSaveXML()
          This method initializes btnSaveXML
private  JPanel getCenterPanel()
          This method initializes centerPanel
private  JCheckBox getChkInterpol()
          This method initializes chkInterpol
private  JCheckBox getChkUseGradientPoints()
          This method initializes chkUseGradientPoints
private  JCheckBox getChkVisible()
          This method initializes chkVisible
private  JPanel getColorPanel()
          This method initializes colorPanel
private  JPanel getEmbeddedPaletteSelector()
           
private  JPanel getMainPanel()
          This method initializes mainPanel
private  JPanel getNorthPanel()
          This method initializes northPanel
private  Palette getPalette()
           
private  PaletteDisplayer getPaletteDrawingPanel()
          This method initializes paletteDrawingPanel
private  JPanel getPnlAddRemoveColors()
          This method initializes pnlAddRemoveColors
private  JPanel getPnlColors()
          This method initializes jPanel
private  JPanel getPnlSeperator()
          This method initializes pnlSeperator
private  JPanel getPnlSettings()
          This method initializes pnlSettings
private  JScrollPane getScpColors()
          This method initializes scpColors
private  JScrollPane getScpDescription()
          This method initializes scpDescription
private  JPanel getSelectPanel()
          This method initializes selectPanel
private  JPanel getSouthPanel()
          This method initializes southPanel
private  JSpinner getSpnTargetColorCount()
          This method initializes spnTargetColorCount
private  JPanel getStandalonePaletteSelector()
           
private  JTextArea getTxtDescription()
          This method initializes txtDescription
private  JTextField getTxtGroup()
          This method initializes txtGroup
private  JTextField getTxtLongname()
          This method initializes txtLongname
private  JTextField getTxtShortname()
          This method initializes txtShortname
private  void initialize()
          This method initializes this
static void main(String[] args)
          Starts the PaletteEditor in Standalone-Mode.
private  void setPalette(Palette p)
          Set the palette to edit.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

northPanel

private JPanel northPanel

centerPanel

private JPanel centerPanel

mainPanel

private JPanel mainPanel

southPanel

private JPanel southPanel

btnClose

private JButton btnClose

btnSaveJava

private JButton btnSaveJava

btnSaveMatLab

private JButton btnSaveMatLab

btnSaveXML

private JButton btnSaveXML

btnNew

private JButton btnNew

selectPanel

private JPanel selectPanel

paletteDrawingPanel

private PaletteDisplayer paletteDrawingPanel

chkInterpol

private JCheckBox chkInterpol

spnTargetColorCount

private JSpinner spnTargetColorCount

lblColors

private JLabel lblColors

scpColors

private JScrollPane scpColors

colorPanel

private JPanel colorPanel

chkUseGradientPoints

private JCheckBox chkUseGradientPoints

somViewer

private SOMViewer somViewer

state

private CommonSOMViewerStateData state

displayedPalette

private Palette displayedPalette

mode

private final int mode

STANDALONE

private static final int STANDALONE
See Also:
Constant Field Values

SOMVIEWER

private static final int SOMVIEWER
See Also:
Constant Field Values

btnApply

private JButton btnApply

pnlSeperator

private JPanel pnlSeperator

pnlAddRemoveColors

private JPanel pnlAddRemoveColors

btnAddColor

private JToggleButton btnAddColor

btnDelColor

private JToggleButton btnDelColor

lblWhatToDo

private JLabel lblWhatToDo

pnlSettings

private JPanel pnlSettings

jLabel

private JLabel jLabel

txtShortname

private JTextField txtShortname

jLabel1

private JLabel jLabel1

txtLongname

private JTextField txtLongname

jLabel2

private JLabel jLabel2

scpDescription

private JScrollPane scpDescription

txtDescription

private JTextArea txtDescription

cmbPalettes

private JComboBox cmbPalettes

xmlFile

private JTextField xmlFile

pnlColors

private JPanel pnlColors

jLabel3

private JLabel jLabel3

txtGroup

private JTextField txtGroup

jLabel4

private JLabel jLabel4

jLabel5

private JLabel jLabel5

chkVisible

private JCheckBox chkVisible
Constructor Detail

PaletteEditor

public PaletteEditor()
Creates a new PaletteEditor in the Standalone-mode.


PaletteEditor

public PaletteEditor(SOMViewer somViewer,
                     CommonSOMViewerStateData state)
Creates a new PaletteEditor in the Embedded-mode, used together with the SOMViewer.

Parameters:
somViewer - the SOMViewer to wich the changes sould be applied.
state - the CommonSOMViewerStateData holding various data, including the palettes to edit.
Method Detail

getStandalonePaletteSelector

private JPanel getStandalonePaletteSelector()

getEmbeddedPaletteSelector

private JPanel getEmbeddedPaletteSelector()

initialize

private void initialize()
This method initializes this


getNorthPanel

private JPanel getNorthPanel()
This method initializes northPanel

Returns:
javax.swing.JPanel

getCenterPanel

private JPanel getCenterPanel()
This method initializes centerPanel

Returns:
javax.swing.JPanel

getMainPanel

private JPanel getMainPanel()
This method initializes mainPanel

Returns:
javax.swing.JPanel

getSouthPanel

private JPanel getSouthPanel()
This method initializes southPanel

Returns:
javax.swing.JPanel

getBtnClose

private JButton getBtnClose()
This method initializes btnClose

Returns:
javax.swing.JButton

getBtnSaveJava

private JButton getBtnSaveJava()
This method initializes btnSaveJava

Returns:
javax.swing.JButton

getBtnSaveMatLab

private JButton getBtnSaveMatLab()
This method initializes btnSaveMatLab

Returns:
javax.swing.JButton

getBtnSaveXML

private JButton getBtnSaveXML()
This method initializes btnSaveXML

Returns:
javax.swing.JButton

getBtnNew

private JButton getBtnNew()
This method initializes btnNew

Returns:
javax.swing.JButton

getSelectPanel

private JPanel getSelectPanel()
This method initializes selectPanel

Returns:
javax.swing.JPanel

getPaletteDrawingPanel

private PaletteDisplayer getPaletteDrawingPanel()
This method initializes paletteDrawingPanel

Returns:
at.tuwien.ifs.somtoolbox.apps.viewer.controls.PaletteDrawingPanel

getChkInterpol

private JCheckBox getChkInterpol()
This method initializes chkInterpol

Returns:
javax.swing.JCheckBox

getSpnTargetColorCount

private JSpinner getSpnTargetColorCount()
This method initializes spnTargetColorCount

Returns:
javax.swing.JSpinner

getScpColors

private JScrollPane getScpColors()
This method initializes scpColors

Returns:
javax.swing.JScrollPane

getColorPanel

private JPanel getColorPanel()
This method initializes colorPanel

Returns:
javax.swing.JPanel

getChkUseGradientPoints

private JCheckBox getChkUseGradientPoints()
This method initializes chkUseGradientPoints

Returns:
javax.swing.JCheckBox

getBtnApply

private JButton getBtnApply()
This method initializes btnApply

Returns:
javax.swing.JButton

getPnlSeperator

private JPanel getPnlSeperator()
This method initializes pnlSeperator

Returns:
javax.swing.JPanel

getPnlAddRemoveColors

private JPanel getPnlAddRemoveColors()
This method initializes pnlAddRemoveColors

Returns:
javax.swing.JPanel

getBtnAddColor

private JToggleButton getBtnAddColor()
This method initializes btnAddColor

Returns:
javax.swing.JButton

getBtnDelColor

private JToggleButton getBtnDelColor()
This method initializes btnDelColor

Returns:
javax.swing.JButton

getPnlSettings

private JPanel getPnlSettings()
This method initializes pnlSettings

Returns:
javax.swing.JPanel

getTxtShortname

private JTextField getTxtShortname()
This method initializes txtShortname

Returns:
javax.swing.JTextField

getTxtLongname

private JTextField getTxtLongname()
This method initializes txtLongname

Returns:
javax.swing.JTextField

getScpDescription

private JScrollPane getScpDescription()
This method initializes scpDescription

Returns:
javax.swing.JScrollPane

getTxtDescription

private JTextArea getTxtDescription()
This method initializes txtDescription

Returns:
javax.swing.JTextArea

getPnlColors

private JPanel getPnlColors()
This method initializes jPanel

Returns:
javax.swing.JPanel

getTxtGroup

private JTextField getTxtGroup()
This method initializes txtGroup

Returns:
javax.swing.JTextField

getChkVisible

private JCheckBox getChkVisible()
This method initializes chkVisible

Returns:
javax.swing.JCheckBox

main

public static void main(String[] args)
Starts the PaletteEditor in Standalone-Mode.

Parameters:
args - args[0] can be a xml-Palette-file Palette.savePaletteToXML(File) which will be loaded at startup.

createColorButton

private JButton createColorButton(int i,
                                  Color c)

createGradientSpinner

private JSpinner createGradientSpinner(int i,
                                       double value,
                                       double lBound,
                                       double uBound)

getPalette

private Palette getPalette()

setPalette

private void setPalette(Palette p)
Set the palette to edit.

Parameters:
p - The Palette.