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:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class PaletteEditor
extends javax.swing.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 4219 2011-05-27 08:52:57Z frank $
Author:
Rudolf Mayer, Jakob Frank
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  javax.swing.JToggleButton btnAddColor
           
private  javax.swing.JButton btnApply
           
private  javax.swing.JButton btnClose
           
private  javax.swing.JToggleButton btnDelColor
           
private  javax.swing.JButton btnNew
           
private  javax.swing.JButton btnSaveJava
           
private  javax.swing.JButton btnSaveMatLab
           
private  javax.swing.JButton btnSaveXML
           
private  javax.swing.JPanel centerPanel
           
private  javax.swing.JCheckBox chkInterpol
           
private  javax.swing.JCheckBox chkUseGradientPoints
           
private  javax.swing.JCheckBox chkVisible
           
private  javax.swing.JComboBox cmbPalettes
           
private  javax.swing.JPanel colorPanel
           
private  Palette displayedPalette
           
private  javax.swing.JLabel jLabel
           
private  javax.swing.JLabel jLabel1
           
private  javax.swing.JLabel jLabel2
           
private  javax.swing.JLabel jLabel3
           
private  javax.swing.JLabel jLabel4
           
private  javax.swing.JLabel jLabel5
           
private  javax.swing.JLabel lblColors
           
private  javax.swing.JLabel lblWhatToDo
           
private  javax.swing.JPanel mainPanel
           
private  int mode
           
private  javax.swing.JPanel northPanel
           
private  PaletteDisplayer paletteDrawingPanel
           
private  javax.swing.JPanel pnlAddRemoveColors
           
private  javax.swing.JPanel pnlColors
           
private  javax.swing.JPanel pnlSeperator
           
private  javax.swing.JPanel pnlSettings
           
private  javax.swing.JScrollPane scpColors
           
private  javax.swing.JScrollPane scpDescription
           
private  javax.swing.JPanel selectPanel
           
private static long serialVersionUID
           
private  SOMViewer somViewer
           
private static int SOMVIEWER
           
private  javax.swing.JPanel southPanel
           
private  javax.swing.JSpinner spnTargetColorCount
           
private static int STANDALONE
           
private  CommonSOMViewerStateData state
           
private  javax.swing.JTextArea txtDescription
           
private  javax.swing.JTextField txtGroup
           
private  javax.swing.JTextField txtLongname
           
private  javax.swing.JTextField txtShortname
           
private  javax.swing.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  javax.swing.JButton createColorButton(int i, java.awt.Color c)
           
private  javax.swing.JSpinner createGradientSpinner(int i, double value, double lBound, double uBound)
           
private  javax.swing.JToggleButton getBtnAddColor()
          This method initializes btnAddColor
private  javax.swing.JButton getBtnApply()
          This method initializes btnApply
private  javax.swing.JButton getBtnClose()
          This method initializes btnClose
private  javax.swing.JToggleButton getBtnDelColor()
          This method initializes btnDelColor
private  javax.swing.JButton getBtnNew()
          This method initializes btnNew
private  javax.swing.JButton getBtnSaveJava()
          This method initializes btnSaveJava
private  javax.swing.JButton getBtnSaveMatLab()
          This method initializes btnSaveMatLab
private  javax.swing.JButton getBtnSaveXML()
          This method initializes btnSaveXML
private  javax.swing.JPanel getCenterPanel()
          This method initializes centerPanel
private  javax.swing.JCheckBox getChkInterpol()
          This method initializes chkInterpol
private  javax.swing.JCheckBox getChkUseGradientPoints()
          This method initializes chkUseGradientPoints
private  javax.swing.JCheckBox getChkVisible()
          This method initializes chkVisible
private  javax.swing.JPanel getColorPanel()
          This method initializes colorPanel
private  javax.swing.JPanel getEmbeddedPaletteSelector()
           
private  javax.swing.JPanel getMainPanel()
          This method initializes mainPanel
private  javax.swing.JPanel getNorthPanel()
          This method initializes northPanel
