Algernon Software

org.algernon.app.j2p.gui
Class J2PWindow

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjava.awt.Frame
                  extended byjavax.swing.JFrame
                      extended byorg.algernon.app.j2p.gui.J2PWindow
All Implemented Interfaces:
Accessible, EventListener, ImageObserver, MenuContainer, MouseListener, RootPaneContainer, Runnable, Serializable, WindowConstants

public class J2PWindow
extends JFrame
implements Runnable, MouseListener

J2PWindow is the main window for Java2Protege.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private static int CONVERT_TAB_INDEX
           
private static int DEFAULT_HEIGHT
           
private static int DEFAULT_TEXT_FIELD_WIDTH
           
private static int DEFAULT_WIDTH
           
private  JButton f_addAdviceButton
           
private  JTextField f_AdviceFileField
           
private  boolean f_adviceHasChanged
           
private  JTable f_adviceJTable
           
private  JPanel f_advicePanel
           
private  AdviceTable f_adviceTable
           
private  Java2Protege f_app
           
private  JPanel f_classPanel
           
private  JTree f_classTree
           
private  Box f_convertPanel
           
private  JButton f_deleteAdviceButton
           
private  Box f_helpPanel
           
private  JTextField f_kbField
           
private  String f_lastPackageName
           
private  JTextField f_packageField
           
private  JPanel f_reviewPanel
           
private  JTextField f_rootField
           
private  JButton f_runConversionButton
           
private  JButton f_saveAdviceButton
           
private  String f_savedAdviceDirectory
           
private  String f_savedAlgernonDirectory
           
private  String f_savedKBDirectory
           
private  JTextField f_saveInAlgernonField
           
private  Box f_savePanel
           
private  JButton f_selectAdviceFileButton
           
private  JButton f_selectKBFileButton
           
private  JPanel f_slotPanel
           
private  SlotTable f_slotTable
           
private  TableSorter f_tableSorter
           
private  JTabbedPane f_tabPane
           
private static int HELP_TAB_INDEX
           
private  Color LABEL_COLOR
           
private static int REVIEW_TAB_INDEX
           
private static String ROOT_NODE_LABEL
           
private static int SAVE_TAB_INDEX
           
private  JLabel STANDARD_FOOTER
           
private  float STANDARD_FOOTER_FONT_SIZE
           
private  JLabel STANDARD_HEADER
           
private  float STANDARD_HEADER_FONT_SIZE
           
private static int STANDARD_HORIZONTAL_GAP
           
private static int STANDARD_VERTICAL_GAP
           
 
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.Window
 
Fields inherited from class java.awt.Container
 
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
J2PWindow(Java2Protege app)
          Pass in the Java2Protege instance.
 
Method Summary
 void createHelpTab()
          Creates the Help Tab
 void createReviewTab()
          Creates the Review Tab
 void createSaveTab()
          Creates the Save tab
 void createSetupTab()
          Creates the setup tab
 void doAddAdvice(ActionEvent ev)
          Adds new advice.
 void doConversion(ActionEvent event)
          Runs the conversion
private  void doCreateAdviceView()
          Creates the tabular view of the classes.
private  void doCreateClassView()
          Creates the tree view of the classes
private  void doCreateSlotView()
          Creates the tabular view of the classes.
 void doDeleteAdvice(ActionEvent ev)
          Deletes a line of advice.
 void doSaveAdviceFile(ActionEvent ev)
          Saves the advice file.
 void doSelectAdviceFile(ActionEvent event)
           
 void doSelectAlgernonFile(ActionEvent ev)
           
 void doSelectKB(ActionEvent event)
           
 void doWriteAlgernonFile(ActionEvent ev)
           
 Java2Protege getApplication()
           
 void init()
           
 void mouseClicked(MouseEvent e)
          Invoked when the mouse button has been clicked (pressed and released) on a component.
 void mouseEntered(MouseEvent e)
          Invoked when the mouse enters a component.
 void mouseExited(MouseEvent e)
          Invoked when the mouse exits a component.
 void mousePressed(MouseEvent e)
          Invoked when a mouse button has been pressed on a component.
 void mouseReleased(MouseEvent e)
          Invoked when a mouse button has been released on a component.
 void run()
           
 void showPackageError(String packageName)
          shows an error when the package can't be found.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, 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, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, 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, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, 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, isOpaque, 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, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

STANDARD_HEADER

private JLabel STANDARD_HEADER

STANDARD_FOOTER

private JLabel STANDARD_FOOTER

STANDARD_HORIZONTAL_GAP

private static final int STANDARD_HORIZONTAL_GAP
See Also:
Constant Field Values

STANDARD_VERTICAL_GAP

private static final int STANDARD_VERTICAL_GAP
See Also:
Constant Field Values

DEFAULT_WIDTH

private static final int DEFAULT_WIDTH
See Also:
Constant Field Values

DEFAULT_HEIGHT

private static final int DEFAULT_HEIGHT
See Also:
Constant Field Values

