gui
Class PrgGramInputFrame

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--javax.swing.JFrame
                                |
                                +--gui.PrgGramInputFrame
All Implemented Interfaces:
javax.accessibility.Accessible, Errorable, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable, javax.swing.WindowConstants

public class PrgGramInputFrame
extends javax.swing.JFrame
implements Errorable

Okno pro zadavani programovane gramatiky. Umoznuje pridavat, menit a mazat pravidla a urcit pocatecni neterminal. Gramatiku je mozne ulozit do souboru i ze souboru nacist.

See Also:
Serialized Form

Inner Class Summary
protected  class PrgGramInputFrame.ProdFieldKeyListener
          Vnitrni trida slouzici jako posluchac udalosti z klavesnice.
 
Inner classes inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Inner classes inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Inner classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock
 
Field Summary
private static int ABOUT_ITEM
          Poradi polozky napoveda o programu
private static int ADD_ITEM
          Poradi polozky pridat pravidlo
private  javax.swing.JButton addButton
          Tlacitko pro pridani pravidla
private  javax.swing.JLabel arrowLabel
          Sipka oddelujici levou a pravou stranu pravidla
private  javax.swing.JPanel buttonPanel
          Panel pro tlacitka
private static int BUTTONS_HEIGHT
          Vyska tlacitek
private static int BUTTONS_WIDTH
          Sirka tlacitek
private static int BUTTONS_X
          X souradnice tlacitek
private  java.awt.GridLayout buttonsLayout
          Layout pro serazeni tlacitek do sloupce
private  javax.swing.JPanel contentPanel
          Hlavni panel okna
private static int DEL_ITEM
          Poradi polozky smazat pravidlo
private  javax.swing.JButton deleteButton
          Tlacitko pro smazani pravidla
protected  DerivationFrame derivationFrame
          Okno derivace, ze ktereho bylo toto otevreno
protected  ErrorFrame errorFrame
          Okno zobrazujici chybova hlaseni
private static int FAIL_WIDTH
          Sirka textoveho pole pro pole neuspechu pravidla
private static int FAIL_X
          X souradnice textoveho pole pro pole neuspechu pravidla
private  javax.swing.JTextField failField
          Textove pole pro oznaceni pravidel pole neuspechu
private  javax.swing.JLabel failLabel
          Nadpis k poli s polem uspechu
private static int FIELD_HEIGHT
          Vyska textovych poli pravidla
private static int FIELD_Y
          Y souradnice textovych poli pravidla
private static int FILE_MENU
          Poradi menu gramatika
private static int GRAM_ITEM
          Poradi polozky napoveda o editaci gramatiky
protected  ProgrammedGrammar grammar
          Editovana gramatika
private static int HELP_MENU
          Poradi menu napoveda
protected  HelpFrame hf
          Okno napovedy
private static int CHANGE_ITEM
          Poradi polozky zmenit pravidlo
private static int LABEL_WIDTH
          Sirka textoveho pole oznaceni pravidla
private static int LABEL_X
          X souradnice textoveho pole oznaceni pravidla
private  javax.swing.JTextField labelField
          Textove pole pro oznaceni pravidla
private  javax.swing.JLabel labelLabel
          Nadpis k poli pro oznaceni pravidla
private static int LABS_HEIGHT
          Vyska nadpisu textovych poli pravidla
private static int LABS_Y
          Y souradnice nadpisu textovych poli pravidla
private static int LEFT_WIDTH
          Sirka textoveho pole leve strany pravidla
private static int LEFT_X
          X souradnice textoveho pole leve strany pravidla
private  javax.swing.JTextField leftField
          Textove pole pro levou stranu pravidla
private static int LIST_HEIGHT
          Vyska seznamu pravidel
private static int LIST_WIDTH
          Sirka seznamu pravidel
private static int LIST_Y
          Sirka seznamu pravidel
private  javax.swing.JScrollPane listScroll
          Posuvne listy pro seznam pravidel
private static java.lang.String[][] menuItemStrings
          Nadpisy polozek jednotlivych polozek v menu
private static java.lang.String[] menus
          Nadpisu menu
private static int NONTERM_Y
          Y souradnice textoveho pole pro neterminaly
private  javax.swing.JTextField nontermField
          Textove pole pro zobrazeni neterminalu
private  javax.swing.JLabel nontermLabel
          Nadpis k poli s neterminaly
private  javax.swing.JScrollPane nontermScroll
          Posuvne listy pro textove pole neterminalu
private static int OK_ITEM
          Poradi polozky ukonceni editace s ulozenim zmen
private  javax.swing.JButton okButton
          Tlacitko pro ulozeni gramatiky a zavreni okna