private  Palette getPalette()
           
private  PaletteDisplayer getPaletteDrawingPanel()
          This method initializes paletteDrawingPanel
private  javax.swing.JPanel getPnlAddRemoveColors()
          This method initializes pnlAddRemoveColors
private  javax.swing.JPanel getPnlColors()
          This method initializes jPanel
private  javax.swing.JPanel getPnlSeperator()
          This method initializes pnlSeperator
private  javax.swing.JPanel getPnlSettings()
          This method initializes pnlSettings
private  javax.swing.JScrollPane getScpColors()
          This method initializes scpColors
private  javax.swing.JScrollPane getScpDescription()
          This method initializes scpDescription
private  javax.swing.JPanel getSelectPanel()
          This method initializes selectPanel
private  javax.swing.JPanel getSouthPanel()
          This method initializes southPanel
private  javax.swing.JSpinner getSpnTargetColorCount()
          This method initializes spnTargetColorCount
private  javax.swing.JPanel getStandalonePaletteSelector()
           
private  javax.swing.JTextArea getTxtDescription()
          This method initializes txtDescription
private  javax.swing.JTextField getTxtGroup()
          This method initializes txtGroup
private  javax.swing.JTextField getTxtLongname()
          This method initializes txtLongname
private  javax.swing.JTextField getTxtShortname()
          This method initializes txtShortname
private  void initialize()
          This method initializes this
static void main(java.lang.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 javax.swing.JPanel northPanel

centerPanel

private javax.swing.JPanel centerPanel

mainPanel

private javax.swing.JPanel mainPanel

southPanel

private javax.swing.JPanel southPanel

btnClose

private javax.swing.JButton btnClose

btnSaveJava

private javax.swing.JButton btnSaveJava

btnSaveMatLab

private javax.swing.JButton btnSaveMatLab

btnSaveXML

private javax.swing.JButton btnSaveXML

btnNew

private javax.swing.JButton btnNew

selectPanel

private javax.swing.JPanel selectPanel

paletteDrawingPanel

private PaletteDisplayer paletteDrawingPanel

chkInterpol

private javax.swing.JCheckBox chkInterpol

spnTargetColorCount

private javax.swing.JSpinner spnTargetColorCount

lblColors

private javax.swing.JLabel lblColors

scpColors

private javax.swing.JScrollPane scpColors

colorPanel

private javax.swing.JPanel colorPanel

chkUseGradientPoints

private javax.swing.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 javax.swing.JButton btnApply

pnlSeperator

private javax.swing.JPanel pnlSeperator

pnlAddRemoveColors

private javax.swing.JPanel pnlAddRemoveColors

btnAddColor

private javax.swing.JToggleButton btnAddColor

btnDelColor

private javax.swing.JToggleButton btnDelColor

lblWhatToDo

private javax.swing.JLabel lblWhatToDo

pnlSettings

private javax.swing.JPanel pnlSettings

jLabel

private javax.swing.JLabel jLabel

txtShortname

private javax.swing.JTextField txtShortname

jLabel1

private javax.swing.JLabel jLabel1

txtLongname

private javax.swing.JTextField txtLongname

jLabel2

private javax.swing.JLabel jLabel2

scpDescription

private javax.swing.JScrollPane scpDescription

txtDescription

private javax.swing.JTextArea txtDescription

cmbPalettes

private javax.swing.JComboBox cmbPalettes

xmlFile

private javax.swing.JTextField xmlFile

pnlColors

private javax.swing.JPanel pnlColors

jLabel3

private javax.swing.JLabel jLabel3

txtGroup

private javax.swing.JTextField txtGroup

jLabel4

private javax.swing.JLabel jLabel4

jLabel5

private javax.swing.JLabel jLabel5

chkVisible

private javax.swing.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 javax.swing.JPanel getStandalonePaletteSelector()

getEmbeddedPaletteSelector

private javax.swing.JPanel getEmbeddedPaletteSelector()

initialize

private void initialize()
This method initializes this


getNorthPanel

private javax.swing.JPanel getNorthPanel()
This method initializes northPanel

Returns:
javax.swing.JPanel

getCenterPanel

private javax.swing.JPanel getCenterPanel()
This method initializes centerPanel

Returns:
javax.swing.JPanel

getMainPanel

private javax.swing.JPanel getMainPanel()
This method initializes mainPanel

Returns:
javax.swing.JPanel

getSouthPanel

private javax.swing.JPanel getSouthPanel()
This method initializes southPanel

Returns:
javax.swing.JPanel

getBtnClose

private javax.swing.JButton getBtnClose()
This method initializes btnClose

Returns:
javax.swing.JButton

getBtnSaveJava

private javax.swing.JButton getBtnSaveJava()
This method initializes btnSaveJava

Returns:
javax.swing.JButton

getBtnSaveMatLab

private javax.swing.JButton getBtnSaveMatLab()
This method initializes btnSaveMatLab

Returns:
javax.swing.JButton

getBtnSaveXML

private javax.swing.JButton getBtnSaveXML()
This method initializes btnSaveXML

Returns:
javax.swing.JButton

getBtnNew

private javax.swing.JButton getBtnNew()
This method initializes btnNew

Returns:
javax.swing.JButton

getSelectPanel

private javax.swing.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 javax.swing.JCheckBox getChkInterpol()
This method initializes chkInterpol

Returns:
javax.swing.JCheckBox

getSpnTargetColorCount

private javax.swing.JSpinner getSpnTargetColorCount()
This method initializes spnTargetColorCount

Returns:
javax.swing.JSpinner

getScpColors

private javax.swing.JScrollPane getScpColors()
This method initializes scpColors

Returns:
javax.swing.JScrollPane

getColorPanel

private javax.swing.JPanel getColorPanel()
This method initializes colorPanel

Returns:
javax.swing.JPanel

getChkUseGradientPoints

private javax.swing.JCheckBox getChkUseGradientPoints()
This method initializes chkUseGradientPoints

Returns:
javax.swing.JCheckBox

getBtnApply

private javax.swing.JButton getBtnApply()
This method initializes btnApply

Returns:
javax.swing.JButton

getPnlSeperator

private javax.swing.JPanel getPnlSeperator()
This method initializes pnlSeperator

Returns:
javax.swing.JPanel

getPnlAddRemoveColors

private javax.swing.JPanel getPnlAddRemoveColors()
This method initializes pnlAddRemoveColors

Returns:
javax.swing.JPanel

getBtnAddColor

private javax.swing.JToggleButton getBtnAddColor()
This method initializes btnAddColor

Returns:
javax.swing.JButton

getBtnDelColor

private javax.swing.JToggleButton getBtnDelColor()
This method initializes btnDelColor

Returns:
javax.swing.JButton

getPnlSettings

private javax.swing.JPanel getPnlSettings()
This method initializes pnlSettings

Returns:
javax.swing.JPanel

getTxtShortname

private javax.swing.JTextField getTxtShortname()
This method initializes txtShortname

Returns:
javax.swing.JTextField

getTxtLongname

private javax.swing.JTextField getTxtLongname()
This method initializes txtLongname

Returns:
javax.swing.JTextField

getScpDescription

private javax.swing.JScrollPane getScpDescription()
This method initializes scpDescription

Returns:
javax.swing.JScrollPane

getTxtDescription

private javax.swing.JTextArea getTxtDescription()
This method initializes txtDescription

Returns:
javax.swing.JTextArea

getPnlColors

private javax.swing.JPanel getPnlColors()
This method initializes jPanel

Returns:
javax.swing.JPanel

getTxtGroup

private javax.swing.JTextField getTxtGroup()
This method initializes txtGroup

Returns:
javax.swing.JTextField

getChkVisible

private javax.swing.JCheckBox getChkVisible()
This method initializes chkVisible

Returns:
javax.swing.JCheckBox

main

public static void main(java.lang.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 javax.swing.JButton createColorButton(int i,
                                              java.awt.Color c)

createGradientSpinner

private javax.swing.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.