SciCoDE project: Difference between revisions

From Sccswiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 66: Line 66:
|style="border-style: solid; border-width: 0 1px 1px 0"| setter   
|style="border-style: solid; border-width: 0 1px 1px 0"| setter   
|}
|}
<syntaxhighlight lang="java">
class A{
  public void test();
}
</syntaxhighlight>

Revision as of 11:14, 5 May 2011

Creating a simple project in sciCoDE

In this section we will create the Hello World project in sciCoDE. As implementation language we are going to use java.

Creating the project

  1. Inside Eclipse select the menu item File > New > Project.... to open the New Project wizard
  2. Select sciCoDE Project then click Next to start the Open the new sciCoDE project wizard New Java Project wizard:
    • On this page, type "HelloWorld" in the Project name field, and then click Finish.project_1.png
      File:Project 1.png
  3. In the Package Explorer view, expand the HelloWorld project. The project is structured as followed:
    • src : contains the main "sci"-file, which stores the state of the workbench and a sidl file with the SIDL description of the components.
    • components : contains the java or c++ sources of the components in this project
    • includes : contains dependent SIDL files
    • import : a folder where scicode stores the files of imported components
project.png
File:Project.png

Writing the SIDL description

The next step is to define the Hello World components. The application will consist of three parts:

  • a user interface, which will be used to enter the user name
  • a kernel, which will merge the user name with the "hello world" string
  • a visualization, which will print the whole string on the console.

In this example this three parts are converted to components. The main idea is to pass the string entered in the first component(UI) to the kernel. The kernel will compute the new value of the string and forward it to the visualization. The only thing what we need to implement this scenario is a simple interface to pass strings between components. Our workbench setup should look like this: hello_world.png File:Hello world.png

Compiling the SIDL description

After creating SIDL description we need to compile it with the build-in SIDL-Compiler. Initially the compiler is not turned on. To do this select Project->Properties and then the sciCoDE compiler option to see the configuration setup. compiler_settings.png

File:Compiler settings.png

The compiler configuration provides three options:

  • create the components classes in Java
  • create the components classes in C++/JNI
  • create the java-Wrapper classes of an existing remote application

If your SIDL is dependent from another external SIDL document, you can insert such kind of dependencies in the Include Path-box.The output folder shows where to store the generated files. Normally the builder is set to "build automatically". This means that after activating the compiler the component classes will be generated immediately and Package-explorer view will be refreshed.

Instantiation of components

After finishing the compilation of the components you can insert them in the workbench. To do this you should click with the right mouse button on the palette and select the Import xml option. Each compiled component has a meta-description written in a XML-file(description.xml). To include the component in the palette the user should import this xml.

import_xml.png

File:Import xml.png

Now the components can be dropped on the workspace and connected via the connection tool as shown above.

Adding a user interface

The next step will be to add user interfaces to the HelloUI-component. As described in the User Interfaces section the following steps should be done:

  1. mark HelloUI as UI-component by returning true in the hasGUI function of the Implementation class.
  2. create an UI class which extends the abstract class de.tum.scicode.plugin.services.ui.Tab in order to use the UI Container.
  3. Add the following class members:
member name arguments function
UI String label,TabFolder parent,int style constructor of the ui class
void createControlGroup - instantiates the controls of the UI
void setImplementation HelloUIImplementation implmentation setter

<syntaxhighlight lang="java"> class A{

  public void test();

} </syntaxhighlight>