Skip to content

Commit

Permalink
Option "-J-Djava.awt.headless=true" für des Batchmode ergänzt und den
Browse files Browse the repository at this point in the history
Code entsprechend angepasst und bereinigt. Dadurch sollten potentielle
Raceconditions verhindert sein.
  • Loading branch information
AndiMb committed Jan 26, 2024
1 parent 3654dae commit 36b047b
Show file tree
Hide file tree
Showing 8 changed files with 224 additions and 217 deletions.
289 changes: 149 additions & 140 deletions Core/src/de/elamx/core/GlobalProperties.java

Large diffs are not rendered by default.

109 changes: 56 additions & 53 deletions Core/src/de/elamx/core/Installer.java
Original file line number Diff line number Diff line change
@@ -1,53 +1,56 @@
/*
* This program developed in Java is based on the netbeans platform and is used
* to design and to analyse composite structures by means of analytical and
* numerical methods.
*
* Further information can be found here:
* http://www.elamx.de
*
* Copyright (C) 2021 Technische Universität Dresden - Andreas Hauffe
*
* This file is part of eLamX².
*
* eLamX² is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* eLamX² 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with eLamX². If not, see <http://www.gnu.org/licenses/>.
*/
package de.elamx.core;

import javax.swing.UIManager;
import org.openide.modules.ModuleInstall;
import org.openide.util.NbPreferences;

public class Installer extends ModuleInstall {

@Override
public void restored() {
String osName = System.getProperty("os.name").toLowerCase();
boolean isMacOs = osName.startsWith("mac os x");

System.setProperty("nb.useSwingHtmlRendering", "true");
System.setProperty("ps.quickSearch.disabled.global", "true");

if (!isMacOs) {
UIManager.put("NbMainWindow.showCustomBackground", Boolean.TRUE);
RootFrame.init();
}
}

@Override
public void validate() throws IllegalStateException {
NbPreferences.root().node("laf").put("laf", "com.formdev.flatlaf.FlatLightLaf");
super.validate(); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/OverriddenMethodBody
}
}
/*
* This program developed in Java is based on the netbeans platform and is used
* to design and to analyse composite structures by means of analytical and
* numerical methods.
*
* Further information can be found here:
* http://www.elamx.de
*
* Copyright (C) 2021 Technische Universität Dresden - Andreas Hauffe
*
* This file is part of eLamX².
*
* eLamX² is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* eLamX² 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with eLamX². If not, see <http://www.gnu.org/licenses/>.
*/
package de.elamx.core;

import java.awt.GraphicsEnvironment;
import javax.swing.UIManager;
import org.openide.modules.ModuleInstall;
import org.openide.util.NbPreferences;

public class Installer extends ModuleInstall {

@Override
public void restored() {
String osName = System.getProperty("os.name").toLowerCase();
boolean isMacOs = osName.startsWith("mac os x");
boolean headless = GraphicsEnvironment.isHeadless();
GlobalProperties.getDefault().setHeadless(headless);

System.setProperty("nb.useSwingHtmlRendering", "true");
System.setProperty("ps.quickSearch.disabled.global", "true");

if (!isMacOs && !headless) {
UIManager.put("NbMainWindow.showCustomBackground", Boolean.TRUE);
RootFrame.init();
}
}

@Override
public void validate() throws IllegalStateException {
NbPreferences.root().node("laf").put("laf", "com.formdev.flatlaf.FlatLightLaf");
super.validate(); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/OverriddenMethodBody
}
}
8 changes: 4 additions & 4 deletions File_Support/nbproject/genfiles.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
build.xml.data.CRC32=4bed86ab
build.xml.data.CRC32=8ec9ce05
build.xml.script.CRC32=de738262
build.xml.stylesheet.CRC32=15ca8a54@2.74.1
build.xml.stylesheet.CRC32=15ca8a54@2.94
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=4bed86ab
nbproject/build-impl.xml.data.CRC32=8ec9ce05
nbproject/build-impl.xml.script.CRC32=5661ff42
nbproject/build-impl.xml.stylesheet.CRC32=49aa68b0@2.74.1
nbproject/build-impl.xml.stylesheet.CRC32=49aa68b0@2.94
9 changes: 9 additions & 0 deletions File_Support/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
<code-name-base>de.elamx.filesupport</code-name-base>
<suite-component/>
<module-dependencies>
<dependency>
<code-name-base>de.elamx.core</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.7.0</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>de.elamx.laminate</code-name-base>
<build-prerequisite/>
Expand Down
4 changes: 4 additions & 0 deletions File_Support/src/de/elamx/filesupport/Installer.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@
*/
package de.elamx.filesupport;

