Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## mars.venus
Class Editor

    java.lang.Object
      mars.venus.Editor

    public class Editor

extends Object

Manage the file being edited. Currently only manages one file at a time, but can be expanded.

Field Summary
`static int` | `MAX_BLINK_RATE`
`static int` | `MAX_TAB_SIZE`
`static int` | `MIN_BLINK_RATE`
`static int` | `MIN_TAB_SIZE`

Constructor Summary
`Editor(VenusUI ui)` Create editor.

Method Summary
`boolean` | `close()` Perform "close" operation on current tab's file.
`boolean` | `closeAll()` Close all currently open files.
`boolean` | `editsSavedOrAbandoned()` Called by several of the Action objects when there is potential loss of editing changes.
`String` | `getCurrentOpenDirectory()` Get name of current directory for Open operation.
`String` | `getCurrentSaveDirectory()` Get name of current directory for Save or Save As operation.
`String` | `getNextDefaultFilename()` Generates a default file name
`void` | `newFile()` Perform "new" operation to create an empty tab.
`boolean` | `open()` Open file in a new tab.
`boolean` | `save()` Perform "save" operation on current tab's file.
`boolean` | `saveAll()` Perform save operation on all open files (tabs).
`boolean` | `saveAs()` Perform "save as" operation on current tab's file.
`void` | `setEditTabbedPane(EditTabbedPane editTabbedPane)` Set associated EditTabbedPane.
`void` | `setTitle(String path, String name, int status)` Places name of file currently being edited into its edit tab and the application's title bar.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### MIN_TAB_SIZE

    public static final int MIN_TAB_SIZE

See Also:
  Constant Field Values

### MAX_TAB_SIZE

    public static final int MAX_TAB_SIZE

See Also:
  Constant Field Values

### MIN_BLINK_RATE

    public static final int MIN_BLINK_RATE

See Also:
  Constant Field Values

### MAX_BLINK_RATE

    public static final int MAX_BLINK_RATE

See Also:
  Constant Field Values

Constructor Detail

### Editor

    public Editor(VenusUI ui)

  Create editor.

  Parameters:
    `ui` - the GUI that owns this editor

Method Detail

### setEditTabbedPane

    public void setEditTabbedPane(EditTabbedPane editTabbedPane)

  Set associated EditTabbedPane. This is container for any/all open files.

  Parameters:
    `editTabbedPane` - an existing editTabbedPane object

### getCurrentOpenDirectory

    public String getCurrentOpenDirectory()

  Get name of current directory for Open operation.

  Returns:
    String containing directory pathname. Returns null if there is no EditTabbedPane. Returns default, directory MARS is launched from, if no Opens have been performed.

### getCurrentSaveDirectory

    public String getCurrentSaveDirectory()

  Get name of current directory for Save or Save As operation.

  Returns:
    String containing directory pathname. Returns null if there is no EditTabbedPane. Returns default, directory MARS is launched from, if no Save or Save As operations have been performed.

### getNextDefaultFilename

    public String getNextDefaultFilename()

  Generates a default file name

  Returns:
    returns string mipsN.asm, where N is 1,2,3,...

### setTitle

    public void setTitle(String path,
                         String name,
                         int status)

  Places name of file currently being edited into its edit tab and the application's title bar. The edit tab will contain only the filename, the title bar will contain full pathname. If file has been modified since created, opened or saved, as indicated by value of the status parameter, the name and path will be followed with an '*'. If newly-created file has not yet been saved, the title bar will show (temporary) file name but not path.

  Parameters:
    `path` - Full pathname for file
    `name` - Name of file (last component of path)
    `status` - Edit status of file. See FileStatus static constants.

### newFile

    public void newFile()

  Perform "new" operation to create an empty tab.

### close

    public boolean close()

  Perform "close" operation on current tab's file.

  Returns:
    true if succeeded, else false.

### closeAll

    public boolean closeAll()

  Close all currently open files.

  Returns:
    true if succeeded, else false.

### save

    public boolean save()

  Perform "save" operation on current tab's file.

  Returns:
    true if succeeded, else false.

### saveAs

    public boolean saveAs()

  Perform "save as" operation on current tab's file.

  Returns:
    true if succeeded, else false.

### saveAll

    public boolean saveAll()

  Perform save operation on all open files (tabs).

  Returns:
    true if succeeded, else false.

### open

    public boolean open()

  Open file in a new tab.

  Returns:
    true if succeeded, else false.

### editsSavedOrAbandoned

    public boolean editsSavedOrAbandoned()

  Called by several of the Action objects when there is potential loss of editing changes. Specifically: if there is a current file open for editing and its modify flag is true, then give user a dialog box with choice to save, discard edits, or cancel and carry out the decision. This applies to File->New, File->Open, File->Close, and File->Exit.

  Returns:
    false means user selected Cancel so caller should do that. Return of true means caller can proceed (edits were saved or discarded).

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD