org.thdl.tib.bibl
Class TibFrame

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--javax.swing.JFrame
                                |
                                +--org.thdl.tib.bibl.TibFrame
All Implemented Interfaces:
Accessible, CaretListener, EventListener, ImageObserver, MenuContainer, RootPaneContainer, Serializable, TibConstants, WindowConstants

public class TibFrame
extends JFrame
implements CaretListener, TibConstants

TibFrame is the view for the TiblEdit program. TiblEdit is the controller. TibDoc, or TiblEdit#tibbibl in its instantiation, is the data model. TibFrame mainly utilizes a TextPane (an extension of JTextPane) as its main view window, but also allows split screens with a DiacriticPanel on the left and/or a TibTable at the bottom.

Author:
Than Garson, Tibetan and Himalayan Digital Library
See Also:
Serialized Form

Nested Class Summary
 class TibFrame.XComponentHandler
           
 class TibFrame.XWindowHandler
           When the TibFrame is closed, the program ends.
 
Field Summary
protected  JMenuItem copyItem
           
protected  JMenuItem cutItem
           
protected  JMenuItem editNormItem
           
protected  JMenuItem editTransItem
           
protected  JMenuItem pasteItem
           
protected  JMenuItem removeAppItem
           
protected  JMenuItem removeEditionItem
           
protected  JMenuItem removeTitleItem
           
 
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 org.thdl.tib.bibl.TibConstants
ABBR, ABOUT, ADD_DOX, ALT, ANUYOGA, AP, AP_CHECK, APP_SUBMIT, ATIYOGA, BACK, BAD_PARA, BASE_FONT_NAME, BASE_FONT_SIZE, BG, BIN, BIN_LOGIN, BODY, BOLD, BOLD_FONT, BRIEF, BUT_MARGINS, BUTT_PANEL_SIZE, BUTTON_SIZE, CANC, CANCEL, CANCEL_NEW_APP, CATEG, CHANGE, CHAP_TITLES_HEAD, CHAPS, CHAPTER, CIT, CLASS, CLOSE_TITLE_HEAD, CLOSEFILE, CLOSING, CONTROL, CONTROL_SOURCE, CONTROLLER, CORRESP, CORRESP_NG, CREATE_FILE_LIST, CREATE_FILE_LIST_SPECS, CREATE_FILE_LIST_TITLE, CREATOR, CRIT_ED_DESC, CRIT_ED_LABEL, CRIT_TITLE, CROSSREF, CURR_DIR, DATA_DIRECTORY, DATE, DATE_DELIM, DATE_MESSAGE, DATE_TITLE, DEFAULT_BGCOLOR, DEFAULT_BUTTON_COLOR, DEFAULT_DIRECTORY, DEFAULT_FONT, DEFAULT_HEADER, DEFAULT_INSETS, DEFAULT_PANEL_SIZE, DEL_EDS_MESS, DEL_EDS_TITLE, DESIG, DG, DIA_DATA, DIAC, DISC, DISC_DIA_TITLE, DIV, DO_ALL_TITLES, DO_TRANS, DOX, DOX_CAT_DELIM, DOX_DELIM, DOX_WINDOW_TITLE, DOXTYPE, ED, ED_EXISTS, ED_EXISTS_MESSAGE, ED_EXISTS_SPECS, ED_EXISTS_TITLE, ED_ID_MESS, ED_ID_REQUIRED, ED_ID_TITLE, ED_INFO, ED_NAME, ED_SCROLL_SIZE, ED_SIG, ED_SIGLA, ED_STRING, ED_TEXT_NUM, ED_TITLE, ED_TITLE_REM, ED_VOL_LET, ED_VOL_NUM, EDCON, EDCONS, EDIT, EDITOR_NAME_MESSAGE, EDITOR_NAME_TITLE, EDITORS_INFO, EDITORS_INFO_SPECS, EDITORS_INITIALS, EDITORS_NAME, EDNAMES, EDS_CORR, ENG, ENTER, ENTER_NORM_TRANS_PHRASE, ENTER_NORMALIZED, ENTER_NORMALIZED_PHRASE, ENTER_PLACE, ENTER_TITLE_PHRASE, ENTER_TRANS, ENTER_TRANS_PHRASE, EOC, EOC_TITLES_HEAD, EX1, EX2, EXIT, EXPAN, EXPORT, FILE, FILE_EXISTS, FILE_EXISTS_SPECS, FILE_EXISTS_TITLE, FOREIGN, FRAME, FRONT, FULL, FULL_TEXT_PAGE, GEN, GET_DESIG, GET_DESIG_QUESTION, GET_DESIG_SPECS, HEAD, HEAD_FONT, HEAD_FONT_SIZE, HI, ID, INFO, INPUT_DATE_MESSAGE, INPUT_DATE_TITLE, INSERT, INSERT_APP, INTDECL, INV_TRANS, INV_TRANS_TITLE, INVALID_TRANS_SPECS, IS_FILE_LIST, ITALIC, ITEM, JOP_ERROR, JOP_INFO, JOP_QUEST, JOP_WARN, JOP_YESNOCANCEL, KG, LABEL_SIZE, LABEL_SPACE, LANG, LANG_ENG, LANG_TIB, LET, LIST, LIST_COLOR, LIST_INSETS, LM, LVL, MAHAYOGA, MAIN_MARGINS, MASTER_ID_VIEW, MASTER_SIGLA, MENU_FONT, MISC, N, NAME, NEW_AP, NEW_ED_INFO, NEW_ED_INFO_SPECS, NEW_ED_TITLE_INFO, NEW_ED_TITLE_INFO_SPECS, NEW_TITLE, NG, NGDIVS, NGSIGS, NO, NO_ELEM, NO_SELECT_TITLE, NO_SELECTION, NO_SELECTION_SPECS, NO_TITLE, NO_TITLE_MESSAGE, NO_TITLE_SPECS, NO_TITLE_TITLE, NON_TIB_HEAD, NON_TIB_TITLE_HEAD, NONTIB, NONTIBET, NORM, NORM_AP_ERROR, NORM_AP_MESS, NORM_AP_TITLE, NORM_EDIT, NORM_ENG_LABEL, NORM_TIB_LABEL, NORM_TITLE, NORM_TITLE_HEAD, NOT_SAVED_MESSAGE, NOT_SAVED_TITLE, NOT_SPEC, NOT_SPEC_MESSAGE, NOT_SPEC_SPECS, NOT_SPEC_TITLE, NOTE, NOTFOUND, NUM, NUMB, OPEN_ERROR, OPEN_TITLE, OPENFILE, ORIG_LANG, OTHER, OTHER_EDS, OUT_DIRECTORY, P, PAGE_RANGE, PAGIN, PERSNAME, PHYSDEC, PREFS, PREFS_DELIM, PROG_NAME, QUOTE, RDG, RECENT, RECENT_FILE_SIZE, REDISPLAY, RELAT, REMOVE_APP, REMOVE_APP_MESS, REMOVE_APP_SPECS, REMOVE_APP_TITLE, REMOVE_ED_ERROR_MESS, REMOVE_ED_ERROR_TITLE, REMOVE_ED_TITLE_ERROR, REMOVE_ED_TITLE_MESS, REMOVE_ED_TITLE_SPECS, REMOVE_ED_TITLE_TITLE, REMOVE_EDITION, REMOVE_TITLE, RENAME_FILE, RENAME_FILE_TITLE, RENAMING_FILE_SPECS, REND, RESP, RESPDECL, RESPSTM, REVDESC, RS, RUNTIME_ERROR, SAVE, SAVE_SPECS, SAVEAS, SAVED_FILE, SAVED_FILE_SPECS, SAVED_FILE_TITLE, SECTIONS, SELDIV, SEPARATOR, SHORT_LABEL_SIZE, SHOW_AP, SID, SIG, SIGLA_DELIM, SPACE, SRC, SRCS_LABEL, SUBMIT, SUBTYPE, SUMMARY, SYS, SYS_LET, SYS_NUM, SYS_SIG, TABLE, TB, TDECL, TDIV, TEMP_DIR, TEXT, TEXT_COLOR, TEXT_FIELD_SIZE, TEXT_HEAD, TEXT_HEAD_SIZE, TEXT_LIST_HEAD, TEXT_NUM, TIB, TIBANAL, TIBBIBL, TIBL, TIBPANEL_SIZE, TID, TIDDECL, TINFO, TITEM, TITLE, TITLE_DISC, TITLE_FONT, TITLE_LINE_HEAD, TITLE_PAGE, TITLEGRP, TITLELINE, TITLELN, TITLEOPENFILE, TITLES_VIEW, TK, TLIST, TLIST_ADD_ERROR, TLIST_ADD_MESS, TLIST_ADD_TITLE, TLIST_WARN, TLIST_WARN_TITLE, TLIST_WARNING, TRANS, TRANS_EDIT, TRANS_JOB, TTFCOLS, TTITLE_TITLE, TXT, TXTHEAD, TYPE, TYPE_CLASS, TYPE_DOX, TYPE_ED, TYPE_TEXT, TYPE_VOL, UNCLASSED, UNTITLED, USER_ID_VIEW, VIEW, VOL, VOL_LET, VOL_NUM, VOL_TEXT, VOL_TEXT_NUM, WIT, YES
 
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
TibFrame(String title)
           This constructor simply takes a title as the corresponding JFrame contructor.
