New Functionality in the Application Builder
Also see the Introduction to the Application Builder, Application Builder Reference Manual, and Application Programming Guide for more information.
General Improvements and Changes
You can now record code directly to the Java Shell window. A Record Code button has been added to the Java Shell window. When clicked, changes to the model or application will be recorded directly to the input area of the Java Shell window. This is useful, for example, if you want to find out how to change something programmatically in the model in order to then run it from the Java Shell window directly. Otherwise, Record Code works the same as when recording to methods. You can stop the recording from the Java Shell input toolbar or from the ribbon where you could previously stop method recording (in the Model Builder on the Developer tab; in the Application Builder on the Home tab or the Method tab).
The Data Viewer window now has a toolbar. It includes the following buttons:
-
Edit Node: If a variable in the Data Viewer window is selected and it is part of the model, you can use this button to go to the definition of this variable in the model.
-
Collapse All: Collapses the tree in the Data Viewer window. You can also open its menu to choose Collapse Selected and Collapse Other.
-
Expand Main Levels: Expands all “header nodes” so that all variables are visible in the Data Viewer window. You can also open its menu to choose Expand Selected.
-
Full Precision: Toggles full precision on and off for the variables in the Data Viewer window.
Note that the Data Viewer toolbar with only the Full Precision button is available in version 6.3 update 1.
When opening the Java Shell context menu on a results node that corresponds to a variable in the Data Viewer window, there is a new Show in Data Viewer option. This option opens the Data Viewer window and highlights the corresponding variable there. The Show in Data Viewer option in the toolbar works in the same way, taking the currently selected node into account and highlighting that variable if possible. If the current selection does not correspond to a variable in the Data Viewer window, the window is opened as before without highlighting anything, and the Java Shell branch in the tree table is expanded (if present).
If you right-click on a shell variable in the Data Viewer window, a Delete From Session option now appears. This option removes the variable from the current Java Shell session.
More properties are now available for Data Access; that is, they get a green checkbox when this option is enabled. The improved data access support includes properties on the Model (root) node as well as for properties under Component, Geometry, Mesh, Study, and Results.
When method code prints to System.out or System.err, each completed line is sent to the Debug Log window, in addition to where it was sent in 6.3 (for example, a console window if started from a Linux terminal). This output does not happen if the method is called from the Java Shell window because in that case, the output already goes to the Java Shell window like in version 6.3.
Improvements to the Form Editor
The Button and Toggle Button form objects have a new option for Size in their settings called Use icon size. When a user has added images to the image library, this option can be used to show the images in their original size.
Combo Box form objects with the Allow other values checkbox selected now have an Enable text search option to control if the combo box should try to find an item matching what you type in its text field. Text search is only available in the Windows client.
Improvements and Changes to the Method Editor and Application Language
Copying from Method Errors and Warnings Window
The table in the Method Errors and Warnings window now supports selecting multiple cells and copying the selected cells to the clipboard. It also includes an option to select all cells. Copy and Select All can be selected from the table context menu or using the standard keyboard shortcuts (Ctrl+C and Ctrl+A, respectively).
Improved Copy as Code to Clipboard Functionality
The action on the Copy as Code to Clipboard menu previously referred to as Set All is now called Set All Modified Settings. A new action, based on report-generator code, that records code also for properties with their default values, called Set All Displayed Settings, has been added.
Toggle Folding Expansion
Right-click in the Method Editor and choose Toggle Folding Expansion (or use the keyboard shortcut Ctrl+Shift+-) in the method to toggle all the expansion states of the code folds that are represented by minus signs or plus signs in the left margin of the Method Editor.
Changing Color of Graphics Form Object
It is now possible to change the color, top color, bottom color, and icon of the Graphics form object while an app is running. The syntax for changing this is the same as for other color and icon options. The color properties are called "background2d", "topBackground", and "bottomBackground". They can be set either from a string (such as "blue", "black", and so on) or from RGB values 0–255. The icon property is called "icon". Valid values are images defined in the Images > Libraries node in the application tree, or use an empty string for no icon. The default icon is called "logo_graphics.png".
Examples:
app.form("form1").formObject("graphics1").set("background2d", "blue");
app.form("form1").formObject("graphics1").set("topBackground", "black");
app.form("form1").formObject("graphics1").set("bottomBackground", "red");
app.form("form1").formObject("graphics1").setColor("background2d", 230, 236, 232);
app.form("form1").formObject("graphics1").set("icon", "compute_32.png");
Multiple and Grouped Declaration Nodes
Additions to the DeclarationGroup objects.
To retrieve a DeclarationGroup object containing entries of the "string1" string declaration node:
DeclarationGroup group = app.declaration().group("string1");
To retrieve a DeclarationGroup object containing entries of the "string1" string declaration node under the given form:
group = app.form("form1").declaration().group("string1");
To get the value of the "svar" declaration among the entries:
String value = group.get("svar").getString();
Iterate over the entries of the "integer1" Integer declarations node:
int i = 0;
for (Primitive entry: app.declaration().group("integer1")) {
  entry.set(i++);
}
Additions to the DeclarationGroupList objects.
To get the names of all global primitive declaration nodes:
String[] names = app.declaration().group().names();
To get the names of the local primitive declaration nodes of a given form:
String[] names = app.form("form1").declaration().group().names();
New WriteFile Overloads for User-Specified Delimiters
Two new writeFile() overloads have been added to the application language to make it possible to save a string matrix with a user-specified delimiter character:
void writeFile(String file, String[][] value, char delimiter,
  boolean append);
void writeFile(String file, String[][] value, char delimiter,
  boolean append, boolean bom);
Exporting Materials
Materials and their data can be exported to the model XML file format using the following methods for global materials and materials under a component, respectively:
String[][] com.comsol.model.MaterialList.export(String filename, String[] materials)
 
String[][] com.comsol.model.ComponentMaterialList.export(String filename, String[] materials)