File Browsing

The setup form has two browsers - for the SPICE file and for the Libraries. JFC's 1.1 File Chooser implements the File Browser.

Showing Libraries and Models

The Libraries and Models of a particular (Typ, Worst, Best) type will be displayed using a JTree UI. A FileChooser will be provided for choosing the files.

'Library-and-Model' information for all the three types of models is stored in a simple array/vector. This is what gets saved in the project. During the runtime, Tree Models  get created from the information in these arrays:

  • the Libraries specified are parsed to look for the Models present in the files.
  • the Libraies and the models therein are added to their respective Tree Models
  • Tree Models are also created for the selected models (along with the verification that the corresponding Libraries still exist)
  • The single Tree UI (one each for Libraries and the Models) on the form  displays one of the three Tree Models depending on the User's  selection of "Show Models of Type". The Model of a Tree can be changed by JTree's setModel(). In the implementation this has been handled by an ItemListener listening for a 'state-changed' and then calling appropriate methods for putting up the correct tree model in the UI depending upon the Model Type.

    Deletion in Trees

    The "delete" key will be made to delete the Library/models. To implement the mapping of keys to an action:
    JComponent.registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int)
    An extention of ActionListener has been defined as an inner class that looks for the object from the ActionEvent and then calls an appropriate method (depending on the object) to accomplish the deletion.

    Changing the Look of the Tree

    The form has two Trees. The cell renderer of these trees are set to a modified DefaultTreeCellRenderer by Jtree's setCellRenderer. The kind of attributes modified are Background Selection and non-selection color, Text Selection and non-selection color , close and open Icons, and the border selection color.

    Copying the SPICE File to the project area

    The copying is not simply done source --> destination, but instead destination --> Tmp File --> destination. It helps in covering up the case when the source file and the destination files are same. It's difficult pointing out this case because links can complicate the matter. Source and destination being the same in direct copying reduces the file to a zero byte file.
    Commenting of any type of statement from the original file is done along with the copying . Changes to this is quite simple. The copying takes place only during the setup while creating the new project and not in setup of an existing project. This has been achieved by keeping the information in variable 'newProject'.

    Once the file gets copied to the project area, it is audited for any Analysis statement, and recursive existence of all Includes. The messages of the audit are shown to the user along with the option of editing the SPICE file. (JeditCont)

    Creating typ/min/max Library Reference files

    Library reference files (specified in the s2i command file) are written out. These files have
      - Include statements for Ckt instantiation and source element files which are generated on Translate->Execute
      - Write in the LIBS/INCLUDES statements. If nothing in Best/Worst, simply copy the Typ data.