TibFrame(String title, org.thdl.tib.bibl.TiblEdit app)
           This constructor takes both a title and a TiblEdit object that is its controller.
 
Method Summary
 void caretUpdate(CaretEvent ce)
           This implementation of the CaretListener interface calls the controller's checkCaretPosition method with the type of AP to see if an appartatus element is insertable.
 void chooseEdition()
           
 void displayNewApp()
           This method is called if the insert variant option is chosen from the insert menu.
 void fileClosed()
           This method is called by the controller when a file is closed.
 void fileOpened()
           This method is called by the controller when a file is opened.
 int getCaretPosition()
           This returns the position of the caret within the TextPane that is the main text view for the program.
 org.thdl.tib.bibl.TiblEdit getController()
           This method returns the controller for this view.
 org.thdl.tib.bibl.DiscDialog getDiscussionDialog(org.thdl.tib.bibl.TibDoc tibl)
           
 org.thdl.tib.bibl.TextPane getTextPane()
           This returns the TextPane that is the main view for tibbibl text information.
 void hideDiacritics()
           This method hides the DiacriticPanel that is displayed on the left of the split screen.
 void hideEditions()
           This method hides any table that is displaying at the bottom of the TextPane.
protected  void init()
           This is the initialization method for the TibFrame.
static void main(String[] args)
           
 void setController(org.thdl.tib.bibl.TiblEdit jt)
           This sets the #controller variable to the controller which is the instantiation of the main TiblEdit program.
 void setRecentFiles(Vector recent)
           This method sets the list of recent files in the file menu.
 void showDiacritics()
           This method creates a split screen with a DiacriticPanel on the left and the main TextPane on the right.
 void showEditions()
           This method displays a TibTable as the bottom half of a split screen with the TextPane This particular table displays the editions consulted for the formation of the master record by displaying the information in the text's tibiddecl element.
 void showTable(org.thdl.tib.bibl.TibTable tt)
           This method displays a TibTable underneath the TextPane.
 org.thdl.tib.bibl.ElementList showTitles(org.thdl.tib.bibl.TitleFactory tf)
           This method displays all the variations of text titles found in a TibDoc.
 void titleNotSelected()
           This method is called (maybe) when cursor is on something other than a title.
 void titleSelected()
           This method is called (maybe) when the cursor is on a title.
 
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

cutItem

protected JMenuItem cutItem

copyItem

protected JMenuItem copyItem

pasteItem

protected JMenuItem pasteItem

editTransItem

protected JMenuItem editTransItem

editNormItem

protected JMenuItem editNormItem

removeAppItem

protected JMenuItem removeAppItem

removeTitleItem

protected JMenuItem removeTitleItem

removeEditionItem

protected JMenuItem removeEditionItem
Constructor Detail

TibFrame

public TibFrame(String title)

This constructor simply takes a title as the corresponding JFrame contructor.


TibFrame

public TibFrame(String title,
                org.thdl.tib.bibl.TiblEdit app)

This constructor takes both a title and a TiblEdit object that is its controller. It first calls JFrame's title constructor, then the setController method and then the init() method.

Method Detail

init

protected void init()

This is the initialization method for the TibFrame. The TibFrame is the view for this program, for which a TiblEdit object is the controller and a TibDoc is the data model. This method establishes a file menu, an edit menu, an view menu, and an insert menu. Its content pane is set to a JScrollPane with a TextPane as its view.


setController

public void setController(org.thdl.tib.bibl.TiblEdit jt)

This sets the #controller variable to the controller which is the instantiation of the main TiblEdit program.


getController

public org.thdl.tib.bibl.TiblEdit getController()

This method returns the controller for this view.

Returns:
TiblEdit - the controller.

setRecentFiles

public void setRecentFiles(Vector recent)

