| 28 | = Netcomponents = |
| 29 | |
| 30 | == Creating a New Netcomponent Repository == |
| 31 | |
| 32 | Netcomponent Repositories can be integrated in two different ways: in a simple way and in an elaborated way as plugin for Renew. |
| 33 | |
| 34 | === Simple NC Repository === |
| 35 | |
| 36 | see also Chapter 2.7.6 of the [http://www.informatik.uni-hamburg.de/TGI/renew/userguide/node49.html Renew User Guide] |
| 37 | |
| 38 | A folder that contains at least one Renew net drawing (''.rnw'' file), a file called ''.sequence'' and subfolder called ''images'', which again contains at least one image called ''generic.gif'', suffices as a NC Repository. It can be directly used in Renew by using the command ''Tools > Netcomponents > select from directory''. A NC repository will be available as a tool palette in Renew. By using the available tools from the palette the net associated with the tool will be included in your drawing. |
| 39 | |
| 40 | ==== Exmple Folder Structure ==== |
| 41 | |
| 42 | Here is a minimalistic folder structure for an NC repository. |
| 43 | |
| 44 | {{{ |
| 45 | tools/ |
| 46 | ├── .sequence |
| 47 | ├── example-nc.rnw |
| 48 | └── images |
| 49 | └── generic.gif |
| 50 | }}} |
| 51 | |
| 52 | ==== Details ==== |
| 53 | |
| 54 | * In order to fit nicely into the GUI all images should be of the size 24x24 in pixels. |
| 55 | * The net component ''example-nc'' (defined by the net drawing ''example-nc.rnw'') will appear in the tool tip as ''NC example-nc''. |
| 56 | * If an image in images with the name ''example-nc.gif'' exists the image will be used in as tool button icon or generic.gif instead. |
| 57 | * The file ''.sequence'' allows to sort the tool buttons in a predefined order. Add the names of the drawing (without ''.rnw'') to the file, only one name per line. All non-mentioned NCs will be added to the end of the palette. |
| 58 | * The NC will be added to the drawing at the location of the mouse click, i.e. coordinates x=0, y=o (upper left corner) of the NC will be on mouse position. You might have to adjust the location of the figures in the NC drawing to achieve a comfortable behavior. |
| 59 | |
| 60 | === NC Plugin === |
| 61 | |
| 62 | In order to create a plugin that provides a NC repository you have to provide a repository directory - in the fashion described above - and a plugin configuration file (''plugin.cfg''). |
| 63 | |
| 64 | There are several nice and interesting things about repository plugins: |
| 65 | |
| 66 | * Since they do not need any Java code, they can be built without any compilation. |
| 67 | * Just drop a folder containing the ''plugin.cfg'' and a tools directory into the ''plugins'' folder of Renew |
| 68 | * It will be loaded on the next start or on the fly with the command ''load'' (e.g. ''load *''). |
| 69 | * Components in the ''tools'' directory can be adjusted on the fly; just unload the palette and reload the modified version. |
| 70 | |
| 71 | ==== Example plugin.cfg ==== |
| 72 | {{{ |
| 73 | mainClass = de.renew.netcomponents.PalettePlugin |
| 74 | name = Example Components |
| 75 | provides = de.renew.custom.example-components |
| 76 | requires = de.renew.util,de.renew.simulator,ch.ifa.draw,de.renew.formalism,de.renew.misc,de.renew.gui,de.renew.nc |
| 77 | de.renew.nc.dir-prop-name=de.renew.custom.example-components.dir |
| 78 | de.renew.nc.init-prop-name=de.renew.custom.example-components.init |
| 79 | de.renew.custom.example-components.dir = tools |
| 80 | de.renew.custom.example-components.init = false |
| 81 | version = 0.1 |
| 82 | versionDate = 7 June 2013 |
| 83 | versionText = An example repository |
| 84 | }}} |
| 85 | |
| 86 | ==== Exmple Folder Structure ==== |
| 87 | |
| 88 | {{{ |
| 89 | example-plugin |
| 90 | ├── plugin.cfg |
| 91 | └── tools |
| 92 | ├── .sequence |
| 93 | ├── example-nc.rnw |
| 94 | └── images |
| 95 | ├── example-nc.gif |
| 96 | └── generic.gif |
| 97 | }}} |
| 98 | |
| 99 | |