import de.elamx.core.GlobalProperties;
import org.openide.modules.ModuleInstall;
import org.openide.windows.WindowManager;

public class Installer extends ModuleInstall {

@Override
public void restored() {
if (GlobalProperties.getDefault().isHeadless()){
return;
}
WindowManager.getDefault().invokeWhenUIReady(new Runnable() {

@Override
Expand Down
17 changes: 0 additions & 17 deletions Laminate/src/de/elamx/laminate/eLamXLookup.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,6 @@ public class eLamXLookup extends AbstractLookup implements PropertyChangeListene
private final InstanceContent content;
private boolean notifyDataObject = false;
private boolean changable = true;

/*
Dieser Flag wird dafür verwendet, dass nach einem Setzen eines FileObjects
mit einem eLamX-File, dieses nicht mehr erneut gesetzt/überschrieben werden
kann. Dies ist notwendig um im nogui-Mode zu verhindern, dass die leere
initiale eLamX-Datei gesetzt wird, nachdem die über die Kommandozeile
übergebene Datei eingelesen wurde.
*/
private boolean fileLocked = false;

private eLamXLookup() {
this(new InstanceContent());
Expand Down Expand Up @@ -137,13 +128,6 @@ protected final void firePropertyChanged(PropertyChangeEvent e) {
private DataObject dataOb;

public void setFileObject(FileObject fo) {
setFileObject(fo, false);
}

public synchronized void setFileObject(FileObject fo, boolean lockFile) {
if (fileLocked){
return;
}
if (fo != null && fo != fileObject) {
try {
notifyDataObject = false;
Expand All @@ -157,7 +141,6 @@ public synchronized void setFileObject(FileObject fo, boolean lockFile) {
dataOb = DataObject.find(fo);
firePropertyChanged(new PropertyChangeEvent(this, PROP_FILEOBJECT, null, fileObject));
notifyDataObject = true;
fileLocked = lockFile;
} catch (DataObjectNotFoundException | PropertyVetoException ex) {
Exceptions.printStackTrace(ex);
}
Expand Down
3 changes: 1 addition & 2 deletions batchrun/src/de/elamx/batchrun/eLamXOptionProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ protected void process(Env env, Map<Option, String[]> maps) throws CommandExcept
File inputFile = new File(fileName);
if (inputFile.exists() && inputFile.isFile()) {
FileObject fo = FileUtil.toFileObject(inputFile);
eLamXLookup.getDefault().setModified(false);
eLamXLookup.getDefault().setFileObject(fo, true);
eLamXLookup.getDefault().setFileObject(fo);
}
}

Expand Down
2 changes: 1 addition & 1 deletion nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ project.de.elamx.utilities=LFTUtilities
project.de.elamx.welcome=WelcomeScreen
project.org.jfree=JFreeChart
run.args.extra=-J-Xms256m -J-Xmx512m -J-Xss2m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dhttps.protocols=TLSv1.2 -J--add-opens=java.base/java.net=ALL-UNNAMED -J--add-exports=java.desktop/sun.awt=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing=ALL-UNNAMED
#run.args.extra=--nosplash --nogui -i"C:\\Users\\andre\\Documents\\NetBeansProjects\\eLamX2\\Example_Files\\batchexample1.elamx" -J-Xms256m -J-Xmx512m -J-Xss2m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dhttps.protocols=TLSv1.2 -J--add-opens=java.base/java.net=ALL-UNNAMED -J--add-exports=java.desktop/sun.awt=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing=ALL-UNNAMED
#run.args.extra=--nosplash --nogui -J-Djava.awt.headless=true -i"C:\\Users\\andre\\Documents\\NetBeansProjects\\eLamX2\\Example_Files\\batchexample1.elamx" -J-Xms256m -J-Xmx512m -J-Xss2m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dhttps.protocols=TLSv1.2 -J--add-opens=java.base/java.net=ALL-UNNAMED -J--add-exports=java.desktop/sun.awt=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing=ALL-UNNAMED
app.conf=nbproject/elamx2.conf
elamxjdk.dir=jre
elamxversion=2.7

0 comments on commit 36b047b

Please sign in to comment.