private static int OPEN_ITEM
          Poradi polozky nacist ze souboru
private static int PROD_MENU
          Poradi menu pravidlo
private  PrgGramInputFrame.ProdFieldKeyListener prodKeyListener
          Posluchac udalosti z klavesnice
private  javax.swing.JLabel prodLabel
          Nadpis k polim pravidla
private  javax.swing.JList prodList
          Seznam pravidel
private static int RIGHT_WIDTH
          Sirka textoveho pole prave strany pravidla
private static int RIGHT_X
          X souradnice textoveho pole prave strany pravidla
private  javax.swing.JTextField rightField
          Textove pole pro pravou stranu pravidla
private static int SAVE_ITEM
          Poradi polozky ulozeni do souboru
private  javax.swing.JTextField startField
          Textove pole pro pocatecni neterminal
private  javax.swing.JLabel startLabel
          Nadpis k poli se startovacim neterminalem
private static int STORNO_ITEM
          Poradi polozky zavreni okna bez ulozeni zmen
private  javax.swing.JButton stornoButton
          Tlacitko pro zavreni okna bez ulozeni zmen
private static int SUCC_WIDTH
          Sirka textoveho pole pro pole uspechu pravidla
private static int SUCC_X
          X souradnice textoveho pole pro pole uspechu pravidla
private  javax.swing.JTextField succField
          Textove pole pro oznaceni pravidel pole uspechu
private  javax.swing.JLabel succLabel
          Nadpis k poli s polem neuspechu
private static int TERM_LAB_WIDTH
          Sirka nadpisu k textovym polim s neterminaly a terminaly
private static int TERM_X
          X souradnice textoveho pole pro terminaly
private static int TERM_Y
          Y souradnice textoveho pole pro terminaly
private  javax.swing.JTextField termField
          Textove pole pro zobrazeni terminalu
private  javax.swing.JLabel termLabel
          Nadpis k poli s terminaly
private  javax.swing.JScrollPane termScroll
          Posuvne listy pro textove pole terminalu
private static int TEXTAREA_HIGHT
          Vyska textoveho pole pro terminaly
private  javax.swing.JButton updateButton
          Tlacitko pro zmenu pravidla
static int WINDOW_HEIGHT
          Vyska okna
static int WINDOW_WIDTH
          Sirka okna
 
Fields inherited from class javax.swing.JFrame
accessibleContext, defaultCloseOperation, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
base, CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, frameSerializedDataVersion, HAND_CURSOR, icon, ICONIFIED, mbManagement, menuBar, MOVE_CURSOR, N_RESIZE_CURSOR, nameCounter, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, ownedWindows, resizable, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, serialVersionUID, state, SW_RESIZE_CURSOR, TEXT_CURSOR, title, W_RESIZE_CURSOR, WAIT_CURSOR, weakThis
 
Fields inherited from class java.awt.Window
active, dbg, focusMgr, inputContext, inputContextLock, OPENED, ownedWindowList, showWithParent, warningString, windowListener, windowSerializedDataVersion
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, changeSupport, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
 
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
PrgGramInputFrame()
          Pomocny konstruktor.
PrgGramInputFrame(DerivationFrame df, Grammar pg)
          Vytvori okno pro editaci urcene gramatiky.
 
Method Summary
protected  void addButtonAction()
          Slouzi pro pridani pravidla do gramatiky.
protected  void deleteButtonAction()
          Slouzi pro odstraneni pravidla vybraneho v seznamu.
private  void error(int e)
          Slouzi k zobrazeni chybove hlasky s urcenym cislem.
private  void error(java.text.ParseException e)
          Zobrazi okno s chybovou hlaskou o spatnem formatu souboru.
private  void makeFrame()
          Vytvori okno vcetne vsech jeho prvku.
protected  void makeMenu()
          Vytvori kompletni menu vcetne polozek.
protected  void okButtonAction()
          Akce pri potvrzeni gramatiky.
 void readFile()
          Necha uzivatele vybrat soubor.
protected  PrgProduction readProduction()
          Prekontroluje textova pole, do kterych se vyplnuje pravidlo.
protected  java.lang.String readStart()
          Precte nazev neterminalu z textoveho pole.
 void refreshGrammar(Grammar g)
          Zmeni gramatiku.
private  void removeFields()
          Vymaze hodnoty z textovych poli pro editaci pravidla.
protected  void stornoButtonAction()
          Zavre okno editace bez ulozeni zmen v gramatice.
 void takeControl(int message)
          Slouzi ke zjisteni, ze bylo uzavreno okno s chybovym hlasenim.
protected  boolean testGrammar()
          Zjisti, jestli gramatika splnuje zakladni pozadavky na ukonceni editace.
protected  void updateButtonAction()
          Umozni editaci pravidla.
protected  void updateList()
          Vytvori seznam pravidel podle aktualni gramatiky.
protected  void updateSymbols()
          Zmeni obsah textovych poli s terminaly a neterminaly podle aktualni gramatiky.
private  void writeFile()
          Zapise prave editovanou gramatiku do souboru.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, createRootPaneException, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
, addNotify, addToFrameList, constructComponentName, finalize, getCursorType, getFrames, getIconImage, getMenuBar, getState, getTitle, initIDs, isResizable, postProcessKeyEvent, readObject, remove, removeFromFrameList, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle, writeObject
 
Methods inherited from class java.awt.Window
addOwnedWindow, addWindowListener, adjustListeningChildren, applyResourceBundle, applyResourceBundle, connectOwnedWindow, dispatchEventImpl, dispose, eventEnabled, getFocusOwner, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, hide, isActive, isShowing, nextFocus, ownedInit, pack, postEvent, postWindowEvent, preProcessKeyEvent, processEvent, removeOwnedWindow, removeWindowListener, resetGC, setCursor, setFocusOwner, setWarningString, show, toBack, toFront, transferFocus
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyOrientation, countComponents, createHierarchyEvents, createChildHierarchyEvents, deliverEvent, dispatchEventToSelf, doLayout, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, checkGD, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, numListening, paint, paintComponents, paintHeavyweightComponents, postsOldMouseEvents, preferredSize, print, printComponents, printHeavyweightComponents, processContainerEvent, proxyEnableEvents, proxyRequestFocus, remove, removeAll, removeContainerListener, setFont, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, checkImage, checkImage, checkWindowClosingException, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, 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, processMouseEvent, processMouseMotionEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

errorFrame

protected ErrorFrame errorFrame
Okno zobrazujici chybova hlaseni

derivationFrame

protected DerivationFrame derivationFrame
Okno derivace, ze ktereho bylo toto otevreno

hf

protected HelpFrame hf
Okno napovedy

grammar

protected ProgrammedGrammar grammar
Editovana gramatika

contentPanel

private javax.swing.JPanel contentPanel
Hlavni panel okna

buttonPanel

private javax.swing.JPanel buttonPanel
Panel pro tlacitka

labelLabel

private javax.swing.JLabel labelLabel
Nadpis k poli pro oznaceni pravidla

startLabel

private javax.swing.JLabel startLabel
Nadpis k poli se startovacim neterminalem

prodLabel

private javax.swing.JLabel prodLabel
Nadpis k polim pravidla

termLabel

private javax.swing.JLabel termLabel
Nadpis k poli s terminaly

nontermLabel

private javax.swing.JLabel nontermLabel
Nadpis k poli s neterminaly

failLabel

private javax.swing.JLabel failLabel
Nadpis k poli s polem uspechu

succLabel

private javax.swing.JLabel succLabel
Nadpis k poli s polem neuspechu

arrowLabel

private javax.swing.JLabel arrowLabel
Sipka oddelujici levou a pravou stranu pravidla

okButton

private javax.swing.JButton okButton
Tlacitko pro ulozeni gramatiky a zavreni okna

stornoButton

private javax.swing.JButton stornoButton
Tlacitko pro zavreni okna bez ulozeni zmen

updateButton

private javax.swing.JButton updateButton
Tlacitko pro zmenu pravidla

addButton

private javax.swing.JButton addButton
Tlacitko pro pridani pravidla

deleteButton

private javax.swing.JButton deleteButton
Tlacitko pro smazani pravidla

labelField

private javax.swing.JTextField labelField
Textove pole pro oznaceni pravidla

leftField

private javax.swing.JTextField leftField
Textove pole pro levou stranu pravidla

rightField

private javax.swing.JTextField rightField
Textove pole pro pravou stranu pravidla

succField

private javax.swing.JTextField succField
Textove pole pro oznaceni pravidel pole uspechu

failField

private javax.swing.JTextField failField
Textove pole pro oznaceni pravidel pole neuspechu

startField

private javax.swing.JTextField startField
Textove pole pro pocatecni neterminal

termScroll

private javax.swing.JScrollPane termScroll
Posuvne listy pro textove pole terminalu

nontermScroll

private javax.swing.JScrollPane nontermScroll
Posuvne listy pro textove pole neterminalu

listScroll

private javax.swing.JScrollPane listScroll
Posuvne listy pro seznam pravidel

termField

private javax.swing.JTextField termField
Textove pole pro zobrazeni terminalu