DEFAULT_TEXT_FIELD_WIDTH

private static final int DEFAULT_TEXT_FIELD_WIDTH
See Also:
Constant Field Values

f_app

private Java2Protege f_app

f_tabPane

private JTabbedPane f_tabPane

f_runConversionButton

private JButton f_runConversionButton

f_convertPanel

private Box f_convertPanel

f_helpPanel

private Box f_helpPanel

f_reviewPanel

private JPanel f_reviewPanel

f_savePanel

private Box f_savePanel

LABEL_COLOR

private Color LABEL_COLOR

STANDARD_FOOTER_FONT_SIZE

private float STANDARD_FOOTER_FONT_SIZE

STANDARD_HEADER_FONT_SIZE

private float STANDARD_HEADER_FONT_SIZE

f_packageField

private JTextField f_packageField

f_kbField

private JTextField f_kbField

f_AdviceFileField

private JTextField f_AdviceFileField

f_saveInAlgernonField

private JTextField f_saveInAlgernonField

f_selectKBFileButton

private JButton f_selectKBFileButton

f_selectAdviceFileButton

private JButton f_selectAdviceFileButton

f_savedAdviceDirectory

private String f_savedAdviceDirectory

f_savedKBDirectory

private String f_savedKBDirectory

f_savedAlgernonDirectory

private String f_savedAlgernonDirectory

f_saveAdviceButton

private JButton f_saveAdviceButton

f_addAdviceButton

private JButton f_addAdviceButton

f_deleteAdviceButton

private JButton f_deleteAdviceButton

f_classTree

private JTree f_classTree

f_slotTable

private SlotTable f_slotTable

f_adviceTable

private AdviceTable f_adviceTable

ROOT_NODE_LABEL

private static final String ROOT_NODE_LABEL
See Also:
Constant Field Values

f_classPanel

private JPanel f_classPanel

f_slotPanel

private JPanel f_slotPanel

f_advicePanel

private JPanel f_advicePanel

CONVERT_TAB_INDEX

private static int CONVERT_TAB_INDEX

REVIEW_TAB_INDEX

private static int REVIEW_TAB_INDEX

SAVE_TAB_INDEX

private static int SAVE_TAB_INDEX

HELP_TAB_INDEX

private static int HELP_TAB_INDEX

f_adviceHasChanged

private boolean f_adviceHasChanged

f_lastPackageName

private String f_lastPackageName

f_rootField

private JTextField f_rootField

f_adviceJTable

private JTable f_adviceJTable

f_tableSorter

private TableSorter f_tableSorter
Constructor Detail

J2PWindow

public J2PWindow(Java2Protege app)
Pass in the Java2Protege instance.

Method Detail

getApplication

public Java2Protege getApplication()

init

public void init()

run

public void run()
Specified by:
run in interface Runnable

createSetupTab

public void createSetupTab()
Creates the setup tab


createHelpTab

public void createHelpTab()
Creates the Help Tab


createReviewTab

public void createReviewTab()
Creates the Review Tab


createSaveTab

public void createSaveTab()
Creates the Save tab


doSelectAdviceFile

public void doSelectAdviceFile(ActionEvent event)

doSelectKB

public void doSelectKB(ActionEvent event)

doConversion

public void doConversion(ActionEvent event)
Runs the conversion


doCreateClassView

private void doCreateClassView()
Creates the tree view of the classes


doCreateAdviceView

private void doCreateAdviceView()
Creates the tabular view of the classes.


doCreateSlotView

private void doCreateSlotView()
Creates the tabular view of the classes.


showPackageError

public void showPackageError(String packageName)
shows an error when the package can't be found.


doSelectAlgernonFile

public void doSelectAlgernonFile(ActionEvent ev)

doWriteAlgernonFile

public void doWriteAlgernonFile(ActionEvent ev)

doSaveAdviceFile

public void doSaveAdviceFile(ActionEvent ev)
Saves the advice file.

Parameters:
ev -

doAddAdvice

public void doAddAdvice(ActionEvent ev)
Adds new advice.

Parameters:
ev -

doDeleteAdvice

public void doDeleteAdvice(ActionEvent ev)
Deletes a line of advice.

Parameters:
ev -

mouseClicked

public void mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component.

Specified by:
mouseClicked in interface MouseListener

mousePressed

public void mousePressed(MouseEvent e)
Invoked when a mouse button has been pressed on a component.

Specified by:
mousePressed in interface MouseListener

mouseReleased

public void mouseReleased(MouseEvent e)
Invoked when a mouse button has been released on a component.

Specified by:
mouseReleased in interface MouseListener

mouseEntered

public void mouseEntered(MouseEvent e)
Invoked when the mouse enters a component.

Specified by:
mouseEntered in interface MouseListener

mouseExited

public void mouseExited(MouseEvent e)
Invoked when the mouse exits a component.

Specified by:
mouseExited in interface MouseListener

Algernon Software