This method sets the list of recent files in the file menu.

Parameters:
recent - - A Vector of the recent files from the controller.

getTextPane

public org.thdl.tib.bibl.TextPane getTextPane()

This returns the TextPane that is the main view for tibbibl text information. The TextPane is set in this objects init() method and is set within a JScrollPane.

Returns:
TextPane the text pane that is the main content view of the program.

getCaretPosition

public int getCaretPosition()

This returns the position of the caret within the TextPane that is the main text view for the program.

Returns:
int - the position of the caret.

fileOpened

public void fileOpened()

This method is called by the controller when a file is opened. It serves to enable or disable the appropriate menu commands. Open is disabled, and close, save, view titles, add crit title, add ed title, and view editions consulted are turned on.


fileClosed

public void fileClosed()

This method is called by the controller when a file is closed. It serves to enable or disable the appropriate menu commands. Open is enabled and close, save, insert crit title, insert ed title, view titles, and view editions consulted are all disabled. It also calls TextPane.reset(), which resets the styled document for the textpane view, calls hideEditions() to hide any table that is displaying at the bottom of the screen, and then redisplays itself with Window.show().


titleSelected

public void titleSelected()

This method is called (maybe) when the cursor is on a title. It enables the add critical title menu option. (May be deprecated?)


titleNotSelected

public void titleNotSelected()

This method is called (maybe) when cursor is on something other than a title. It disables the add critical title menu option. (May be deprecated?)


showEditions

public void showEditions()

This method displays a TibTable as the bottom half of a split screen with the TextPane This particular table displays the editions consulted for the formation of the master record by displaying the information in the text's tibiddecl element. To do so it uses TibTable constructor that takes an IDFactory retrieved from the TibDoc. It then calls TibTable method.


hideEditions

public void hideEditions()

This method hides any table that is displaying at the bottom of the TextPane. The first table that used this was the edition's consulted table, but it will close any table including an apparatus table that is displaying at the bottom of the screen.


showDiacritics

public void showDiacritics()

This method creates a split screen with a DiacriticPanel on the left and the main TextPane on the right.


hideDiacritics

public void hideDiacritics()

This method hides the DiacriticPanel that is displayed on the left of the split screen.


showTable

public void showTable(org.thdl.tib.bibl.TibTable tt)

This method displays a TibTable underneath the TextPane. It takes a TibTable as its parameter and depending on the value of its type inserts either an JTable with the editions consulted or it retrieves an specific JPanel that has a table with an apparatus' info and control buttons.


displayNewApp

public void displayNewApp()

This method is called if the insert variant option is chosen from the insert menu. Variant readings are displayed in the TextPane with a yellow background and are determined by being marked up within an app element. When inserting a new variant, the app element was not originally there so the selected area does not have a yellow background. This method sets the background of the selected area to yellow until the insertion is complete and the TextPane can be redisplayed.


showTitles

public org.thdl.tib.bibl.ElementList showTitles(org.thdl.tib.bibl.TitleFactory tf)

This method displays all the variations of text titles found in a TibDoc. It takes the TibDoc's TitleFactory and uses its getAllTitles method to retrive a vector of ElementStyles. It also adds a text header at the top and depending on the mode of the controller (i.e., whether it is inserting a new title or translation, etc.) adds appropriate prompts. It then calls the TextPane's setTextPane(Vector) method with the vector of StyleElements and this displays the information. That setTextPane method returns an ElementList which is a list of org.jdom.Elements with their associated positions in the TextPane (start and end) so that when the caret is positioned somewhere in the TextPane the controller can find the associated element and make the appropriate options available.

Returns:
ElementList - The ElementList returned by the TextPane once its document is set.

chooseEdition

public void chooseEdition()

getDiscussionDialog

public org.thdl.tib.bibl.DiscDialog getDiscussionDialog(org.thdl.tib.bibl.TibDoc tibl)

main

public static void main(String[] args)

caretUpdate

public void caretUpdate(CaretEvent ce)

This implementation of the CaretListener interface calls the controller's checkCaretPosition method with the type of AP to see if an appartatus element is insertable. If so, then it turns on the insert variant reading menu item. If not, that item is turned off.

Specified by:
caretUpdate in interface CaretListener


These API docs were created 02/02/2003 08:19 PM.
Copyright © 2001-2002 Tibetan and Himalayan Digital Library. All Rights Reserved.
Hosted by SourceForge_Logo