nontermField

private javax.swing.JTextField nontermField
Textove pole pro zobrazeni neterminalu

buttonsLayout

private java.awt.GridLayout buttonsLayout
Layout pro serazeni tlacitek do sloupce

prodKeyListener

private PrgGramInputFrame.ProdFieldKeyListener prodKeyListener
Posluchac udalosti z klavesnice

prodList

private javax.swing.JList prodList
Seznam pravidel

WINDOW_HEIGHT

public static final int WINDOW_HEIGHT
Vyska okna

WINDOW_WIDTH

public static final int WINDOW_WIDTH
Sirka okna

FIELD_Y

private static final int FIELD_Y
Y souradnice textovych poli pravidla

FIELD_HEIGHT

private static final int FIELD_HEIGHT
Vyska textovych poli pravidla

LABS_Y

private static final int LABS_Y
Y souradnice nadpisu textovych poli pravidla

LABS_HEIGHT

private static final int LABS_HEIGHT
Vyska nadpisu textovych poli pravidla

LIST_HEIGHT

private static final int LIST_HEIGHT
Vyska seznamu pravidel

LIST_WIDTH

private static final int LIST_WIDTH
Sirka seznamu pravidel

BUTTONS_HEIGHT

private static final int BUTTONS_HEIGHT
Vyska tlacitek

BUTTONS_X

private static final int BUTTONS_X
X souradnice tlacitek

BUTTONS_WIDTH

private static final int BUTTONS_WIDTH
Sirka tlacitek

LABEL_X

private static final int LABEL_X
X souradnice textoveho pole oznaceni pravidla

LABEL_WIDTH

private static final int LABEL_WIDTH
Sirka textoveho pole oznaceni pravidla

LEFT_X

private static final int LEFT_X
X souradnice textoveho pole leve strany pravidla

LEFT_WIDTH

private static final int LEFT_WIDTH
Sirka textoveho pole leve strany pravidla

RIGHT_X

private static final int RIGHT_X
X souradnice textoveho pole prave strany pravidla

RIGHT_WIDTH

private static final int RIGHT_WIDTH
Sirka textoveho pole prave strany pravidla

SUCC_X

private static final int SUCC_X
X souradnice textoveho pole pro pole uspechu pravidla

SUCC_WIDTH

private static final int SUCC_WIDTH
Sirka textoveho pole pro pole uspechu pravidla

FAIL_X

private static final int FAIL_X
X souradnice textoveho pole pro pole neuspechu pravidla

FAIL_WIDTH

private static final int FAIL_WIDTH
Sirka textoveho pole pro pole neuspechu pravidla

TERM_Y

private static final int TERM_Y
Y souradnice textoveho pole pro terminaly

TERM_X

private static final int TERM_X
X souradnice textoveho pole pro terminaly

TEXTAREA_HIGHT

private static final int TEXTAREA_HIGHT
Vyska textoveho pole pro terminaly

NONTERM_Y

private static final int NONTERM_Y
Y souradnice textoveho pole pro neterminaly

LIST_Y

private static final int LIST_Y
Sirka seznamu pravidel

TERM_LAB_WIDTH

private static final int TERM_LAB_WIDTH
Sirka nadpisu k textovym polim s neterminaly a terminaly

menus

private static final java.lang.String[] menus
Nadpisu menu

menuItemStrings

private static final java.lang.String[][] menuItemStrings
Nadpisy polozek jednotlivych polozek v menu

FILE_MENU

private static final int FILE_MENU
Poradi menu gramatika

PROD_MENU

private static final int PROD_MENU
Poradi menu pravidlo

HELP_MENU

private static final int HELP_MENU
Poradi menu napoveda

OPEN_ITEM

private static final int OPEN_ITEM
Poradi polozky nacist ze souboru

SAVE_ITEM

private static final int SAVE_ITEM
Poradi polozky ulozeni do souboru

STORNO_ITEM

private static final int STORNO_ITEM
Poradi polozky zavreni okna bez ulozeni zmen

OK_ITEM

private static final int OK_ITEM
Poradi polozky ukonceni editace s ulozenim zmen

ADD_ITEM

private static final int ADD_ITEM
Poradi polozky pridat pravidlo

CHANGE_ITEM

private static final int CHANGE_ITEM
Poradi polozky zmenit pravidlo

DEL_ITEM

private static final int DEL_ITEM
Poradi polozky smazat pravidlo

GRAM_ITEM

private static final int GRAM_ITEM
Poradi polozky napoveda o editaci gramatiky

ABOUT_ITEM

private static final int ABOUT_ITEM
Poradi polozky napoveda o programu
Constructor Detail

