diff --git a/jcae/core/nbproject/project.xml b/jcae/core/nbproject/project.xml
index e9bd159c3..d1afcdb2b 100644
--- a/jcae/core/nbproject/project.xml
+++ b/jcae/core/nbproject/project.xml
@@ -143,14 +143,6 @@
7.12.1.1
-
- org.openide.options
-
-
-
- 6.13.1
-
-
org.openide.text
diff --git a/jcae/core/src/org/jcae/netbeans/Settings.java b/jcae/core/src/org/jcae/netbeans/Settings.java
deleted file mode 100644
index a4d1be522..000000000
--- a/jcae/core/src/org/jcae/netbeans/Settings.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Project Info: http://jcae.sourceforge.net
- *
- * This program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- *
- * (C) Copyright 2004, by EADS CRC
- */
-
-package org.jcae.netbeans;
-
-import java.io.Externalizable;
-import org.openide.options.SystemOption;
-
-/**
- * @author Jerome Robert
- *
- */
-public class Settings extends SystemOption
-{
- private static final String ZFACTORABS = "javax.media.j3d.zFactorAbs";
- private static final String ZFACTORREL = "javax.media.j3d.zFactorRel";
-
- /**
- * @return Returns the polygonOffset.
- */
- public float getPolygonOffset()
- {
- String s=System.getProperty(ZFACTORABS, "20.0f");
- return Float.parseFloat(s);
- }
- /**
- * @param polygonOffset The polygonOffset to set.
- */
- public void setPolygonOffset(float polygonOffset)
- {
- System.out.println("setPolygonOffset");
- System.setProperty(ZFACTORABS, ""+polygonOffset);
- }
- /**
- * @return Returns the polygonOffsetFactor.
- */
- public float getPolygonOffsetFactor()
- {
- String s=System.getProperty(ZFACTORREL, "2.0f");
- return Float.parseFloat(s);
- }
- /**
- * @param polygonOffsetFactor The polygonOffsetFactor to set.
- */
- public void setPolygonOffsetFactor(float polygonOffsetFactor)
- {
- System.setProperty(ZFACTORREL, ""+polygonOffsetFactor);
- }
- /* (non-Javadoc)
- * @see org.openide.options.SystemOption#displayName()
- */
- public String displayName()
- {
- return "viewer 3d settings";
- }
-}
diff --git a/jcae/core/src/org/jcae/netbeans/Settings.settings b/jcae/core/src/org/jcae/netbeans/Settings.settings
deleted file mode 100644
index f34d8613f..000000000
--- a/jcae/core/src/org/jcae/netbeans/Settings.settings
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/jcae/core/src/org/jcae/netbeans/layer.xml b/jcae/core/src/org/jcae/netbeans/layer.xml
index 68772c143..ac735fbef 100644
--- a/jcae/core/src/org/jcae/netbeans/layer.xml
+++ b/jcae/core/src/org/jcae/netbeans/layer.xml
@@ -447,16 +447,6 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/jcae/core/src/org/jcae/netbeans/mesh/BuidOEMMAction.java b/jcae/core/src/org/jcae/netbeans/mesh/BuidOEMMAction.java
index 70cceb6c4..0baa29a2f 100644
--- a/jcae/core/src/org/jcae/netbeans/mesh/BuidOEMMAction.java
+++ b/jcae/core/src/org/jcae/netbeans/mesh/BuidOEMMAction.java
@@ -20,14 +20,15 @@
package org.jcae.netbeans.mesh;
-import java.beans.*;
import org.jcae.netbeans.ProcessExecutor;
import org.jcae.netbeans.Utilities;
+import org.jcae.netbeans.options.JCAEPanel;
import org.openide.filesystems.FileUtil;
import org.openide.modules.InstalledFileLocator;
import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
+import org.openide.util.NbPreferences;
import org.openide.util.actions.CookieAction;
public final class BuidOEMMAction extends CookieAction
@@ -50,7 +51,7 @@ protected void performAction(Node[] activatedNodes)
getAbsolutePath();
String className="org.jcae.mesh.MeshOEMMIndex";
- String[] cmdLinePre=Settings.getDefault().getCommandLineAlgo();
+ String[] cmdLinePre=NbPreferences.forModule(JCAEPanel.class).get("commandLineAlgo", "").split(" ");
String[] cmdLine=new String[cmdLinePre.length+7];
System.arraycopy(cmdLinePre, 0, cmdLine, 0, cmdLinePre.length);
diff --git a/jcae/mesh-algos/nbproject/project.xml b/jcae/mesh-algos/nbproject/project.xml
index 5da402e37..e2e9d0695 100644
--- a/jcae/mesh-algos/nbproject/project.xml
+++ b/jcae/mesh-algos/nbproject/project.xml
@@ -128,14 +128,6 @@
7.12.1.1
-
- org.openide.options
-
-
-
- 6.13.1
-
-
org.openide.text
@@ -180,6 +172,7 @@
org.jcae.netbeans
org.jcae.netbeans.mesh
+ org.jcae.netbeans.options
org.jcae.netbeans.viewer3d
org.jcae.netbeans.viewer3d.actions
diff --git a/jcae/mesh-algos/src/org/jcae/netbeans/mesh/AbstractGroupAction.java b/jcae/mesh-algos/src/org/jcae/netbeans/mesh/AbstractGroupAction.java
index 0ce0c423f..1218c7a9d 100644
--- a/jcae/mesh-algos/src/org/jcae/netbeans/mesh/AbstractGroupAction.java
+++ b/jcae/mesh-algos/src/org/jcae/netbeans/mesh/AbstractGroupAction.java
@@ -30,6 +30,7 @@
import javax.xml.parsers.ParserConfigurationException;
import org.jcae.mesh.xmldata.Group;
import org.jcae.netbeans.viewer3d.ViewManager;
+import org.jcae.vtk.AmibeToMesh;
import org.jcae.vtk.View;
import org.openide.explorer.ExplorerManager;
import org.openide.nodes.Node;
@@ -42,6 +43,8 @@
public abstract class AbstractGroupAction extends CookieAction
{
+ Node[] temp;
+
protected int mode()
{
return CookieAction.MODE_ALL;
@@ -65,6 +68,8 @@ public int compare(Group t, Group t1) {
protected void performAction(Node[] arg0)
{
+
+ temp = arg0;
ExplorerManager em = ((ExplorerManager.Provider)
TopComponent.getRegistry().getActivated()).getExplorerManager();
try
@@ -77,7 +82,9 @@ protected void performAction(Node[] arg0)
{
AmibeDataObject ado = n.getLookup().lookup(AmibeDataObject.class);
if(ado != null && ado.getGroups() != null)
- groups2Group.put(n, createTreeSet(ado.getGroups().getGroups()));
+ {
+ groups2Group.put(n, createTreeSet(ado.getGroups().getGroups()));
+ }
}
//GroupNode
@@ -116,7 +123,68 @@ protected void performAction(Node[] arg0)
}
}
- private String[] groupsToID(Collection groupsToDisplay)
+ protected void refreshView(Node[] arg0)
+ {
+ //ExplorerManager em = ((ExplorerManager.Provider) TopComponent.getRegistry().getActivated()).getExplorerManager();
+ try
+ {
+ HashMap> groups2Group = new HashMap>();
+
+ for(Node n:arg0)
+ {
+ AmibeDataObject ado = n.getLookup().lookup(AmibeDataObject.class);
+ if(ado != null && ado.getGroups() != null)
+ {
+ //ado.addListenerFileChange();
+ groups2Group.put(n, createTreeSet(ado.getGroups().getGroups()));
+ }
+ }
+
+ //GroupNode
+ for(Node n:arg0)
+ {
+ GroupNode gn = n.getLookup().lookup(GroupNode.class);
+ if(gn != null)
+ {
+ Node amibeNode=n.getParentNode().getParentNode();
+ Collection c=groups2Group.get(amibeNode);
+ if(c==null)
+ {
+ c=createTreeSet(gn.getGroup());
+ groups2Group.put(amibeNode, c);
+ }
+ else
+ c.add(gn.getGroup());
+ }
+ }
+
+
+ View v = ViewManager.getDefault().getCurrentView();
+ for(Entry> e:groups2Group.entrySet())
+ {
+ String[] groupsToDisplay = groupsToID(e.getValue());
+ AmibeNViewable interactor = AmibeNViewable.get(e.getKey(), v);
+ AmibeDataObject ado = e.getKey().getLookup().lookup(AmibeDataObject.class);
+ if(interactor != null)
+ {
+ AmibeToMesh reader = new AmibeToMesh(ado.getGroups().getMeshFile(), groupsToDisplay);
+ interactor.addTriangles(reader.getTriangles());
+ interactor.addBeams(reader.getBeams());
+ v.Render();
+ }
+ }
+ }
+ catch(IOException ex)
+ {
+ Exceptions.printStackTrace(ex);
+ }
+ catch(SAXException ex)
+ {
+ Exceptions.printStackTrace(ex);
+ }
+ }
+
+ private String[] groupsToID(Collection groupsToDisplay)
{
String[] idGroupsDisplayed = new String[groupsToDisplay.size()];
int i = 0;
diff --git a/jcae/mesh-algos/src/org/jcae/netbeans/mesh/AlgoAction.java b/jcae/mesh-algos/src/org/jcae/netbeans/mesh/AlgoAction.java
index c9baaef05..932ac254c 100644
--- a/jcae/mesh-algos/src/org/jcae/netbeans/mesh/AlgoAction.java
+++ b/jcae/mesh-algos/src/org/jcae/netbeans/mesh/AlgoAction.java
@@ -25,7 +25,6 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.TreeSet;
@@ -36,16 +35,13 @@
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import org.jcae.mesh.JCAEFormatter;
-import org.jcae.mesh.xmldata.Group;
+import org.jcae.netbeans.options.JCAEPanel;
import org.netbeans.api.progress.ProgressHandle;
import org.netbeans.api.progress.ProgressHandleFactory;
import org.openide.filesystems.FileUtil;
import org.openide.modules.InstalledFileLocator;
import org.openide.nodes.Node;
-import org.openide.util.Cancellable;
-import org.openide.util.Exceptions;
-import org.openide.util.HelpCtx;
-import org.openide.util.Utilities;
+import org.openide.util.*;
import org.openide.util.actions.CookieAction;
import org.openide.windows.IOProvider;
import org.openide.windows.InputOutput;
@@ -210,7 +206,7 @@ protected void performAction(Node[] activatedNodes) {
"amibe-python/" + command + ".py",
"org.jcae.netbeans", false);
InputOutput io = IOProvider.getDefault().getIO(getName(), true);
- if (Settings.getDefault().isRunInSameJVM())
+ if (NbPreferences.forModule(JCAEPanel.class).getBoolean("runInSameJVM", true))
runInSameVM(args, pyFile, io);
else
runInOtherVM(activatedNodes[0], args, pyFile, io);
@@ -277,7 +273,8 @@ private void runInOtherVM(Node node, List args, File pyFile, InputOutput
File f = InstalledFileLocator.getDefault().locate(
"modules/jython/bin/jython" + ext, "org.jcae.netbeans.mesh", false);
pb.command().add(f.getPath());
- for (String s : Settings.getDefault().parameters()) {
+ JCAEPanel j = new JCAEPanel(null);
+ for (String s : j.parameters()) {
if (s.startsWith("-") && !s.startsWith("-D")) {
s = "-J" + s;
}
diff --git a/jcae/mesh-algos/src/org/jcae/netbeans/mesh/Settings.java b/jcae/mesh-algos/src/org/jcae/netbeans/mesh/Settings.java
deleted file mode 100644
index 9024363d9..000000000
--- a/jcae/mesh-algos/src/org/jcae/netbeans/mesh/Settings.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Project Info: http://jcae.sourceforge.net
- *
- * This program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- *
- * (C) Copyright 2008, by EADS France
- */
-
-package org.jcae.netbeans.mesh;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import org.openide.modules.InstalledFileLocator;
-import org.openide.options.SystemOption;
-import org.openide.util.Lookup;
-
-/**
- * @author Jerome Robert
- *
- */
-public class Settings extends SystemOption
-{
- static final long serialVersionUID = 2437343054662293472L;
- static public Settings getDefault()
- {
- return Lookup.getDefault().lookup(Settings.class);
- }
-
- private String maximumMemory="1000m";
- private String[] customJVMParameters=new String[0];
- private String[] customMesherParameters=new String[0];
- private boolean runInSameJVM=Boolean.getBoolean("jcae.netbeans.mesh.samejvm");
-
-
- /* (non-Javadoc)
- * @see org.openide.options.SystemOption#displayName()
- */
- public String displayName()
- {
- return "Mesher settings";
- }
-
- /**
- * Return a command line to execute other algo in the jcae.jar archive
- */
- public String[] getCommandLineAlgo()
- {
- String javaExe=new File(new File(System.getProperty("java.home"), "bin"), "java").getPath();
- List toReturn=parameters();
- toReturn.add(0, javaExe);
- return toReturn.toArray(new String[toReturn.size()]);
- }
-
- public List parameters()
- {
- ArrayList toReturn=new ArrayList();
- toReturn.add("-Xmx"+maximumMemory);
- String logPath = InstalledFileLocator.getDefault().
- locate("etc/logging.properties", "org.jcae.netbeans.mesh", false).
- getAbsolutePath();
- toReturn.add("-Djava.util.logging.config.file="+logPath);
- toReturn.addAll(Arrays.asList(getCustomJVMParameters()));
- return toReturn;
- }
-
- public String getMaximumMemory()
- {
- return maximumMemory;
- }
-
- public void setMaximumMemory(String maximumMemory)
- {
- this.maximumMemory = maximumMemory;
- }
-
- public boolean isRunInSameJVM()
- {
- return runInSameJVM;
- }
- public void setRunInSameJVM(boolean runInSameJVM)
- {
- this.runInSameJVM = runInSameJVM;
- }
- /**
- * @return Returns the customJVMParameters.
- */
- public String[] getCustomJVMParameters()
- {
- return customJVMParameters;
- }
- /**
- * @param customJVMParameters The customJVMParameters to set.
- */
- public void setCustomJVMParameters(String[] customJVMParameters)
- {
- this.customJVMParameters = customJVMParameters;
- }
- /**
- * @return Returns the customMesherParameters.
- */
- public String[] getCustomMesherParameters()
- {
- return customMesherParameters;
- }
- /**
- * @param customMesherParameters The customMesherParameters to set.
- */
- public void setCustomMesherParameters(String[] customMesherParameters)
- {
- this.customMesherParameters = customMesherParameters;
- }
-}
diff --git a/jcae/mesh-algos/src/org/jcae/netbeans/mesh/Settings.settings b/jcae/mesh-algos/src/org/jcae/netbeans/mesh/Settings.settings
deleted file mode 100644
index 488f6d76d..000000000
--- a/jcae/mesh-algos/src/org/jcae/netbeans/mesh/Settings.settings
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/jcae/mesh-algos/src/org/jcae/netbeans/mesh/ViewGroupAction.java b/jcae/mesh-algos/src/org/jcae/netbeans/mesh/ViewGroupAction.java
index 33ac74536..6b8d14a63 100644
--- a/jcae/mesh-algos/src/org/jcae/netbeans/mesh/ViewGroupAction.java
+++ b/jcae/mesh-algos/src/org/jcae/netbeans/mesh/ViewGroupAction.java
@@ -28,6 +28,11 @@
import org.jcae.vtk.AmibeToMesh;
import org.jcae.vtk.View;
import org.openide.explorer.ExplorerManager;
+import org.openide.filesystems.FileAttributeEvent;
+import org.openide.filesystems.FileChangeListener;
+import org.openide.filesystems.FileEvent;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileRenameEvent;
import org.openide.loaders.DataObject;
import org.openide.nodes.Node;
import org.openide.util.WeakListeners;
@@ -35,7 +40,7 @@
import org.jcae.vtk.Viewable;
public class ViewGroupAction extends AbstractGroupAction
-{
+{
public String getName()
{
return "View";
@@ -74,8 +79,27 @@ protected void processGroups(String[] idGroupsDisplayed, final View view, Node n
ExplorerManager em)
throws ParserConfigurationException, SAXException, IOException
{
+
AmibeNViewable interactor = AmibeNViewable.get(node, view);
AmibeDataObject ado = node.getLookup().lookup(AmibeDataObject.class);
+
+ //ado.getPrimaryFile().addRecursiveListener(this);
+ FileObject[] amibeChildren = ado.getPrimaryFile().getChildren();
+ for(int i=0; i< amibeChildren.length; i++)
+ if(amibeChildren[i].getName().equalsIgnoreCase("jcae3d"))
+ {
+ amibeChildren[i].addFileChangeListener(new FileChangeListener() {
+
+ public void fileFolderCreated(FileEvent fe) {}
+ public void fileDataCreated(FileEvent fe) {}
+ public void fileChanged(FileEvent fe) {
+ refreshView(temp);
+ }
+ public void fileDeleted(FileEvent fe) {}
+ public void fileRenamed(FileRenameEvent fre) {}
+ public void fileAttributeChanged(FileAttributeEvent fae) {}
+ });
+ }
if(interactor == null)
{
AViewable v = new AViewable(node, em, view);
@@ -106,4 +130,5 @@ protected void processGroups(String[] idGroupsDisplayed, final View view, Node n
interactor.addBeams(reader.getBeams());
view.Render();
}
+
}
diff --git a/jcae/mesh-algos/src/org/jcae/netbeans/mesh/layer.xml b/jcae/mesh-algos/src/org/jcae/netbeans/mesh/layer.xml
index 9203dd5cb..efc89b6fe 100644
--- a/jcae/mesh-algos/src/org/jcae/netbeans/mesh/layer.xml
+++ b/jcae/mesh-algos/src/org/jcae/netbeans/mesh/layer.xml
@@ -162,17 +162,6 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/jcae/mesh-algos/src/org/jcae/netbeans/options/JCAEOptionsPanelController.java b/jcae/mesh-algos/src/org/jcae/netbeans/options/JCAEOptionsPanelController.java
new file mode 100644
index 000000000..d2abdbbf6
--- /dev/null
+++ b/jcae/mesh-algos/src/org/jcae/netbeans/options/JCAEOptionsPanelController.java
@@ -0,0 +1,75 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.jcae.netbeans.options;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import javax.swing.JComponent;
+import org.netbeans.spi.options.OptionsPanelController;
+import org.openide.util.HelpCtx;
+import org.openide.util.Lookup;
+
+@OptionsPanelController.TopLevelRegistration(categoryName = "#OptionsCategory_Name_jCAE",
+iconBase = "org/jcae/netbeans/options/amibe.png",
+keywords = "#OptionsCategory_Keywords_jCAE",
+keywordsCategory = "jCAE")
+@org.openide.util.NbBundle.Messages({"OptionsCategory_Name_jCAE=jCAE", "OptionsCategory_Keywords_jCAE=jcae"})
+public final class JCAEOptionsPanelController extends OptionsPanelController {
+
+ private JCAEPanel panel;
+ private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
+ private boolean changed;
+
+ public void update() {
+ changed = false;
+ }
+
+ public void applyChanges() {
+ changed = false;
+ }
+
+ public void cancel() {
+ // need not do anything special, if no changes have been persisted yet
+ }
+
+ public boolean isValid() {
+ return true;
+ }
+
+ public boolean isChanged() {
+ return changed;
+ }
+
+ public HelpCtx getHelpCtx() {
+ return null; // new HelpCtx("...ID") if you have a help set
+ }
+
+ public JComponent getComponent(Lookup masterLookup) {
+ return getPanel();
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {
+ pcs.addPropertyChangeListener(l);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener l) {
+ pcs.removePropertyChangeListener(l);
+ }
+
+ private JCAEPanel getPanel() {
+ if (panel == null) {
+ panel = new JCAEPanel(this);
+ }
+ return panel;
+ }
+
+ void changed() {
+ if (!changed) {
+ changed = true;
+ pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
+ }
+ pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
+ }
+}
diff --git a/jcae/mesh-algos/src/org/jcae/netbeans/options/JCAEPanel.java b/jcae/mesh-algos/src/org/jcae/netbeans/options/JCAEPanel.java
new file mode 100644
index 000000000..918847bf2
--- /dev/null
+++ b/jcae/mesh-algos/src/org/jcae/netbeans/options/JCAEPanel.java
@@ -0,0 +1,205 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.jcae.netbeans.options;
+
+import java.awt.Dimension;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import javax.swing.JDialog;
+import javax.swing.JOptionPane;
+import org.openide.explorer.propertysheet.PropertySheet;
+import org.openide.modules.InstalledFileLocator;
+import org.openide.nodes.*;
+import org.openide.util.Exceptions;
+
+public final class JCAEPanel extends PropertySheet {
+
+ private final JCAEOptionsPanelController controller;
+
+ public JCAEPanel(JCAEOptionsPanelController controller) {
+ this.controller = controller;
+ //initComponents();
+ // TODO listen to changes in form fields and call controller.changed()
+ AbstractNode node = new AbstractNode(Children.LEAF)
+ {
+ @Override
+ public PropertySet[] getPropertySets() {
+ return createPropertySet();
+ }
+ };
+ setNodes(new Node[]{node});
+ setDescriptionAreaVisible(true);
+ setPreferredSize(new Dimension(0, 250));
+ }
+
+ private String maximumMemory="1000m";
+ private String customJVMParameters=new String();
+ private String customMesherParameters=new String();
+ private boolean runInSameJVM=Boolean.getBoolean("jcae.netbeans.mesh.samejvm");
+
+ private String polygonOffset = "20.0f";
+ private String polygonOffsetFactor = "2.0f";
+
+ /**
+ * @return the polygonOffset
+ */
+ public String getPolygonOffset() {
+ return polygonOffset;
+ }
+
+ /**
+ * @param polygonOffset the polygonOffset to set
+ */
+ public void setPolygonOffset(String polygonOffset) {
+ this.polygonOffset = polygonOffset;
+ }
+
+ /**
+ * @return the polygonOffsetFactor
+ */
+ public String getPolygonOffsetFactor() {
+ return polygonOffsetFactor;
+ }
+
+ /**
+ * @param polygonOffsetFactor the polygonOffsetFactor to set
+ */
+ public void setPolygonOffsetFactor(String polygonOffsetFactor) {
+ this.polygonOffsetFactor = polygonOffsetFactor;
+ }
+
+
+ private class MyProperty extends PropertySupport.Reflection
+ {
+ public MyProperty(Class type, String property, String name)
+ throws NoSuchMethodException
+ {
+ this(type, property, name, name);
+ }
+ public MyProperty(Class type, String property, String name, String description)
+ throws NoSuchMethodException
+ {
+ super(JCAEPanel.this, type, property);
+ setName(name);
+ setShortDescription(description);
+ }
+ }
+
+ private Sheet.Set[] createPropertySet()
+ {
+ Sheet.Set[] r = new Sheet.Set[2];
+ r[0] = new Sheet.Set();
+ r[0].setName("Mesher Settings");
+ try {
+ PrefProperty p1 = new PrefProperty("jcae.MaximumMemory", "maximumMemory", maximumMemory, JCAEPanel.class);
+ r[0].put(p1);
+
+ PrefProperty p2 = new PrefProperty("jcae.CustomJVMParameters", "customJVMParameters", customJVMParameters, JCAEPanel.class);
+ r[0].put(p2);
+
+ PrefProperty p3 = new PrefProperty("jcae.CustomMesherParameters", "customMesherParameters", customMesherParameters, JCAEPanel.class);
+ r[0].put(p3);
+
+ PrefProperty p4 = new PrefProperty("jcae.RunInSameJVM", "runInSameJVM", runInSameJVM, JCAEPanel.class);
+ r[0].put(p4);
+
+ String[] cmd = getCommandLineAlgo();
+ for(int i=0; i toReturn=parameters();
+ toReturn.add(0, javaExe);
+ return toReturn.toArray(new String[toReturn.size()]);
+
+ }
+
+ public List parameters()
+ {
+ ArrayList toReturn=new ArrayList();
+ toReturn.add("-Xmx"+maximumMemory);
+ String logPath = InstalledFileLocator.getDefault().
+ locate("etc/logging.properties", "org.jcae.netbeans.mesh", false).
+ getAbsolutePath();
+ toReturn.add("-Djava.util.logging.config.file="+logPath);
+ toReturn.addAll(Arrays.asList(getCustomJVMParameters()));
+ return toReturn;
+ }
+
+ public String getMaximumMemory()
+ {
+ return maximumMemory;
+ }
+
+ public void setMaximumMemory(String maximumMemory)
+ {
+ this.maximumMemory = maximumMemory;
+ }
+
+ public boolean isRunInSameJVM()
+ {
+ return runInSameJVM;
+ }
+ public void setRunInSameJVM(boolean runInSameJVM)
+ {
+ this.runInSameJVM = runInSameJVM;
+ }
+ /**
+ * @return Returns the customJVMParameters.
+ */
+ public String getCustomJVMParameters()
+ {
+ return customJVMParameters;
+ }
+ /**
+ * @param customJVMParameters The customJVMParameters to set.
+ */
+ public void setCustomJVMParameters(String customJVMParameters)
+ {
+ this.customJVMParameters = customJVMParameters;
+ }
+ /**
+ * @return Returns the customMesherParameters.
+ */
+ public String getCustomMesherParameters()
+ {
+ return customMesherParameters;
+ }
+ /**
+ * @param customMesherParameters The customMesherParameters to set.
+ */
+ public void setCustomMesherParameters(String customMesherParameters)
+ {
+ this.customMesherParameters = customMesherParameters;
+ }
+
+}
diff --git a/jcae/mesh-algos/src/org/jcae/netbeans/options/PrefProperty.java b/jcae/mesh-algos/src/org/jcae/netbeans/options/PrefProperty.java
new file mode 100644
index 000000000..f24463280
--- /dev/null
+++ b/jcae/mesh-algos/src/org/jcae/netbeans/options/PrefProperty.java
@@ -0,0 +1,68 @@
+package org.jcae.netbeans.options;
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.util.prefs.Preferences;
+import org.openide.nodes.Node.Property;
+import org.openide.util.NbPreferences;
+
+/**
+ *
+ * @author u
+ */
+public class PrefProperty extends Property {
+ private final String prefName;
+ private final Object defValue;
+ private final Preferences preferences;
+
+ public PrefProperty(String prefName, String name, Object defValue, String description, Class moduleClass)
+ {
+ super(defValue.getClass());
+ setName(name);
+ this.prefName = prefName;
+ this.defValue = defValue;
+ this.setShortDescription(description);
+ preferences = NbPreferences.forModule(moduleClass);
+ }
+
+ public PrefProperty(String prefName, String name, Object defValue, Class moduleClass)
+ {
+ this(prefName, name, defValue, null, moduleClass);
+ }
+
+ @Override
+ public boolean canRead() {
+ return true;
+ }
+
+ @Override
+ public boolean canWrite() {
+ return true;
+ }
+
+ @Override
+ public Object getValue() throws IllegalAccessException,
+ InvocationTargetException {
+ if(Double.class.isAssignableFrom(getValueType()))
+ return (Double) preferences.getDouble(prefName, (Double)defValue);
+ else if(Boolean.class.isAssignableFrom(getValueType()))
+ return (Boolean) preferences.getBoolean(prefName, (Boolean)defValue);
+ else if(Integer.class.isAssignableFrom(getValueType()))
+ return (Integer) preferences.getInt(prefName, (Integer)defValue);
+ else if(File.class.isAssignableFrom(getValueType()))
+ return new File(preferences.get(prefName, defValue.toString()));
+ else
+ return preferences.get(prefName, (String)defValue);
+ }
+
+ @Override
+ public void setValue(Object val) throws IllegalAccessException,
+ IllegalArgumentException, InvocationTargetException {
+ preferences.put(prefName, val.toString());
+ }
+}
\ No newline at end of file
diff --git a/jcae/mesh-algos/src/org/jcae/netbeans/options/amibe.png b/jcae/mesh-algos/src/org/jcae/netbeans/options/amibe.png
new file mode 100644
index 000000000..ae51b5e49
Binary files /dev/null and b/jcae/mesh-algos/src/org/jcae/netbeans/options/amibe.png differ
diff --git a/jcae/mesh-algos/src/org/jcae/netbeans/viewer3d/Settings.java b/jcae/mesh-algos/src/org/jcae/netbeans/viewer3d/Settings.java
deleted file mode 100644
index f1ef1cab0..000000000
--- a/jcae/mesh-algos/src/org/jcae/netbeans/viewer3d/Settings.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Project Info: http://jcae.sourceforge.net
- *
- * This program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- *
- * (C) Copyright 2004, by EADS CRC
- */
-
-package org.jcae.netbeans.viewer3d;
-
-import org.openide.options.SystemOption;
-
-/**
- * @author Jerome Robert
- *
- */
-public class Settings extends SystemOption
-{
- private static final String ZFACTORABS = "javax.media.j3d.zFactorAbs";
- private static final String ZFACTORREL = "javax.media.j3d.zFactorRel";
- /**
- * @return Returns the polygonOffset.
- */
- public float getPolygonOffset()
- {
- String s=System.getProperty(ZFACTORABS, "20.0f");
- return Float.parseFloat(s);
- }
- /**
- * @param polygonOffset The polygonOffset to set.
- */
- public void setPolygonOffset(float polygonOffset)
- {
- System.setProperty(ZFACTORABS, ""+polygonOffset);
- }
- /**
- * @return Returns the polygonOffsetFactor.
- */
- public float getPolygonOffsetFactor()
- {
- String s=System.getProperty(ZFACTORREL, "2.0f");
- return Float.parseFloat(s);
- }
- /**
- * @param polygonOffsetFactor The polygonOffsetFactor to set.
- */
- public void setPolygonOffsetFactor(float polygonOffsetFactor)
- {
- System.setProperty(ZFACTORREL, ""+polygonOffsetFactor);
- }
- /* (non-Javadoc)
- * @see org.openide.options.SystemOption#displayName()
- */
- public String displayName()
- {
- return "viewer 3d settings";
- }
-}
diff --git a/jcae/mesh-algos/src/org/jcae/netbeans/viewer3d/Settings.settings b/jcae/mesh-algos/src/org/jcae/netbeans/viewer3d/Settings.settings
deleted file mode 100644
index f34d8613f..000000000
--- a/jcae/mesh-algos/src/org/jcae/netbeans/viewer3d/Settings.settings
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/scripts/jCAE-auto-installer.sh b/scripts/jCAE-auto-installer.sh
new file mode 100755
index 000000000..3ac136a78
--- /dev/null
+++ b/scripts/jCAE-auto-installer.sh
@@ -0,0 +1,909 @@
+#!/bin/sh
+
+##################################################
+## Preliminaries for win32 installation
+##################################################
+
+#In addition to dependencies mentioned in the linux installer, the required packages are:
+
+
+#1. mingw-w64 debian package (http://packages.debian.org/sid/mingw-w64)
+# - This will require editing /etc/apt/sources.list
+# Steps
+# $ sudo echo 'deb http://ftp.de.debian.org/debian sid main' >> /etc/apt/sources.list
+# $ sudo apt-get install mingw-w64 gcc-mingw-w64-i686 g++-mingw-w64-i686
+#
+
+#2. wine 1.2
+# $ sudo apt-get install wine1.2
+
+#Some other steps need to be performed before moving ahead
+#
+#1. sudo gedit /usr/share/cmake-2.8/Modules/Platform/Windows-GNU.cmake
+# - This requires to be automated
+
+
+##################################################
+## Script Variables
+##################################################
+
+# Oputput text formatting
+bold=`tput bold`
+normal=`tput sgr0`
+green="\033[32m "
+red="\033[31m "
+black="\033[0m "
+
+# Installer command line arguments
+
+export targetOS;
+export makeSpeed;
+export myjava;
+
+echo "$1"
+if [ "$1" = "linux" ] || [ "$1" = "windows" ]
+then
+ targetOS=$1
+else
+ echo "$red$bold\nPlease specify the target OS (linux/windows) \n$normal $black"
+ exit 1
+fi
+
+if [ x$2 = x ]
+then
+ makeSpeed="2"
+else
+ makeSpeed=$2
+fi
+
+if [ "$1" = "linux" ] && [ x$JAVA_HOME = x ]
+then
+ echo "$red$bold\nPlease specify \$JAVA_HOME environment variable \n$normal $black"
+ exit 1
+fi
+
+if [ "$1" = "linux" ]
+then
+ myjava=$JAVA_HOME/bin/java
+else
+ myjava=java
+fi
+
+startTime=$(date +%s)
+
+# Relative paths simplified
+export mypwd=$PWD
+
+
+##################################################
+## Detect dependencies
+##################################################
+
+echo "$green $bold\n Checking for dependencies [ $(date +%s) ]... \n$normal $black" " Time="$(date +%s)
+
+export package=""
+export useDpkg=0
+
+checkPackage()
+{
+ #echo "\n Looking for $package"
+ if [ $useDpkg -eq 1 ]
+ then
+ #echo "\n dpkg"
+ ret=$(dpkg -l | grep $package)
+ if [ $? -ne 0 ]
+ then
+ echo "$red$bold\nNot Found $package \n$normal $black"
+ exit 1
+ else
+ echo "$green$bold\nFound $package \n$normal $ret $black"
+ fi
+ else
+ #echo "\n version"
+ ret=$($package --version )
+ if [ $? -ne 0 ]
+ then
+ echo "--version failed"
+ ret2=$($package -version)
+ #echo $ret2
+ if [ $? -ne 0 ]
+ then
+ echo "$red $bold\nNot Found $package \n$normal $black"
+ exit 1
+ else
+ echo "$green $bold\nFound $package \n$normal $ret2 $black"
+ fi
+ else
+ echo "$green $bold\nFound $package \n$normal $ret $black"
+ fi
+ fi
+}
+
+package="gcc"; useDpkg=0; checkPackage
+package="git" ; useDpkg=0; checkPackage
+package="make"; useDpkg=0; checkPackage
+package="cmake"; useDpkg=0; checkPackage
+package="swig"; useDpkg=0; checkPackage
+package="mesa-common-dev"; useDpkg=1; checkPackage
+package="libxt-dev"; useDpkg=1; checkPackage
+package="freeglut3-dev"; useDpkg=1; checkPackage
+package="openjdk-7-jdk"; useDpkg=1; checkPackage
+#package="quilt"; useDpkg=0; checkPackage
+#package="ant"; useDpkg=0; checkPackage
+
+if [ "$targetOS" = "windows" ]
+then
+ package="gcc-mingw-w64-i686"; useDpkg=1; checkPackage
+ package="g++-mingw-w64-i686"; useDpkg=1; checkPackage
+ package="wine"; useDpkg=0; checkPackage
+fi
+
+##################################################
+## Install JDK 1.7 on wine
+##################################################
+
+
+if [ "$targetOS" = "windows" ]
+then
+ wineDir=$mypwd/.wine
+ wineJavaDir=$wineDir/drive_c/Java
+ wineJavaUrl="http://download.java.net/jdk7u6/archive/b07/binaries/jdk-7u6-ea-bin-b07-windows-i586-23_apr_2012.exe"
+ wineJavaExec="jdk-7u6-ea-bin-b07-windows-i586-23_apr_2012.exe"
+ export WINEPREFIX=$wineDir
+
+ echo "$green $bold\n Wine configuration and JDK installing ... \n$normal $black"" Time="$(date +%s)
+ # check for $wineDir presence
+ ret=$(ls "$wineDir")
+ if [ $? -ne 0 ]
+ then
+ mkdir $wineDir
+ wine cmd /C rem
+ fi
+
+ # check for jdk installation
+ ret=$(find "$wineDir" -iname java.exe)
+ if [ x$ret = x ]
+ then
+ # Install jdk
+ mkdir $wineJavaDir
+ wget $wineJavaUrl
+ wine $wineJavaExec /s /v"/qn INSTALLDIR=$wineJavaDir"
+ echo "$green $bold\nJDK-6 on wine Installed \n$normal $black" " Time="$(date +%s)
+ else
+ echo "$green $bold\nJDK-6 on wine already Installed \n$normal $black"
+ fi
+
+ # Patch to remove unnecessary classes.jsa from jdk
+ ret=$(find "$wineJavaDir" -iname classes.jsa -exec rm -f {} \;)
+
+fi
+
+##################################################
+## Get, Patch (from jCAE) and Install VTK
+## Get jCAE (installation later)
+##################################################
+
+# Define abs locations
+
+vtkURL="http://www.vtk.org/files/release/5.10/vtk-5.10.0.tar.gz"
+vtkTar="vtk-5.10.0.tar.gz"
+vtkDir=$mypwd/VTK
+vtkLinBuildDir=$mypwd/vtkLinBuild
+vtkLinInstallDir=$mypwd/vtkLinInstall
+
+#jcaeURL=https://github.com/jeromerobert/jCAE.git
+jcaeDir=$mypwd/../
+
+# Get vtk-5.10.0, unzip
+ret=$(ls $vtkTar)
+if [ $? -ne 0 ]
+then
+ wget $vtkURL
+fi
+
+ret=$(ls $vtkDir)
+if [ $? -ne 0 ]
+then
+ tar -xf $vtkTar
+fi
+
+# Get jCAE source (so early to get vtk patch)
+#ret=$(ls $jcaeDir)
+#if [ $? -ne 0 ]
+#then
+# git clone $jcaeURL
+#fi
+
+cd $jcaeDir
+export jcaeTagName=$(git describe --tags)
+
+
+# Apply patch
+# TODO: Forcibly applying patches without checking. No damage can
+# happen but it would be good to have a way to check to avoid repatching
+#cd $vtkDir
+#$jcaeDir/vtk-util/patch/5.6/apply.sh
+cd $mypwd
+
+ret=$(ls $vtkLinBuildDir)
+if [ $? -ne 0 ]
+then
+ mkdir $vtkLinBuildDir
+fi
+
+ret=$(find $vtkLinBuildDir -iname vtk.jar)
+if [ x$ret = x ]
+then
+ echo "$green $bold\n Vtk native building... \n$normal $black"" Time="$(date +%s)
+ cd $vtkLinBuildDir
+ flags="-DCMAKE_INSTALL_PREFIX:PATH=$vtkLinInstallDir"
+ flags="$flags -DBUILD_SHARED_LIBS:BOOL=ON"
+ flags="$flags -DVTK_WRAP_JAVA:BOOL=ON"
+ flags="$flags -DVTK_NO_LIBRARY_VERSION:BOOL=ON"
+ flags="$flags -DCMAKE_SKIP_RPATH:BOOL=YES"
+ cmake $flags $vtkDir
+ VERBOSE=1 make -j$makeSpeed
+ echo "$green $bold\nVtk built successfully \n$normal $black"" Time="$(date +%s)
+else
+ echo "$green $bold\nVtk already built \n$normal $black"
+fi
+
+cd $mypwd
+
+if [ "$targetOS" = "linux" ]
+then
+ ret=$(ls $vtkLinInstallDir)
+ if [ $? -ne 0 ]
+ then
+ mkdir $vtkLinInstallDir
+ fi
+
+ ret=$(find $vtkLinInstallDir -iname vtk.jar)
+ if [ x$ret = x ]
+ then
+ echo "$green $bold\nVtk installing... \n$normal $black"" Time="$(date +%s)
+ cd $vtkLinBuildDir
+ make install
+ echo "$green $bold\nVtk Installed successfully\n$normal $black"" Time="$(date +%s)
+ else
+ echo "$green $bold\nVtk already Installed \n$normal $black"
+ fi
+
+fi
+
+if [ "$targetOS" = "windows" ]
+then
+ vtkWinBuildDir=$mypwd/vtkWinBuild
+ vtkWinInstallDir=$mypwd/vtkWinInstall
+
+ # Cross build
+ ret=$(ls $vtkWinBuildDir)
+ if [ $? -ne 0 ]
+ then
+ mkdir $vtkWinBuildDir
+ fi
+
+ ret=$(find $vtkWinBuildDir -iname vtk.jar)
+ if [ x$ret = x ]
+ then
+ echo "$green $bold\nVtk ($targetOS) building... \n$normal $black"" Time="$(date +%s)
+ cd $vtkWinBuildDir
+ flags=" -DBUILD_SHARED_LIBS:BOOL=ON"
+ flags="$flags -DVTK_WRAP_JAVA:BOOL=ON"
+ flags="$flags -DBUILD_TESTING:BOOL=OFF"
+ flags="$flags -DCMAKE_SHARED_LINKER_FLAGS:STRING=-Wl,--kill-at"
+ flags="$flags -DJAVA_ARCHIVE:FILEPATH=/usr/bin/jar"
+
+ flags="$flags -DJAVA_AWT_INCLUDE_PATH:PATH=$wineJavaDir/include"
+ flags="$flags -DJAVA_AWT_LIBRARY:FILEPATH=$wineJavaDir/lib/jawt.lib"
+ flags="$flags -DJAVA_COMPILE:FILEPATH=$wineJavaDir/bin/javac.exe"
+ flags="$flags -DJAVA_INCLUDE_PATH:PATH=$wineJavaDir/include"
+ flags="$flags -DJAVA_INCLUDE_PATH2:PATH=$wineJavaDir/include/win32"
+ flags="$flags -DJAVA_JVM_LIBRARY:FILEPATH=$wineJavaDir/lib/jvm.lib"
+ flags="$flags -DJAVA_RUNTIME:FILEPATH=$wineJavaDir/bin/java.exe"
+
+ flags="$flags -DCMAKE_INSTALL_PREFIX:FILEPATH=$vtkWinInstallDir/"
+ flags="$flags -DCMAKE_TOOLCHAIN_FILE:FILEPATH=$jcaeDir/vtk-util/toolchain-i686-w64-mingw32.cmake"
+ flags="$flags -DVTKCompileTools_DIR:FILEPATH=$vtkLinBuildDir"
+ flags="$flags -DVTK_USE_64BIT_IDS:BOOL=ON"
+
+ flags="$flags -DCMAKE_CXX_FLAGS:STRING=-fpermissive"
+
+ cmake $flags $vtkDir
+ cmake $flags $vtkDir
+
+ VERBOSE=1 make -j$makeSpeed
+ echo "$green $bold\nVtk built successfully \n$normal $black"" Time="$(date +%s)
+ else
+ echo "$green $bold\nVtk already built \n$normal $black"
+ fi
+
+ ret=$(ls $vtkWinInstallDir)
+ if [ $? -ne 0 ]
+ then
+ cd $mypwd
+ mkdir $vtkWinInstallDir
+ fi
+
+ ret=$(find $vtkWinInstallDir -iname vtk.jar)
+ if [ x$ret = x ]
+ then
+ echo "$green $bold\nVtk installing... \n$normal $black"" Time="$(date +%s)
+ cd $vtkWinBuildDir
+ make install
+ echo "$green $bold\nVtk installed successfully \n$normal $black"" Time="$(date +%s)
+ else
+ echo "$green $bold\nVtk already installed \n$normal $black"
+ fi
+fi
+
+cd $mypwd
+
+
+##################################################
+## Get and Install OCE 0.9.1
+##################################################
+
+oceURL=https://github.com/tpaviot/oce.git
+oceDir=$mypwd/oce
+
+ret=$(ls $oceDir)
+if [ $? -ne 0 ]
+then
+ git clone $oceURL $oceDir
+fi
+
+ret=$(git describe | grep OCE-0.9.1)
+if [ $? -ne 0 ]
+then
+ cd $oceDir
+ git checkout OCE-0.9.1
+ cd $mypwd
+fi
+
+if [ "$targetOS" = "linux" ]
+then
+ oceLinBuildDir=$mypwd/oceLinBuild
+ oceLinInstallDir=$mypwd/oceLinInstall
+ ret=$(ls $oceLinBuildDir)
+ if [ $? -ne 0 ]
+ then
+ mkdir $oceLinBuildDir
+ fi
+
+ ret=$(find $oceLinBuildDir -iname *Tk*.so*)
+ if [ x$ret = x ]
+ then
+ echo "$green $bold\nOce building... \n$normal $black"" Time="$(date +%s)
+ cd $oceLinBuildDir
+ flags="-DOCE_INSTALL_PREFIX:PATH=$oceLinInstallDir"
+ flags="$flags -DOCE_DISABLE_BSPLINE_MESHER:BOOL=ON"
+ flags="$flags -DCMAKE_CXX_FLAGS:STRING=-DMMGT_OPT_DEFAULT=0"
+ flags="$flags -DOCE_DISABLE_X11=ON"
+ flags="$flags -DOCE_NO_LIBRARY_VERSION:BOOL=ON"
+ cmake $flags $oceDir
+ cd $mypwd
+ make -j$makeSpeed
+ echo "$green $bold\nOce built successfully \n$normal $black"" Time="$(date +%s)
+ else
+ echo "$green $bold\nOce already built \n$normal $black"
+ fi
+
+ ret=$(ls $oceLinInstallDir)
+ if [ $? -ne 0 ]
+ then
+ mkdir $oceLinInstallDir
+ fi
+
+ ret=$(find $oceLinInstallDir -iname *Tk*.so*)
+ if [ x$ret = x ]
+ then
+ echo "$green $bold\nOce installing... \n$normal $black"" Time="$(date +%s)
+ cd $oceLinBuildDir
+ make install
+ echo "$green $bold\nOce installed successfully \n$normal $black"" Time="$(date +%s)
+ else
+ echo "$green $bold\nOce already installed \n$normal $black"
+ fi
+fi
+
+if [ "$targetOS" = "windows" ]
+then
+ oceWinBuildDir=$mypwd/oceWinBuild
+ oceWinInstallDir=$mypwd/oceWinInstall
+
+ ret=$(ls $oceWinBuildDir)
+ if [ $? -ne 0 ]
+ then
+ mkdir $oceWinBuildDir
+ fi
+
+ ret=$(find $oceWinBuildDir -iname *Tk*.dll)
+ if [ x$ret = x ]
+ then
+ echo "$green $bold\nOce building... \n$normal $black"" Time="$(date +%s)
+ cd $oceWinBuildDir
+ flags="-DOCE_INSTALL_PREFIX:PATH=$oceWinInstallDir"
+ flags="$flags -DOCE_DISABLE_BSPLINE_MESHER:BOOL=ON"
+ flags="$flags -DCMAKE_CXX_FLAGS:STRING=-DMMGT_OPT_DEFAULT=0"
+ flags="$flags -DOCE_DISABLE_X11=ON"
+ flags="$flags -DJAVA_ARCHIVE:FILEPATH=/usr/bin/jar"
+ flags="$flags -DJAVA_AWT_INCLUDE_PATH:PATH=$wineJavaDir/include"
+ flags="$flags -DJAVA_AWT_LIBRARY:FILEPATH=$wineJavaDir/lib/jawt.lib"
+ flags="$flags -DJAVA_COMPILE:FILEPATH=$wineJavaDir/jre/bin/javacpl.exe"
+ flags="$flags -DJAVA_INCLUDE_PATH:PATH=$wineJavaDir/include"
+ flags="$flags -DJAVA_INCLUDE_PATH2:PATH=$wineJavaDir/include/win32"
+ flags="$flags -DJAVA_JVM_LIBRARY:FILEPATH=$wineJavaDir/lib/jvm.lib"
+ flags="$flags -DJAVA_RUNTIME:FILEPATH=$wineJavaDir/jre/bin/java.exe"
+ flags="$flags -DCMAKE_TOOLCHAIN_FILE:FILEPATH=$jcaeDir/vtk-util/toolchain-i686-w64-mingw32.cmake"
+ flags="$flags -DCMAKE_CXX_FLAGS:STRING=-fpermissive"
+ cmake $flags $oceDir
+ make -j$makeSpeed
+ echo "$green $bold\nOce built successfully \n$normal $black"" Time="$(date +%s)
+ else
+ echo "$green $bold\nOce already built \n$normal $black"
+ fi
+
+ ret=$(ls $oceWinInstallDir)
+ if [ $? -ne 0 ]
+ then
+ mkdir $oceWinInstallDir
+ fi
+
+ ret=$(find $oceWinInstallDir -iname *Tk*.dll)
+ if [ x$ret = x ]
+ then
+ echo "$green $bold\nOce installing... \n$normal $black"" Time="$(date +%s)
+ cd $oceWinBuildDir
+ make install
+ echo "$green $bold\nOce installed successfully \n$normal $black"" Time="$(date +%s)
+ else
+ echo "$green $bold\nOce already installed \n$normal $black"
+ fi
+fi
+
+cd $mypwd
+
+
+##################################################
+## PATCH # Copy libgcc_s_sjlj-1.dll libstdc++-6.dll
+##################################################
+
+if [ "$targetOS" = "windows" ]
+then
+ cp $(find /usr/lib/ -path *i686* -iname libstdc++-6.dll -or -iname libgcc_s_sjlj-1.dll ) $oceWinInstallDir/Win32/bin/
+fi
+
+##################################################
+## Get and Install JYTHON
+##################################################
+
+jythonURL=http://sourceforge.net/projects/jython/files/jython/2.5.2/jython_installer-2.5.2.jar
+jythonJar=jython_installer-2.5.2.jar
+jythonDir=$mypwd/jython
+
+echo "$green $bold\nJython installing... \n$normal $black"" Time="$(date +%s)
+
+ret=$(ls $jythonJar)
+if [ $? -ne 0 ]
+then
+ wget $jythonURL
+fi
+
+ret=$(ls $jythonDir)
+if [ $? -ne 0 ]
+then
+ $myjava -jar $jythonJar -s -d $jythonDir
+ echo "$green $bold\nJython installed successfully \n$normal $black"" Time="$(date +%s)
+else
+ echo "$green $bold\nJython already installed \n$normal $black"
+fi
+
+#Removing doc , demos
+rm -rf $jythonDir/Demo $jythonDir/Doc
+
+#Fetching jython.bat
+if [ "$targetOS" = "windows" ]
+then
+ cd $jythonDir/bin
+ wget -nc http://jython.svn.sourceforge.net/viewvc/jython/tags/Release_2_5_2/jython/src/shell/jython.bat
+ cd $mypwd
+fi
+
+##################################################
+## Get and Install VECMATH
+##################################################
+vecmathURL=http://ftp.fr.debian.org/debian/pool/main/v/vecmath/libvecmath-java_1.5.2-2_all.deb
+vecmathDebian=libvecmath-java_1.5.2-2_all.deb
+vecmathDir=$mypwd/vecmath
+
+echo "$green $bold\nVecmath installing... \n$normal $black"" Time="$(date +%s)
+
+ret=$(ls $vecmathDebian)
+if [ $? -ne 0 ]
+then
+ wget $vecmathURL
+fi
+
+ret=$(ls $vecmathDir)
+if [ $? -ne 0 ]
+then
+ dpkg-deb -x $vecmathDebian $vecmathDir
+ echo "$green $bold\nVecmath installed successfully \n$normal $black"" Time="$(date +%s)
+else
+ echo "$green $bold\nVecmath already installed \n$normal $black"
+
+fi
+
+
+##################################################
+## Get and Install TROVE
+##################################################
+troveURL=http://ftp.fr.debian.org/debian/pool/main/t/trove/libtrove-java_2.1.0-2_all.deb
+troveDebian=libtrove-java_2.1.0-2_all.deb
+troveDir=$mypwd/trove
+
+echo "$green $bold\nTrove installing... \n$normal $black"" Time="$(date +%s)
+
+ret=$(ls $troveDebian)
+if [ $? -ne 0 ]
+then
+ wget $troveURL
+fi
+
+ret=$(ls $troveDir)
+if [ $? -ne 0 ]
+then
+ dpkg-deb -x $troveDebian $troveDir
+ echo "$green $bold\nTrove installed successfully \n$normal $black"" Time="$(date +%s)
+else
+ echo "$green $bold\nTrove already installed \n$normal $black"
+fi
+
+
+##################################################
+## Get and Install Netbeans 7.1
+##################################################
+nbURL=http://dlc.sun.com.edgesuite.net/netbeans/7.1.1/final/bundles/netbeans-7.1.1-ml-javase-linux.sh
+nbEx=netbeans-7.1.1-ml-javase-linux.sh
+nbDir=$mypwd/nb
+
+echo "$green $bold\nNetbeans installing... \n$normal $black"" Time="$(date +%s)
+
+ret=$(ls $nbEx)
+if [ $? -ne 0 ]
+then
+ wget $nbURL
+ chmod a+x $nbEx
+fi
+
+ret=$(ls $nbDir)
+if [ $? -ne 0 ]
+then
+ mkdir $nbDir
+ ./$nbEx --silent "-J-Dnb-base.installation.location=$nbDir"
+ echo "$green $bold\nNetbeans installed successfully \n$normal $black"" Time="$(date +%s)
+else
+ echo "$green $bold\nNetbeans already installed \n$normal $black"
+fi
+
+##################################################
+## Define ant
+##################################################
+myant=$nbDir/java/ant/bin/ant
+
+
+##################################################
+## Get and Install XALAN
+## Get XSLs for build-impl.xml creation
+##################################################
+xalanURL=http://apache.multidist.com/xml/xalan-j/xalan-j_2_7_1-bin-2jars.tar.gz
+xalanTar=xalan-j_2_7_1-bin-2jars.tar.gz
+xalanDir=$mypwd/xalan-j_2_7_1
+
+echo "$green $bold\nXalan installing... \n$normal $black"" Time="$(date +%s)
+
+ret=$(ls $xalanTar)
+if [ $? -ne 0 ]
+then
+ wget $xalanURL
+fi
+
+ret=$(ls $xalanDir)
+if [ $? -ne 0 ]
+then
+ tar xf $xalanTar
+fi
+
+export CLASSPATH=$CLASSPATH:$xalanDir/xalan.jar
+export CLASSPATH=$CLASSPATH:$xalanDir/serializer.jar
+export CLASSPATH=$CLASSPATH:$xalanDir/xercesImpl.jar
+export CLASSPATH=$CLASSPATH:$xalanDir/xml-apis.jar
+export CLASSPATH=$CLASSPATH:$xalanDir/xsltc.jar
+
+################
+#XSLS
+################
+
+echo "$green $bold\nXLS fetching... \n$normal $black"" Time="$(date +%s)
+
+xslDir=$mypwd/xsls
+nbProjectXslURL=http://hg.netbeans.org/releases/raw-file/5dfb0137e99e/java.j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl
+nbSuiteXslURL=http://hg.netbeans.org/main/raw-file/c2719a24ed74/apisupport.ant/src/org/netbeans/modules/apisupport/project/suite/resources/build-impl.xsl
+nbModuleXslURL=http://hg.netbeans.org/main/raw-file/c2719a24ed74/apisupport.ant/src/org/netbeans/modules/apisupport/project/resources/build-impl.xsl
+nbPlatformXslURL=http://hg.netbeans.org/main/raw-file/c2719a24ed74/apisupport.ant/src/org/netbeans/modules/apisupport/project/suite/resources/platform.xsl
+
+ret=$(ls $xslDir)
+if [ $? -ne 0 ]
+then
+ mkdir $xslDir
+fi
+
+ret=$(ls -1 $xslDir | wc -l)
+if [ "$ret" != "4" ]
+then
+ ret=$(ls $xslDir/project-build-impl.xsl)
+ if [ $? -ne 0 ]
+ then
+ wget $nbProjectXslURL
+ mv build-impl.xsl $xslDir/project-build-impl.xsl
+ fi
+
+ ret=$(ls $xslDir/suite-build-impl.xsl)
+ if [ $? -ne 0 ]
+ then
+ wget $nbSuiteXslURL
+ mv build-impl.xsl $xslDir/suite-build-impl.xsl
+ fi
+
+ ret=$(ls $xslDir/module-build-impl.xsl)
+ if [ $? -ne 0 ]
+ then
+ wget $nbModuleXslURL
+ mv build-impl.xsl $xslDir/module-build-impl.xsl
+ fi
+
+ ret=$(ls $xslDir/platform.xsl)
+ if [ $? -ne 0 ]
+ then
+ wget $nbPlatformXslURL
+ mv platform.xsl $xslDir/platform.xsl
+ fi
+fi
+
+##################################################
+## jCAE INSTALLATION
+##################################################
+
+#-------------------------------------------------
+## Set envirmonment variables
+#-------------------------------------------------
+echo "$green $bold\njCAE build starts... \n$normal $black"" Time="$(date +%s)
+
+export jythonPath=$(find $jythonDir -iname jython.jar)
+export trovePath=$(find $troveDir -iname trove.jar)
+export vecmathPath=$(find $vecmathDir -iname vecmath.jar)
+export vtkPath=$(find $vtkLinBuildDir -iname vtk.jar)
+
+touch jcae.config
+echo "" > jcae.config
+
+echo "app.version=$jcaeTagName" >> jcae.config
+echo "libs.trove.classpath=$trovePath" >> jcae.config
+echo "libs.vecmath.classpath=$vecmathPath" >> jcae.config
+echo "libs.VTK.classpath=$vtkPath" >> jcae.config
+
+if [ "$targetOS" = "linux" ]
+then
+ echo "arch.linux=true" >> jcae.config
+ echo "path.occ.linux=$oceLinInstallDir/lib/" >> jcae.config # TODO: Check here why TK*.so not copied to cluster
+ echo "path.jython.linux=$jythonDir" >> jcae.config
+ echo "vtk.dir.linux=$vtkLinInstallDir/lib/vtk-5.10/" >> jcae.config
+ echo "path.occjava.linux=$mypwd/occjavaInstall/libOccJava.so" >> jcae.config
+
+ ret=$(find /usr/lib/ -iname libstdc++.so.6 | head -1)
+ echo "path.libstdc++=$ret" >> jcae.config
+
+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$oceLinInstallDir/lib/
+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$vtkLinInstallDir/lib/vtk-5.10/
+fi
+
+if [ "$targetOS" = "windows" ]
+then
+ echo "arch.win32=true" >> jcae.config
+ echo "path.occ.win32=$oceWinInstallDir/Win32/bin/" >> jcae.config
+ echo "path.jython.win32=$jythonDir" >> jcae.config
+ echo "vtk.dir.win32=$vtkWinInstallDir/bin/" >> jcae.config
+ echo "path.occjava.win32=$mypwd/occjavaBuild/OccJava.dll" >> jcae.config
+
+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$oceWinInstallDir/Win32/bin/
+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$vtkWinInstallDir/bin/
+fi
+
+
+#-------------------------------------------------
+## Clean jCAE and occjava
+#-------------------------------------------------
+# Cleaning jCAE from any previous wrong built requires
+# an extraordinary amount of checking/editing in
+# a lot of properties files.
+# TODO: One idea would be to run -
+# cd $mypwd;
+# ant -Dnbplatform.default.netbeans.dest.dir="$nbDir" -Dnbplatform.default.harness.dir="$nbDir/harness/" clean
+# Will try it in the unified script
+
+# For the time being, cleaning is done like this, as it is not as time oriented task as vtk/oce/xalan/netbeans
+#echo "$green $bold\nCleaning previous jCAE(if any)... \n$normal $black"" Time="$(date +%s)
+#rm -rf $jcaeDir
+rm -rf $mypwd/occjavaInstall
+#git clone $jcaeURL
+
+
+#-------------------------------------------------
+## Build jCAE projects (vtk-util, occjava, etc)
+#-------------------------------------------------
+
+echo "$green $bold\nBuilding OccJava... \n$normal $black"" Time="$(date +%s)
+
+## build OccJava
+occjavaDir=$jcaeDir/occjava
+occjavaBuildDir=$mypwd/occjavaBuild
+occjavaInstallDir=$mypwd/occjavaInstall/
+
+mkdir $occjavaBuildDir
+rm -rf $occjavaBuildDir/*
+
+mkdir $occjavaInstallDir
+cd $occjavaBuildDir
+
+if [ "$targetOS" = "linux" ]
+then
+ flags=""
+ flags="$flags -DSWIG_DIR=/usr/bin/"
+ flags="$flags -DSWIG_EXECUTABLE=/usr/bin/swig"
+ flags="$flags -DOCE_DIR=$oceLinInstallDir/lib/oce-0.9.1"
+
+ cmake $flags $occjavaDir
+ make
+ cp *.so* $occjavaInstallDir
+fi
+
+if [ "$targetOS" = "windows" ]
+then
+ flags=""
+ flags="$flags -DSWIG_DIR=/usr/bin/"
+ flags="$flags -DSWIG_EXECUTABLE=/usr/bin/swig"
+ flags="$flags -DOCE_DIR=$oceWinInstallDir/cmake/"
+
+ flags="$flags -DJAVA_ARCHIVE:FILEPATH=/usr/bin/jar"
+ flags="$flags -DJAVA_AWT_INCLUDE_PATH:PATH=$wineJavaDir/include"
+ flags="$flags -DJAVA_AWT_LIBRARY:FILEPATH=$wineJavaDir/lib/jawt.lib"
+ flags="$flags -DJAVA_COMPILE:FILEPATH=$wineJavaDir/jre/bin/javacpl.exe"
+ flags="$flags -DJAVA_INCLUDE_PATH:PATH=$wineJavaDir/include"
+ flags="$flags -DJAVA_INCLUDE_PATH2:PATH=$wineJavaDir/include/win32"
+ flags="$flags -DJAVA_JVM_LIBRARY:FILEPATH=$wineJavaDir/lib/jvm.lib"
+ flags="$flags -DJAVA_RUNTIME:FILEPATH=$wineJavaDir/jre/bin/java.exe"
+ flags="$flags -DCMAKE_TOOLCHAIN_FILE:FILEPATH=$jcaeDir/vtk-util/toolchain-i686-w64-mingw32.cmake"
+ flags="$flags -DCMAKE_CXX_FLAGS:STRING=-fpermissive"
+
+ cmake $flags $occjavaDir
+ make
+ cp *.dll* $occjavaInstallDir
+fi
+
+## building vtk-util
+echo "$green $bold\nBuilding vtk-util... \n$normal $black"" Time="$(date +%s)
+cd $jcaeDir/vtk-util/
+mkdir nbproject/private
+touch nbproject/private/private.properties
+cat $mypwd/jcae.config > nbproject/private/private.properties
+$myant config
+$myant clean
+#$myant -Dnbplatform.default.netbeans.dest.dir="$nbDir/" -Dnbplatform.default.harness.dir="$nbDir/harness/"
+cd $mypwd
+
+## building jcae/occjava
+echo "$green $bold\nBuilding jcae/occjava... \n$normal $black"" Time="$(date +%s)
+cd $jcaeDir/jcae/occjava
+mkdir nbproject/private
+touch nbproject/private/private.properties
+cat $mypwd/jcae.config > nbproject/private/private.properties
+$myjava org.apache.xalan.xslt.Process -IN nbproject/project.xml -XSL $xslDir/project-build-impl.xsl -OUT nbproject/build-impl.xml
+#$myant -Dnbplatform.default.netbeans.dest.dir="$nbDir/" -Dnbplatform.default.harness.dir="$nbDir/harness/" jar
+cd $mypwd
+
+## building amibe
+echo "$green $bold\nBuilding amibe... \n$normal $black"" Time="$(date +%s)
+cd $jcaeDir/amibe
+mkdir nbproject/private
+touch nbproject/private/private.properties
+cat $mypwd/jcae.config > nbproject/private/private.properties
+$myjava org.apache.xalan.xslt.Process -IN nbproject/project.xml -XSL $xslDir/project-build-impl.xsl -OUT nbproject/build-impl.xml
+#$myant -Dnbplatform.default.netbeans.dest.dir="$nbDir/" -Dnbplatform.default.harness.dir="$nbDir/harness/" -f nbbuild.xml jar
+cd $mypwd
+
+## building vtk-amibe (src location at jCAE/vtk-amibe/, DONT know why?)
+echo "$green $bold\nBuilding vtk-amibe... \n$normal $black"" Time="$(date +%s)
+cd $jcaeDir/jcae/vtk-amibe
+mkdir nbproject/private
+touch nbproject/private/private.properties
+cat $mypwd/jcae.config > nbproject/private/private.properties
+$myjava org.apache.xalan.xslt.Process -IN nbproject/project.xml -XSL $xslDir/project-build-impl.xsl -OUT nbproject/build-impl.xml
+#$myant -Dnbplatform.default.netbeans.dest.dir="$nbDir/" -Dnbplatform.default.harness.dir="$nbDir/harness/" jar
+cd $mypwd
+
+## building vtk-amibe-occ
+echo "$green $bold\nBuilding vtk-amibe-occ... \n$normal $black"" Time="$(date +%s)
+cd $jcaeDir/vtk-amibe-occ
+mkdir nbproject/private
+touch nbproject/private/private.properties
+cat $mypwd/jcae.config > nbproject/private/private.properties
+$myjava org.apache.xalan.xslt.Process -IN nbproject/project.xml -XSL $xslDir/project-build-impl.xsl -OUT nbproject/build-impl.xml
+#$myant -Dnbplatform.default.netbeans.dest.dir="$nbDir/" -Dnbplatform.default.harness.dir="$nbDir/harness/" jar
+cd $mypwd
+
+#-------------------------------------------------
+## Build jCAE modules
+#-------------------------------------------------
+
+echo "$green $bold\nGenerating buildfiles for jCAE modules... \n$normal $black"" Time="$(date +%s)
+cd $jcaeDir/jcae
+
+modules="amibe amibe-occ core jython mesh-algos occjava-nb trove tweakui vecmath vtk vtk-util"
+for module in $modules
+do
+ cd $jcaeDir/jcae/"$module"
+ $myjava org.apache.xalan.xslt.Process -IN nbproject/project.xml -XSL $xslDir/module-build-impl.xsl -OUT nbproject/build-impl.xml
+done
+
+
+#-------------------------------------------------
+## Generate platform.xml.
+#-------------------------------------------------
+
+# This is a now an automated step.
+echo "$green $bold\nGenerating platform.xml for jCAE... \n$normal $black"" Time="$(date +%s)
+cd $jcaeDir/jcae
+$myjava org.apache.xalan.xslt.Process -IN nbproject/project.xml -XSL $xslDir/platform.xsl -OUT nbproject/platform.xml
+
+#-------------------------------------------------
+## Build suite as Zip distribution
+#-------------------------------------------------
+echo "$green $bold\nBuilding jCAE suite... \n$normal $black"" Time="$(date +%s)
+mkdir nbproject/private
+touch nbproject/private/private.properties
+cat $mypwd/jcae.config > nbproject/private/private.properties
+
+mkdir vtk/nbproject/private
+cp nbproject/private/private.properties vtk/nbproject/private/
+
+mkdir vecmath/nbproject/private
+cp nbproject/private/private.properties vecmath/nbproject/private/
+
+mkdir trove/nbproject/private
+cp nbproject/private/private.properties trove/nbproject/private/
+
+if [ "$targetOS" = "linux" ]
+then
+ echo "path.jre.linux=$JAVA_HOME/jre" >> nbproject/private/private.properties
+elif [ "$targetOS" = "windows" ]
+then
+ echo "path.jre.win32=$wineJavaDir/jre" >> nbproject/private/private.properties
+fi
+
+$myjava org.apache.xalan.xslt.Process -IN ./nbproject/project.xml -XSL $xslDir/suite-build-impl.xsl -OUT nbproject/build-impl.xml
+$myant -Dnbplatform.default.netbeans.dest.dir="$nbDir" -Dnbplatform.default.harness.dir="$nbDir/harness/" build-zip
+echo "$green $bold\njCAE built successfully \n$normal $black"" Time="$(date +%s)
+cd $mypwd
+
+#-------------------------------------------------
+## Copy Zip distro to jCAE-zipped
+#-------------------------------------------------
+ret=$(ls jCAE-zipped)
+if [ $? -ne 0 ]
+then
+ mkdir jCAE-zipped
+fi
+rm jCAE-zipped/*
+mv $jcaeDir/jcae/dist/* jCAE-zipped/
+echo "$green $bold\njCAE Zipped successfully in $mypwd/jCAE-zipped \n$normal $black"" Time="$(date +%s)