PrgGramInputFrame

public PrgGramInputFrame()
Pomocny konstruktor. Vytvori si novou gramatiku a nove okno derivace.

PrgGramInputFrame

public PrgGramInputFrame(DerivationFrame df,
                         Grammar pg)
Vytvori okno pro editaci urcene gramatiky. Jeji hodnoty predvyplni do prvku okna.
Parameters:
df - Okno derivace, ze ktereho byla editace gramatiky volana
pg - Editovana programovana gramatika
Method Detail

makeFrame

private void makeFrame()
Vytvori okno vcetne vsech jeho prvku. Priradi prvkum posluchace udalosti.

makeMenu

protected void makeMenu()
Vytvori kompletni menu vcetne polozek. Jednotlivym polozkam priradi posluchac udalosti.

readFile

public void readFile()
Necha uzivatele vybrat soubor. Potom z nej nacte programovanou gramatiku a jeji pravidla vyplni do seznamu pravidel. Prepise prave editovanou gramatiku nove nactenou.

writeFile

private void writeFile()
Zapise prave editovanou gramatiku do souboru. Soubor necha vybrat uzivateli dialogem. Pred ulozenim musi byt vyplnen pocatecni neterminal a vsechna pravidla uvedena v polich uspechu a neuspechu musi byt definovana.

refreshGrammar

public void refreshGrammar(Grammar g)
Zmeni gramatiku. Podle nove gramatiky nastavi seznam pravidel a pocatecni neterminal v prvcich okna
Parameters:
g - Nova gramatika

takeControl

public void takeControl(int message)
Slouzi ke zjisteni, ze bylo uzavreno okno s chybovym hlasenim. Podle chyby zobrazene v chybovem okne pozna, kam ma nastavit kurzor.
Specified by:
takeControl in interface Errorable
Parameters:
message - Cislo chybove hlasky, ktera byla zobrazena.

error

private void error(java.text.ParseException e)
Zobrazi okno s chybovou hlaskou o spatnem formatu souboru.
Parameters:
e - Vyjimka generovana pri spatnem formatu souboru. Obsahuje text chyby a radek, na kterem chyba nastala.

error

private void error(int e)
Slouzi k zobrazeni chybove hlasky s urcenym cislem.
Parameters:
e - Cislo chybove hlasky, ktera se ma zobrazit

readProduction

protected PrgProduction readProduction()
Prekontroluje textova pole, do kterych se vyplnuje pravidlo. Pokud je vse v poradku, vytvori podle vyplnenych hodnot nove pravidlo.
Returns:
Pravidlo odpovidajici vyplnenym hodnotam. Pri chybe vraci null.

updateList

protected void updateList()
Vytvori seznam pravidel podle aktualni gramatiky.

removeFields

private void removeFields()
Vymaze hodnoty z textovych poli pro editaci pravidla.

readStart

protected java.lang.String readStart()
Precte nazev neterminalu z textoveho pole. Zkontroluje, jestli je jen jeden a jde o neterminal
Returns:
Nactene jmeno pocatecniho neterminalu. Pri chybe nebo neni-li vyplnen vraci null.

updateSymbols

protected void updateSymbols()
Zmeni obsah textovych poli s terminaly a neterminaly podle aktualni gramatiky.

testGrammar

protected boolean testGrammar()
Zjisti, jestli gramatika splnuje zakladni pozadavky na ukonceni editace. Musi byt vyplnen pocatecni neterminal a vsechna pravidla uvedena v polich uspechu a neuspechu musi existovat.
Returns:
Pokud jsou podminky splneny, vraci true.

okButtonAction

protected void okButtonAction()
Akce pri potvrzeni gramatiky. Otestuje gramatiku, nastavi ji pro derivaci a zavre okno editace

stornoButtonAction

protected void stornoButtonAction()
Zavre okno editace bez ulozeni zmen v gramatice.

addButtonAction

protected void addButtonAction()
Slouzi pro pridani pravidla do gramatiky. Nacte ho z textovych poli pomoci funkce readProduction(). Pokud jde o prvni pravidlo, vyplni jeho levou stranu jako pocatecni neterminal.

deleteButtonAction

protected void deleteButtonAction()
Slouzi pro odstraneni pravidla vybraneho v seznamu. Pokud neni vybrano zadne, neprovede metoda nic.

updateButtonAction

protected void updateButtonAction()
Umozni editaci pravidla. Pravidlo vybrane v seznamu vymaze z gramatiku, ale jeho hodnoty vyplni do textovych poli. Pokud neni vybrano zadne pravidlo, neprovede metoda nic.