Importing Processing rev. 5503 (1.0.3).
BIN
build/windows/launcher/launch4j/src/images/asterix-o.gif
Executable file
After Width: | Height: | Size: 51 B |
BIN
build/windows/launcher/launch4j/src/images/asterix.gif
Executable file
After Width: | Height: | Size: 53 B |
BIN
build/windows/launcher/launch4j/src/images/build.png
Executable file
After Width: | Height: | Size: 1.6 KiB |
BIN
build/windows/launcher/launch4j/src/images/button_ok.png
Executable file
After Width: | Height: | Size: 883 B |
BIN
build/windows/launcher/launch4j/src/images/cancel16.png
Executable file
After Width: | Height: | Size: 1.1 KiB |
BIN
build/windows/launcher/launch4j/src/images/down16.png
Executable file
After Width: | Height: | Size: 912 B |
BIN
build/windows/launcher/launch4j/src/images/edit_add16.png
Executable file
After Width: | Height: | Size: 1.1 KiB |
BIN
build/windows/launcher/launch4j/src/images/info.png
Executable file
After Width: | Height: | Size: 1.4 KiB |
BIN
build/windows/launcher/launch4j/src/images/new.png
Executable file
After Width: | Height: | Size: 1.1 KiB |
BIN
build/windows/launcher/launch4j/src/images/new16.png
Executable file
After Width: | Height: | Size: 805 B |
BIN
build/windows/launcher/launch4j/src/images/ok16.png
Executable file
After Width: | Height: | Size: 883 B |
BIN
build/windows/launcher/launch4j/src/images/open.png
Executable file
After Width: | Height: | Size: 1.4 KiB |
BIN
build/windows/launcher/launch4j/src/images/open16.png
Executable file
After Width: | Height: | Size: 513 B |
BIN
build/windows/launcher/launch4j/src/images/run.png
Executable file
After Width: | Height: | Size: 1.1 KiB |
BIN
build/windows/launcher/launch4j/src/images/save.png
Executable file
After Width: | Height: | Size: 1.2 KiB |
BIN
build/windows/launcher/launch4j/src/images/up16.png
Executable file
After Width: | Height: | Size: 906 B |
2
build/windows/launcher/launch4j/src/launch4j.properties
Executable file
@ -0,0 +1,2 @@
|
||||
versionNumber=3.0.1.0
|
||||
version=3.0.1
|
207
build/windows/launcher/launch4j/src/net/sf/launch4j/Builder.java
Executable file
@ -0,0 +1,207 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on 2005-04-24
|
||||
*/
|
||||
package net.sf.launch4j;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import net.sf.launch4j.binding.InvariantViolationException;
|
||||
import net.sf.launch4j.config.Config;
|
||||
import net.sf.launch4j.config.ConfigPersister;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class Builder {
|
||||
private final Log _log;
|
||||
private final File _basedir;
|
||||
|
||||
public Builder(Log log) {
|
||||
_log = log;
|
||||
_basedir = Util.getJarBasedir();
|
||||
}
|
||||
|
||||
public Builder(Log log, File basedir) {
|
||||
_log = log;
|
||||
_basedir = basedir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Output file path.
|
||||
*/
|
||||
public File build() throws BuilderException {
|
||||
final Config c = ConfigPersister.getInstance().getConfig();
|
||||
try {
|
||||
c.validate();
|
||||
} catch (InvariantViolationException e) {
|
||||
throw new BuilderException(e.getMessage());
|
||||
}
|
||||
File rc = null;
|
||||
File ro = null;
|
||||
File outfile = null;
|
||||
FileInputStream is = null;
|
||||
FileOutputStream os = null;
|
||||
final RcBuilder rcb = new RcBuilder();
|
||||
try {
|
||||
rc = rcb.build(c);
|
||||
ro = Util.createTempFile("o");
|
||||
outfile = ConfigPersister.getInstance().getOutputFile();
|
||||
|
||||
Cmd resCmd = new Cmd(_basedir);
|
||||
resCmd.addExe("windres")
|
||||
.add(Util.WINDOWS_OS ? "--preprocessor=type" : "--preprocessor=cat")
|
||||
.add("-J rc -O coff -F pe-i386")
|
||||
.addAbsFile(rc)
|
||||
.addAbsFile(ro);
|
||||
_log.append(Messages.getString("Builder.compiling.resources"));
|
||||
resCmd.exec(_log);
|
||||
|
||||
Cmd ldCmd = new Cmd(_basedir);
|
||||
ldCmd.addExe("ld")
|
||||
.add("-mi386pe")
|
||||
.add("--oformat pei-i386")
|
||||
.add((c.getHeaderType().equals(Config.GUI_HEADER))
|
||||
? "--subsystem windows" : "--subsystem console")
|
||||
.add("-s") // strip symbols
|
||||
.addFiles(c.getHeaderObjects())
|
||||
.addAbsFile(ro)
|
||||
.addFiles(c.getLibs())
|
||||
.add("-o")
|
||||
.addAbsFile(outfile);
|
||||
_log.append(Messages.getString("Builder.linking"));
|
||||
ldCmd.exec(_log);
|
||||
|
||||
if (!c.isDontWrapJar()) {
|
||||
_log.append(Messages.getString("Builder.wrapping"));
|
||||
int len;
|
||||
byte[] buffer = new byte[1024];
|
||||
is = new FileInputStream(Util.getAbsoluteFile(
|
||||
ConfigPersister.getInstance().getConfigPath(), c.getJar()));
|
||||
os = new FileOutputStream(outfile, true);
|
||||
while ((len = is.read(buffer)) > 0) {
|
||||
os.write(buffer, 0, len);
|
||||
}
|
||||
}
|
||||
_log.append(Messages.getString("Builder.success") + outfile.getPath());
|
||||
return outfile;
|
||||
} catch (IOException e) {
|
||||
Util.delete(outfile);
|
||||
_log.append(e.getMessage());
|
||||
throw new BuilderException(e);
|
||||
} catch (ExecException e) {
|
||||
Util.delete(outfile);
|
||||
String msg = e.getMessage();
|
||||
if (msg != null && msg.indexOf("windres") != -1) {
|
||||
if (e.getErrLine() != -1) {
|
||||
_log.append(Messages.getString("Builder.line.has.errors",
|
||||
String.valueOf(e.getErrLine())));
|
||||
_log.append(rcb.getLine(e.getErrLine()));
|
||||
} else {
|
||||
_log.append(Messages.getString("Builder.generated.resource.file"));
|
||||
_log.append(rcb.getContent());
|
||||
}
|
||||
}
|
||||
throw new BuilderException(e);
|
||||
} finally {
|
||||
Util.close(is);
|
||||
Util.close(os);
|
||||
Util.delete(rc);
|
||||
Util.delete(ro);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Cmd {
|
||||
private final List _cmd = new ArrayList();
|
||||
private final File _basedir;
|
||||
private final File _bindir;
|
||||
|
||||
public Cmd(File basedir) {
|
||||
_basedir = basedir;
|
||||
String path = System.getProperty("launch4j.bindir");
|
||||
if (path == null) {
|
||||
_bindir = new File(basedir, "bin");
|
||||
} else {
|
||||
File bindir = new File(path);
|
||||
_bindir = bindir.isAbsolute() ? bindir : new File(basedir, path);
|
||||
}
|
||||
}
|
||||
|
||||
public Cmd add(String s) {
|
||||
StringTokenizer st = new StringTokenizer(s);
|
||||
while (st.hasMoreTokens()) {
|
||||
_cmd.add(st.nextToken());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Cmd addAbsFile(File file) {
|
||||
_cmd.add(file.getPath());
|
||||
return this;
|
||||
}
|
||||
|
||||
public Cmd addFile(String pathname) {
|
||||
_cmd.add(new File(_basedir, pathname).getPath());
|
||||
return this;
|
||||
}
|
||||
|
||||
public Cmd addExe(String pathname) {
|
||||
if (Util.WINDOWS_OS) {
|
||||
pathname += ".exe";
|
||||
}
|
||||
_cmd.add(new File(_bindir, pathname).getPath());
|
||||
return this;
|
||||
}
|
||||
|
||||
public Cmd addFiles(List files) {
|
||||
for (Iterator iter = files.iterator(); iter.hasNext();) {
|
||||
addFile((String) iter.next());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public void exec(Log log) throws ExecException {
|
||||
String[] cmd = (String[]) _cmd.toArray(new String[_cmd.size()]);
|
||||
Util.exec(cmd, log);
|
||||
}
|
||||
}
|
52
build/windows/launcher/launch4j/src/net/sf/launch4j/BuilderException.java
Executable file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on May 13, 2005
|
||||
*/
|
||||
package net.sf.launch4j;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class BuilderException extends Exception {
|
||||
public BuilderException() {}
|
||||
|
||||
public BuilderException(Throwable t) {
|
||||
super(t);
|
||||
}
|
||||
|
||||
public BuilderException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
66
build/windows/launcher/launch4j/src/net/sf/launch4j/ExecException.java
Executable file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on May 14, 2005
|
||||
*/
|
||||
package net.sf.launch4j;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class ExecException extends Exception {
|
||||
private final int _errLine;
|
||||
|
||||
public ExecException(Throwable t, int errLine) {
|
||||
super(t);
|
||||
_errLine = errLine;
|
||||
}
|
||||
|
||||
public ExecException(Throwable t) {
|
||||
this(t, -1);
|
||||
}
|
||||
|
||||
public ExecException(String msg, int errLine) {
|
||||
super(msg);
|
||||
_errLine = errLine;
|
||||
}
|
||||
|
||||
public ExecException(String msg) {
|
||||
this(msg, -1);
|
||||
}
|
||||
|
||||
public int getErrLine() {
|
||||
return _errLine;
|
||||
}
|
||||
}
|
76
build/windows/launcher/launch4j/src/net/sf/launch4j/FileChooserFilter.java
Executable file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on 2004-01-15
|
||||
*/
|
||||
package net.sf.launch4j;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2004 Grzegorz Kowal
|
||||
*/
|
||||
public class FileChooserFilter extends FileFilter {
|
||||
String _description;
|
||||
String[] _extensions;
|
||||
|
||||
public FileChooserFilter(String description, String extension) {
|
||||
_description = description;
|
||||
_extensions = new String[] {extension};
|
||||
}
|
||||
|
||||
public FileChooserFilter(String description, String[] extensions) {
|
||||
_description = description;
|
||||
_extensions = extensions;
|
||||
}
|
||||
|
||||
public boolean accept(File f) {
|
||||
if (f.isDirectory()) {
|
||||
return true;
|
||||
}
|
||||
String ext = Util.getExtension(f);
|
||||
for (int i = 0; i < _extensions.length; i++) {
|
||||
if (ext.toLowerCase().equals(_extensions[i].toLowerCase())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return _description;
|
||||
}
|
||||
}
|
105
build/windows/launcher/launch4j/src/net/sf/launch4j/Log.java
Executable file
@ -0,0 +1,105 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on May 12, 2005
|
||||
*/
|
||||
package net.sf.launch4j;
|
||||
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public abstract class Log {
|
||||
private static final Log _consoleLog = new ConsoleLog();
|
||||
private static final Log _antLog = new AntLog();
|
||||
|
||||
public abstract void clear();
|
||||
public abstract void append(String line);
|
||||
|
||||
public static Log getConsoleLog() {
|
||||
return _consoleLog;
|
||||
}
|
||||
|
||||
public static Log getAntLog() {
|
||||
return _antLog;
|
||||
}
|
||||
|
||||
public static Log getSwingLog(JTextArea textArea) {
|
||||
return new SwingLog(textArea);
|
||||
}
|
||||
}
|
||||
|
||||
class ConsoleLog extends Log {
|
||||
public void clear() {
|
||||
System.out.println("\n");
|
||||
}
|
||||
|
||||
public void append(String line) {
|
||||
System.out.println("launch4j: " + line);
|
||||
}
|
||||
}
|
||||
|
||||
class AntLog extends Log {
|
||||
public void clear() {
|
||||
System.out.println("\n");
|
||||
}
|
||||
|
||||
public void append(String line) {
|
||||
System.out.println(line);
|
||||
}
|
||||
}
|
||||
|
||||
class SwingLog extends Log {
|
||||
private final JTextArea _textArea;
|
||||
|
||||
public SwingLog(JTextArea textArea) {
|
||||
_textArea = textArea;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
_textArea.setText("");
|
||||
}});
|
||||
}
|
||||
|
||||
public void append(final String line) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
_textArea.append(line + "\n");
|
||||
}});
|
||||
}
|
||||
}
|
99
build/windows/launcher/launch4j/src/net/sf/launch4j/Main.java
Executable file
@ -0,0 +1,99 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2008 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on Apr 21, 2005
|
||||
*/
|
||||
package net.sf.launch4j;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
import net.sf.launch4j.config.ConfigPersister;
|
||||
import net.sf.launch4j.formimpl.MainFrame;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class Main {
|
||||
private static String _name;
|
||||
private static String _description;
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
Properties props = new Properties();
|
||||
InputStream in = Main.class.getClassLoader()
|
||||
.getResourceAsStream("launch4j.properties");
|
||||
props.load(in);
|
||||
in.close();
|
||||
setDescription(props);
|
||||
|
||||
if (args.length == 0) {
|
||||
ConfigPersister.getInstance().createBlank();
|
||||
MainFrame.createInstance();
|
||||
} else if (args.length == 1 && !args[0].startsWith("-")) {
|
||||
ConfigPersister.getInstance().load(new File(args[0]));
|
||||
Builder b = new Builder(Log.getConsoleLog());
|
||||
b.build();
|
||||
} else {
|
||||
System.out.println(_description
|
||||
+ Messages.getString("Main.usage")
|
||||
+ ": launch4j config.xml");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.getConsoleLog().append(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static String getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
public static String getDescription() {
|
||||
return _description;
|
||||
}
|
||||
|
||||
private static void setDescription(Properties props) {
|
||||
_name = "Launch4j " + props.getProperty("version");
|
||||
_description = _name +
|
||||
" (http://launch4j.sourceforge.net/)\n" +
|
||||
"Cross-platform Java application wrapper" +
|
||||
" for creating Windows native executables.\n\n" +
|
||||
"Copyright (C) 2004, 2008 Grzegorz Kowal\n\n" +
|
||||
"Launch4j comes with ABSOLUTELY NO WARRANTY.\n" +
|
||||
"This is free software, licensed under the BSD License.\n" +
|
||||
"This product includes software developed by the Apache Software Foundation" +
|
||||
" (http://www.apache.org/).";
|
||||
}
|
||||
}
|
78
build/windows/launcher/launch4j/src/net/sf/launch4j/Messages.java
Executable file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.sf.launch4j;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class Messages {
|
||||
private static final String BUNDLE_NAME = "net.sf.launch4j.messages";
|
||||
|
||||
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
|
||||
.getBundle(BUNDLE_NAME);
|
||||
private static final MessageFormat FORMATTER = new MessageFormat("");
|
||||
|
||||
private Messages() {
|
||||
}
|
||||
|
||||
public static String getString(String key) {
|
||||
try {
|
||||
return RESOURCE_BUNDLE.getString(key);
|
||||
} catch (MissingResourceException e) {
|
||||
return '!' + key + '!';
|
||||
}
|
||||
}
|
||||
|
||||
public static String getString(String key, String arg0) {
|
||||
return getString(key, new Object[] {arg0});
|
||||
}
|
||||
|
||||
public static String getString(String key, String arg0, String arg1) {
|
||||
return getString(key, new Object[] {arg0, arg1});
|
||||
}
|
||||
|
||||
public static String getString(String key, String arg0, String arg1, String arg2) {
|
||||
return getString(key, new Object[] {arg0, arg1, arg2});
|
||||
}
|
||||
|
||||
public static String getString(String key, Object[] args) {
|
||||
try {
|
||||
FORMATTER.applyPattern(RESOURCE_BUNDLE.getString(key));
|
||||
return FORMATTER.format(args);
|
||||
} catch (MissingResourceException e) {
|
||||
return '!' + key + '!';
|
||||
}
|
||||
}
|
||||
}
|
71
build/windows/launcher/launch4j/src/net/sf/launch4j/OptionParser.java
Executable file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on 2005-04-24
|
||||
*/
|
||||
package net.sf.launch4j;
|
||||
|
||||
//import net.sf.launch4j.config.Config;
|
||||
|
||||
//import org.apache.commons.cli.CommandLine;
|
||||
//import org.apache.commons.cli.CommandLineParser;
|
||||
//import org.apache.commons.cli.HelpFormatter;
|
||||
//import org.apache.commons.cli.Options;
|
||||
//import org.apache.commons.cli.ParseException;
|
||||
//import org.apache.commons.cli.PosixParser;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class OptionParser {
|
||||
|
||||
// private final Options _options;
|
||||
//
|
||||
// public OptionParser() {
|
||||
// _options = new Options();
|
||||
// _options.addOption("h", "header", true, "header");
|
||||
// }
|
||||
//
|
||||
// public Config parse(Config c, String[] args) throws ParseException {
|
||||
// CommandLineParser parser = new PosixParser();
|
||||
// CommandLine cl = parser.parse(_options, args);
|
||||
// c.setJar(getFile(props, Config.JAR));
|
||||
// c.setOutfile(getFile(props, Config.OUTFILE));
|
||||
// }
|
||||
//
|
||||
// public void printHelp() {
|
||||
// HelpFormatter formatter = new HelpFormatter();
|
||||
// formatter.printHelp("launch4j", _options);
|
||||
// }
|
||||
}
|
340
build/windows/launcher/launch4j/src/net/sf/launch4j/RcBuilder.java
Executable file
@ -0,0 +1,340 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on 2005-04-24
|
||||
*/
|
||||
package net.sf.launch4j;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import net.sf.launch4j.config.Config;
|
||||
import net.sf.launch4j.config.ConfigPersister;
|
||||
import net.sf.launch4j.config.Jre;
|
||||
import net.sf.launch4j.config.Msg;
|
||||
import net.sf.launch4j.config.Splash;
|
||||
import net.sf.launch4j.config.VersionInfo;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class RcBuilder {
|
||||
|
||||
// winnt.h
|
||||
public static final int LANG_NEUTRAL = 0;
|
||||
public static final int SUBLANG_NEUTRAL = 0;
|
||||
public static final int SUBLANG_DEFAULT = 1;
|
||||
public static final int SUBLANG_SYS_DEFAULT = 2;
|
||||
|
||||
// MANIFEST
|
||||
public static final int MANIFEST = 1;
|
||||
|
||||
// ICON
|
||||
public static final int APP_ICON = 1;
|
||||
|
||||
// BITMAP
|
||||
public static final int SPLASH_BITMAP = 1;
|
||||
|
||||
// RCDATA
|
||||
public static final int JRE_PATH = 1;
|
||||
public static final int JAVA_MIN_VER = 2;
|
||||
public static final int JAVA_MAX_VER = 3;
|
||||
public static final int SHOW_SPLASH = 4;
|
||||
public static final int SPLASH_WAITS_FOR_WINDOW = 5;
|
||||
public static final int SPLASH_TIMEOUT = 6;
|
||||
public static final int SPLASH_TIMEOUT_ERR = 7;
|
||||
public static final int CHDIR = 8;
|
||||
public static final int SET_PROC_NAME = 9;
|
||||
public static final int ERR_TITLE = 10;
|
||||
public static final int GUI_HEADER_STAYS_ALIVE = 11;
|
||||
public static final int JVM_OPTIONS = 12;
|
||||
public static final int CMD_LINE = 13;
|
||||
public static final int JAR = 14;
|
||||
public static final int MAIN_CLASS = 15;
|
||||
public static final int CLASSPATH = 16;
|
||||
public static final int WRAPPER = 17;
|
||||
public static final int JDK_PREFERENCE = 18;
|
||||
public static final int ENV_VARIABLES = 19;
|
||||
public static final int PRIORITY_CLASS = 20;
|
||||
public static final int DOWNLOAD_URL = 21;
|
||||
public static final int SUPPORT_URL = 22;
|
||||
public static final int MUTEX_NAME = 23;
|
||||
public static final int INSTANCE_WINDOW_TITLE = 24;
|
||||
public static final int INITIAL_HEAP_SIZE = 25;
|
||||
public static final int INITIAL_HEAP_PERCENT = 26;
|
||||
public static final int MAX_HEAP_SIZE = 27;
|
||||
public static final int MAX_HEAP_PERCENT = 28;
|
||||
|
||||
public static final int STARTUP_ERR = 101;
|
||||
public static final int BUNDLED_JRE_ERR = 102;
|
||||
public static final int JRE_VERSION_ERR = 103;
|
||||
public static final int LAUNCHER_ERR = 104;
|
||||
public static final int INSTANCE_ALREADY_EXISTS_MSG = 105;
|
||||
|
||||
private final StringBuffer _sb = new StringBuffer();
|
||||
|
||||
public String getContent() {
|
||||
return _sb.toString();
|
||||
}
|
||||
|
||||
public String getLine(int line) {
|
||||
return _sb.toString().split("\n")[line - 1];
|
||||
}
|
||||
|
||||
public File build(Config c) throws IOException {
|
||||
_sb.append("LANGUAGE ");
|
||||
_sb.append(LANG_NEUTRAL);
|
||||
_sb.append(", ");
|
||||
_sb.append(SUBLANG_DEFAULT);
|
||||
_sb.append('\n');
|
||||
addVersionInfo(c.getVersionInfo());
|
||||
addJre(c.getJre());
|
||||
addManifest(MANIFEST, c.getManifest());
|
||||
addIcon(APP_ICON, c.getIcon());
|
||||
addText(ERR_TITLE, c.getErrTitle());
|
||||
addText(DOWNLOAD_URL, c.getDownloadUrl());
|
||||
addText(SUPPORT_URL, c.getSupportUrl());
|
||||
addText(CMD_LINE, c.getCmdLine());
|
||||
addWindowsPath(CHDIR, c.getChdir());
|
||||
addText(PRIORITY_CLASS, String.valueOf(c.getPriorityClass()));
|
||||
addTrue(SET_PROC_NAME, c.isCustomProcName());
|
||||
addTrue(GUI_HEADER_STAYS_ALIVE, c.isStayAlive());
|
||||
addSplash(c.getSplash());
|
||||
addMessages(c);
|
||||
|
||||
if (c.getSingleInstance() != null) {
|
||||
addText(MUTEX_NAME, c.getSingleInstance().getMutexName());
|
||||
addText(INSTANCE_WINDOW_TITLE, c.getSingleInstance().getWindowTitle());
|
||||
}
|
||||
|
||||
if (c.getVariables() != null && !c.getVariables().isEmpty()) {
|
||||
StringBuffer vars = new StringBuffer();
|
||||
append(vars, c.getVariables(), "\t");
|
||||
addText(ENV_VARIABLES, vars.toString());
|
||||
}
|
||||
|
||||
// MAIN_CLASS / JAR
|
||||
addTrue(WRAPPER, !c.isDontWrapJar());
|
||||
if (c.getClassPath() != null) {
|
||||
addText(MAIN_CLASS, c.getClassPath().getMainClass());
|
||||
addWindowsPath(CLASSPATH, c.getClassPath().getPathsString());
|
||||
}
|
||||
if (c.isDontWrapJar() && c.getJar() != null) {
|
||||
addWindowsPath(JAR, c.getJar().getPath());
|
||||
}
|
||||
|
||||
File f = Util.createTempFile("rc");
|
||||
BufferedWriter w = new BufferedWriter(new FileWriter(f));
|
||||
w.write(_sb.toString());
|
||||
w.close();
|
||||
return f;
|
||||
}
|
||||
|
||||
private void addVersionInfo(VersionInfo v) {
|
||||
if (v == null) {
|
||||
return;
|
||||
}
|
||||
_sb.append("1 VERSIONINFO\n");
|
||||
_sb.append("FILEVERSION ");
|
||||
_sb.append(v.getFileVersion().replaceAll("\\.", ", "));
|
||||
_sb.append("\nPRODUCTVERSION ");
|
||||
_sb.append(v.getProductVersion().replaceAll("\\.", ", "));
|
||||
_sb.append("\nFILEFLAGSMASK 0\n" +
|
||||
"FILEOS 0x40000\n" +
|
||||
"FILETYPE 1\n" +
|
||||
"{\n" +
|
||||
" BLOCK \"StringFileInfo\"\n" +
|
||||
" {\n" +
|
||||
" BLOCK \"040904E4\"\n" + // English
|
||||
" {\n");
|
||||
addVerBlockValue("CompanyName", v.getCompanyName());
|
||||
addVerBlockValue("FileDescription", v.getFileDescription());
|
||||
addVerBlockValue("FileVersion", v.getTxtFileVersion());
|
||||
addVerBlockValue("InternalName", v.getInternalName());
|
||||
addVerBlockValue("LegalCopyright", v.getCopyright());
|
||||
addVerBlockValue("OriginalFilename", v.getOriginalFilename());
|
||||
addVerBlockValue("ProductName", v.getProductName());
|
||||
addVerBlockValue("ProductVersion", v.getTxtProductVersion());
|
||||
_sb.append(" }\n }\nBLOCK \"VarFileInfo\"\n{\nVALUE \"Translation\", 0x0409, 0x04E4\n}\n}");
|
||||
}
|
||||
|
||||
private void addJre(Jre jre) {
|
||||
addWindowsPath(JRE_PATH, jre.getPath());
|
||||
addText(JAVA_MIN_VER, jre.getMinVersion());
|
||||
addText(JAVA_MAX_VER, jre.getMaxVersion());
|
||||
addText(JDK_PREFERENCE, String.valueOf(jre.getJdkPreferenceIndex()));
|
||||
addInteger(INITIAL_HEAP_SIZE, jre.getInitialHeapSize());
|
||||
addInteger(INITIAL_HEAP_PERCENT, jre.getInitialHeapPercent());
|
||||
addInteger(MAX_HEAP_SIZE, jre.getMaxHeapSize());
|
||||
addInteger(MAX_HEAP_PERCENT, jre.getMaxHeapPercent());
|
||||
|
||||
StringBuffer options = new StringBuffer();
|
||||
if (jre.getOptions() != null && !jre.getOptions().isEmpty()) {
|
||||
addSpace(options);
|
||||
append(options, jre.getOptions(), " ");
|
||||
}
|
||||
addText(JVM_OPTIONS, options.toString());
|
||||
}
|
||||
|
||||
private void addSplash(Splash splash) {
|
||||
if (splash == null) {
|
||||
return;
|
||||
}
|
||||
addTrue(SHOW_SPLASH, true);
|
||||
addTrue(SPLASH_WAITS_FOR_WINDOW, splash.getWaitForWindow());
|
||||
addText(SPLASH_TIMEOUT, String.valueOf(splash.getTimeout()));
|
||||
addTrue(SPLASH_TIMEOUT_ERR, splash.isTimeoutErr());
|
||||
addBitmap(SPLASH_BITMAP, splash.getFile());
|
||||
}
|
||||
|
||||
private void addMessages(Config c) {
|
||||
Msg msg = c.getMessages();
|
||||
if (msg == null) {
|
||||
msg = new Msg();
|
||||
}
|
||||
addText(STARTUP_ERR, msg.getStartupErr());
|
||||
addText(BUNDLED_JRE_ERR, msg.getBundledJreErr());
|
||||
addText(JRE_VERSION_ERR, msg.getJreVersionErr());
|
||||
addText(LAUNCHER_ERR, msg.getLauncherErr());
|
||||
if (c.getSingleInstance() != null) {
|
||||
addText(INSTANCE_ALREADY_EXISTS_MSG, msg.getInstanceAlreadyExistsMsg());
|
||||
}
|
||||
}
|
||||
|
||||
private void append(StringBuffer sb, List list, String separator) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
sb.append(list.get(i));
|
||||
if (i < list.size() - 1) {
|
||||
sb.append(separator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addText(int id, String text) {
|
||||
if (text == null || text.equals("")) {
|
||||
return;
|
||||
}
|
||||
_sb.append(id);
|
||||
_sb.append(" RCDATA BEGIN \"");
|
||||
_sb.append(escape(text));
|
||||
_sb.append("\\0\" END\n");
|
||||
}
|
||||
|
||||
private void addTrue(int id, boolean value) {
|
||||
if (value) {
|
||||
addText(id, "true");
|
||||
}
|
||||
}
|
||||
|
||||
private void addInteger(int id, Integer value) {
|
||||
if (value != null) {
|
||||
addText(id, value.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores path in Windows format with '\' separators.
|
||||
*/
|
||||
private void addWindowsPath(int id, String path) {
|
||||
if (path == null || path.equals("")) {
|
||||
return;
|
||||
}
|
||||
_sb.append(id);
|
||||
_sb.append(" RCDATA BEGIN \"");
|
||||
_sb.append(path.replaceAll("\\\\", "\\\\\\\\")
|
||||
.replaceAll("/", "\\\\\\\\"));
|
||||
_sb.append("\\0\" END\n");
|
||||
}
|
||||
|
||||
private void addManifest(int id, File manifest) {
|
||||
if (manifest == null || manifest.getPath().equals("")) {
|
||||
return;
|
||||
}
|
||||
_sb.append(id);
|
||||
_sb.append(" 24 \"");
|
||||
_sb.append(getPath(Util.getAbsoluteFile(
|
||||
ConfigPersister.getInstance().getConfigPath(), manifest)));
|
||||
_sb.append("\"\n");
|
||||
}
|
||||
|
||||
private void addIcon(int id, File icon) {
|
||||
if (icon == null || icon.getPath().equals("")) {
|
||||
return;
|
||||
}
|
||||
_sb.append(id);
|
||||
_sb.append(" ICON DISCARDABLE \"");
|
||||
_sb.append(getPath(Util.getAbsoluteFile(
|
||||
ConfigPersister.getInstance().getConfigPath(), icon)));
|
||||
_sb.append("\"\n");
|
||||
}
|
||||
|
||||
private void addBitmap(int id, File bitmap) {
|
||||
if (bitmap == null) {
|
||||
return;
|
||||
}
|
||||
_sb.append(id);
|
||||
_sb.append(" BITMAP \"");
|
||||
_sb.append(getPath(Util.getAbsoluteFile(
|
||||
ConfigPersister.getInstance().getConfigPath(), bitmap)));
|
||||
_sb.append("\"\n");
|
||||
}
|
||||
|
||||
private String getPath(File f) {
|
||||
return f.getPath().replaceAll("\\\\", "\\\\\\\\");
|
||||
}
|
||||
|
||||
private void addSpace(StringBuffer sb) {
|
||||
int len = sb.length();
|
||||
if (len-- > 0 && sb.charAt(len) != ' ') {
|
||||
sb.append(' ');
|
||||
}
|
||||
}
|
||||
|
||||
private void addVerBlockValue(String key, String value) {
|
||||
_sb.append(" VALUE \"");
|
||||
_sb.append(key);
|
||||
_sb.append("\", \"");
|
||||
if (value != null) {
|
||||
_sb.append(escape(value));
|
||||
}
|
||||
_sb.append("\"\n");
|
||||
}
|
||||
|
||||
private String escape(String text) {
|
||||
return text.replaceAll("\"", "\"\"");
|
||||
}
|
||||
}
|
197
build/windows/launcher/launch4j/src/net/sf/launch4j/Util.java
Executable file
@ -0,0 +1,197 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on 2005-04-24
|
||||
*/
|
||||
package net.sf.launch4j;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class Util {
|
||||
public static final boolean WINDOWS_OS = System.getProperty("os.name")
|
||||
.toLowerCase().startsWith("windows");
|
||||
|
||||
private Util() {}
|
||||
|
||||
public static File createTempFile(String suffix) throws IOException {
|
||||
String tmpdir = System.getProperty("launch4j.tmpdir");
|
||||
if (tmpdir != null) {
|
||||
if (tmpdir.indexOf(' ') != -1) {
|
||||
throw new IOException(Messages.getString("Util.tmpdir"));
|
||||
}
|
||||
return File.createTempFile("launch4j", suffix, new File(tmpdir));
|
||||
} else {
|
||||
return File.createTempFile("launch4j", suffix);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the base directory of a jar file or null if the class is a standalone file.
|
||||
* @return System specific path
|
||||
*
|
||||
* Based on a patch submitted by Josh Elsasser
|
||||
*/
|
||||
public static File getJarBasedir() {
|
||||
String url = Util.class.getClassLoader()
|
||||
.getResource(Util.class.getName().replace('.', '/') + ".class")
|
||||
.getFile()
|
||||
.replaceAll("%20", " ");
|
||||
if (url.startsWith("file:")) {
|
||||
String jar = url.substring(5, url.lastIndexOf('!'));
|
||||
int x = jar.lastIndexOf('/');
|
||||
if (x == -1) {
|
||||
x = jar.lastIndexOf('\\');
|
||||
}
|
||||
String basedir = jar.substring(0, x + 1);
|
||||
return new File(basedir);
|
||||
} else {
|
||||
return new File(".");
|
||||
}
|
||||
}
|
||||
|
||||
public static File getAbsoluteFile(File basepath, File f) {
|
||||
return f.isAbsolute() ? f : new File(basepath, f.getPath());
|
||||
}
|
||||
|
||||
public static String getExtension(File f) {
|
||||
String name = f.getName();
|
||||
int x = name.lastIndexOf('.');
|
||||
if (x != -1) {
|
||||
return name.substring(x);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static void exec(String[] cmd, Log log) throws ExecException {
|
||||
BufferedReader is = null;
|
||||
try {
|
||||
if (WINDOWS_OS) {
|
||||
for (int i = 0; i < cmd.length; i++) {
|
||||
cmd[i] = cmd[i].replaceAll("/", "\\\\");
|
||||
}
|
||||
}
|
||||
Process p = Runtime.getRuntime().exec(cmd);
|
||||
is = new BufferedReader(new InputStreamReader(p.getErrorStream()));
|
||||
String line;
|
||||
int errLine = -1;
|
||||
Pattern pattern = Pattern.compile(":\\d+:");
|
||||
while ((line = is.readLine()) != null) {
|
||||
log.append(line);
|
||||
Matcher matcher = pattern.matcher(line);
|
||||
if (matcher.find()) {
|
||||
errLine = Integer.valueOf(
|
||||
line.substring(matcher.start() + 1, matcher.end() - 1))
|
||||
.intValue();
|
||||
if (line.matches("(?i).*unrecognized escape sequence")) {
|
||||
log.append(Messages.getString("Util.use.double.backslash"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
is.close();
|
||||
p.waitFor();
|
||||
if (errLine != -1) {
|
||||
throw new ExecException(Messages.getString("Util.exec.failed")
|
||||
+ ": " + cmd, errLine);
|
||||
}
|
||||
if (p.exitValue() != 0) {
|
||||
throw new ExecException(Messages.getString("Util.exec.failed")
|
||||
+ "(" + p.exitValue() + "): " + cmd);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
close(is);
|
||||
throw new ExecException(e);
|
||||
} catch (InterruptedException e) {
|
||||
close(is);
|
||||
throw new ExecException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void close(final InputStream o) {
|
||||
if (o != null) {
|
||||
try {
|
||||
o.close();
|
||||
} catch (IOException e) {
|
||||
System.err.println(e); // XXX log
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void close(final OutputStream o) {
|
||||
if (o != null) {
|
||||
try {
|
||||
o.close();
|
||||
} catch (IOException e) {
|
||||
System.err.println(e); // XXX log
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void close(final Reader o) {
|
||||
if (o != null) {
|
||||
try {
|
||||
o.close();
|
||||
} catch (IOException e) {
|
||||
System.err.println(e); // XXX log
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void close(final Writer o) {
|
||||
if (o != null) {
|
||||
try {
|
||||
o.close();
|
||||
} catch (IOException e) {
|
||||
System.err.println(e); // XXX log
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean delete(File f) {
|
||||
return (f != null) ? f.delete() : false;
|
||||
}
|
||||
}
|
61
build/windows/launcher/launch4j/src/net/sf/launch4j/ant/AntClassPath.java
Executable file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on Jul 19, 2006
|
||||
*/
|
||||
package net.sf.launch4j.ant;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.sf.launch4j.config.ClassPath;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2006 Grzegorz Kowal
|
||||
*/
|
||||
public class AntClassPath extends ClassPath {
|
||||
private final List wrappedPaths = new ArrayList();
|
||||
|
||||
public void setCp(String cp){
|
||||
wrappedPaths.add(cp);
|
||||
}
|
||||
|
||||
public void addCp(StringWrapper cp) {
|
||||
wrappedPaths.add(cp);
|
||||
}
|
||||
|
||||
public void unwrap() {
|
||||
setPaths(StringWrapper.unwrap(wrappedPaths));
|
||||
}
|
||||
}
|
129
build/windows/launcher/launch4j/src/net/sf/launch4j/ant/AntConfig.java
Executable file
@ -0,0 +1,129 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on May 24, 2005
|
||||
*/
|
||||
package net.sf.launch4j.ant;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
|
||||
import net.sf.launch4j.config.Config;
|
||||
import net.sf.launch4j.config.Msg;
|
||||
import net.sf.launch4j.config.SingleInstance;
|
||||
import net.sf.launch4j.config.Splash;
|
||||
import net.sf.launch4j.config.VersionInfo;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class AntConfig extends Config {
|
||||
private final List wrappedHeaderObjects = new ArrayList();
|
||||
private final List wrappedLibs = new ArrayList();
|
||||
private final List wrappedVariables = new ArrayList();
|
||||
|
||||
public void setJarPath(String path) {
|
||||
setJar(new File(path));
|
||||
}
|
||||
|
||||
public void addObj(StringWrapper obj) {
|
||||
wrappedHeaderObjects.add(obj);
|
||||
}
|
||||
|
||||
public void addLib(StringWrapper lib) {
|
||||
wrappedLibs.add(lib);
|
||||
}
|
||||
|
||||
public void addVar(StringWrapper var) {
|
||||
wrappedVariables.add(var);
|
||||
}
|
||||
|
||||
// __________________________________________________________________________________
|
||||
|
||||
public void addSingleInstance(SingleInstance singleInstance) {
|
||||
checkNull(getSingleInstance(), "singleInstance");
|
||||
setSingleInstance(singleInstance);
|
||||
}
|
||||
|
||||
public void addClassPath(AntClassPath classPath) {
|
||||
checkNull(getClassPath(), "classPath");
|
||||
setClassPath(classPath);
|
||||
}
|
||||
|
||||
public void addJre(AntJre jre) {
|
||||
checkNull(getJre(), "jre");
|
||||
setJre(jre);
|
||||
}
|
||||
|
||||
public void addSplash(Splash splash) {
|
||||
checkNull(getSplash(), "splash");
|
||||
setSplash(splash);
|
||||
}
|
||||
|
||||
public void addVersionInfo(VersionInfo versionInfo) {
|
||||
checkNull(getVersionInfo(), "versionInfo");
|
||||
setVersionInfo(versionInfo);
|
||||
}
|
||||
|
||||
public void addMessages(Msg messages) {
|
||||
checkNull(getMessages(), "messages");
|
||||
setMessages(messages);
|
||||
}
|
||||
|
||||
// __________________________________________________________________________________
|
||||
|
||||
public void unwrap() {
|
||||
setHeaderObjects(StringWrapper.unwrap(wrappedHeaderObjects));
|
||||
setLibs(StringWrapper.unwrap(wrappedLibs));
|
||||
setVariables(StringWrapper.unwrap(wrappedVariables));
|
||||
if (getClassPath() != null) {
|
||||
((AntClassPath) getClassPath()).unwrap();
|
||||
}
|
||||
if (getJre() != null) {
|
||||
((AntJre) getJre()).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
private void checkNull(Object o, String name) {
|
||||
if (o != null) {
|
||||
throw new BuildException(
|
||||
Messages.getString("AntConfig.duplicate.element")
|
||||
+ ": "
|
||||
+ name);
|
||||
}
|
||||
}
|
||||
}
|
69
build/windows/launcher/launch4j/src/net/sf/launch4j/ant/AntJre.java
Executable file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on Jul 18, 2006
|
||||
*/
|
||||
package net.sf.launch4j.ant;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.sf.launch4j.config.Jre;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2006 Grzegorz Kowal
|
||||
*/
|
||||
public class AntJre extends Jre {
|
||||
private final List wrappedOptions = new ArrayList();
|
||||
|
||||
public void addOpt(StringWrapper opt) {
|
||||
wrappedOptions.add(opt);
|
||||
}
|
||||
|
||||
public void unwrap() {
|
||||
setOptions(StringWrapper.unwrap(wrappedOptions));
|
||||
}
|
||||
|
||||
/**
|
||||
* For backwards compatibility.
|
||||
*/
|
||||
public void setDontUsePrivateJres(boolean dontUse) {
|
||||
if (dontUse) {
|
||||
setJdkPreference(JDK_PREFERENCE_JRE_ONLY);
|
||||
}
|
||||
else {
|
||||
setJdkPreference(JDK_PREFERENCE_PREFER_JRE);
|
||||
}
|
||||
}
|
||||
}
|
162
build/windows/launcher/launch4j/src/net/sf/launch4j/ant/Launch4jTask.java
Executable file
@ -0,0 +1,162 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on May 24, 2005
|
||||
*/
|
||||
package net.sf.launch4j.ant;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.sf.launch4j.Builder;
|
||||
import net.sf.launch4j.BuilderException;
|
||||
import net.sf.launch4j.Log;
|
||||
import net.sf.launch4j.config.Config;
|
||||
import net.sf.launch4j.config.ConfigPersister;
|
||||
import net.sf.launch4j.config.ConfigPersisterException;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Task;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class Launch4jTask extends Task {
|
||||
private File _configFile;
|
||||
private AntConfig _config;
|
||||
|
||||
// System properties
|
||||
private File tmpdir; // launch4j.tmpdir
|
||||
private File bindir; // launch4j.bindir
|
||||
|
||||
// Override configFile settings
|
||||
private File jar;
|
||||
private File outfile;
|
||||
private String fileVersion;
|
||||
private String txtFileVersion;
|
||||
private String productVersion;
|
||||
private String txtProductVersion;
|
||||
|
||||
public void execute() throws BuildException {
|
||||
try {
|
||||
if (tmpdir != null) {
|
||||
System.setProperty("launch4j.tmpdir", tmpdir.getPath());
|
||||
}
|
||||
if (bindir != null) {
|
||||
System.setProperty("launch4j.bindir", bindir.getPath());
|
||||
}
|
||||
if (_configFile != null && _config != null) {
|
||||
throw new BuildException(
|
||||
Messages.getString("Launch4jTask.specify.config"));
|
||||
} else if (_configFile != null) {
|
||||
ConfigPersister.getInstance().load(_configFile);
|
||||
Config c = ConfigPersister.getInstance().getConfig();
|
||||
if (jar != null) {
|
||||
c.setJar(jar);
|
||||
}
|
||||
if (outfile != null) {
|
||||
c.setOutfile(outfile);
|
||||
}
|
||||
if (fileVersion != null) {
|
||||
c.getVersionInfo().setFileVersion(fileVersion);
|
||||
}
|
||||
if (txtFileVersion != null) {
|
||||
c.getVersionInfo().setTxtFileVersion(txtFileVersion);
|
||||
}
|
||||
if (productVersion != null) {
|
||||
c.getVersionInfo().setProductVersion(productVersion);
|
||||
}
|
||||
if (txtProductVersion != null) {
|
||||
c.getVersionInfo().setTxtProductVersion(txtProductVersion);
|
||||
}
|
||||
} else if (_config != null) {
|
||||
_config.unwrap();
|
||||
ConfigPersister.getInstance().setAntConfig(_config,
|
||||
getProject().getBaseDir());
|
||||
} else {
|
||||
throw new BuildException(
|
||||
Messages.getString("Launch4jTask.specify.config"));
|
||||
}
|
||||
final Builder b = new Builder(Log.getAntLog());
|
||||
b.build();
|
||||
} catch (ConfigPersisterException e) {
|
||||
throw new BuildException(e);
|
||||
} catch (BuilderException e) {
|
||||
throw new BuildException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void setConfigFile(File configFile) {
|
||||
_configFile = configFile;
|
||||
}
|
||||
|
||||
public void addConfig(AntConfig config) {
|
||||
_config = config;
|
||||
}
|
||||
|
||||
public void setBindir(File bindir) {
|
||||
this.bindir = bindir;
|
||||
}
|
||||
|
||||
public void setTmpdir(File tmpdir) {
|
||||
this.tmpdir = tmpdir;
|
||||
}
|
||||
|
||||
public void setFileVersion(String fileVersion) {
|
||||
this.fileVersion = fileVersion;
|
||||
}
|
||||
|
||||
public void setJar(File jar) {
|
||||
this.jar = jar;
|
||||
}
|
||||
|
||||
public void setJarPath(String path) {
|
||||
this.jar = new File(path);
|
||||
}
|
||||
|
||||
public void setOutfile(File outfile) {
|
||||
this.outfile = outfile;
|
||||
}
|
||||
|
||||
public void setProductVersion(String productVersion) {
|
||||
this.productVersion = productVersion;
|
||||
}
|
||||
|
||||
public void setTxtFileVersion(String txtFileVersion) {
|
||||
this.txtFileVersion = txtFileVersion;
|
||||
}
|
||||
|
||||
public void setTxtProductVersion(String txtProductVersion) {
|
||||
this.txtProductVersion = txtProductVersion;
|
||||
}
|
||||
}
|
55
build/windows/launcher/launch4j/src/net/sf/launch4j/ant/Messages.java
Executable file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.sf.launch4j.ant;
|
||||
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class Messages {
|
||||
private static final String BUNDLE_NAME = "net.sf.launch4j.ant.messages";
|
||||
|
||||
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
|
||||
.getBundle(BUNDLE_NAME);
|
||||
|
||||
private Messages() {
|
||||
}
|
||||
|
||||
public static String getString(String key) {
|
||||
try {
|
||||
return RESOURCE_BUNDLE.getString(key);
|
||||
} catch (MissingResourceException e) {
|
||||
return '!' + key + '!';
|
||||
}
|
||||
}
|
||||
}
|
67
build/windows/launcher/launch4j/src/net/sf/launch4j/ant/StringWrapper.java
Executable file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on Jul 18, 2006
|
||||
*/
|
||||
package net.sf.launch4j.ant;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2006 Grzegorz Kowal
|
||||
*/
|
||||
public class StringWrapper {
|
||||
private String text;
|
||||
|
||||
public static List unwrap(List wrappers) {
|
||||
if (wrappers.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
List strings = new ArrayList(wrappers.size());
|
||||
for (Iterator iter = wrappers.iterator(); iter.hasNext();) {
|
||||
strings.add(iter.next().toString());
|
||||
}
|
||||
return strings;
|
||||
}
|
||||
|
||||
public void addText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return text;
|
||||
}
|
||||
}
|
35
build/windows/launcher/launch4j/src/net/sf/launch4j/ant/messages.properties
Executable file
@ -0,0 +1,35 @@
|
||||
#
|
||||
# Launch4j (http://launch4j.sourceforge.net/)
|
||||
# Cross-platform Java application wrapper for creating Windows native executables.
|
||||
#
|
||||
# Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the name of the Launch4j nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
Launch4jTask.specify.config=Specify configFile or config
|
||||
AntConfig.duplicate.element=Duplicate element
|
@ -0,0 +1,35 @@
|
||||
#
|
||||
# Launch4j (http://launch4j.sourceforge.net/)
|
||||
# Cross-platform Java application wrapper for creating Windows native executables.
|
||||
#
|
||||
# Copyright (c) 2004, 2007 Grzegorz Kowal, Patricio Mart<72>nez Ros
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the name of the Launch4j nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
Launch4jTask.specify.config=Specify configFile or config
|
||||
AntConfig.duplicate.element=Duplicate element
|
62
build/windows/launcher/launch4j/src/net/sf/launch4j/binding/Binding.java
Executable file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on Apr 30, 2005
|
||||
*/
|
||||
package net.sf.launch4j.binding;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public interface Binding {
|
||||
/** Used to mark components with invalid data. */
|
||||
public final static Color INVALID_COLOR = Color.PINK;
|
||||
|
||||
/** Java Bean property bound to a component */
|
||||
public String getProperty();
|
||||
/** Clear component, set it to the default value */
|
||||
public void clear(IValidatable bean);
|
||||
/** Java Bean property -> Component */
|
||||
public void put(IValidatable bean);
|
||||
/** Component -> Java Bean property */
|
||||
public void get(IValidatable bean);
|
||||
/** Mark component as valid */
|
||||
public void markValid();
|
||||
/** Mark component as invalid */
|
||||
public void markInvalid();
|
||||
/** Enable or disable the component */
|
||||
public void setEnabled(boolean enabled);
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on Apr 30, 2005
|
||||
*/
|
||||
package net.sf.launch4j.binding;
|
||||
|
||||
/**
|
||||
* Signals a runtime error, a missing property in a Java Bean for example.
|
||||
*
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class BindingException extends RuntimeException {
|
||||
public BindingException(Throwable t) {
|
||||
super(t);
|
||||
}
|
||||
|
||||
public BindingException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
317
build/windows/launcher/launch4j/src/net/sf/launch4j/binding/Bindings.java
Executable file
@ -0,0 +1,317 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on Apr 30, 2005
|
||||
*/
|
||||
package net.sf.launch4j.binding;
|
||||
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JRadioButton;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.JToggleButton;
|
||||
import javax.swing.text.JTextComponent;
|
||||
|
||||
import org.apache.commons.beanutils.PropertyUtils;
|
||||
|
||||
/**
|
||||
* Creates and handles bindings.
|
||||
*
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class Bindings implements PropertyChangeListener {
|
||||
private final Map _bindings = new HashMap();
|
||||
private final Map _optComponents = new HashMap();
|
||||
private boolean _modified = false;
|
||||
|
||||
/**
|
||||
* Used to track component modifications.
|
||||
*/
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
String prop = evt.getPropertyName();
|
||||
if ("AccessibleValue".equals(prop)
|
||||
|| "AccessibleText".equals(prop)
|
||||
|| "AccessibleVisibleData".equals(prop)) {
|
||||
_modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Any of the components modified?
|
||||
*/
|
||||
public boolean isModified() {
|
||||
return _modified;
|
||||
}
|
||||
|
||||
public Binding getBinding(String property) {
|
||||
return (Binding) _bindings.get(property);
|
||||
}
|
||||
|
||||
private void registerPropertyChangeListener(JComponent c) {
|
||||
c.getAccessibleContext().addPropertyChangeListener(this);
|
||||
}
|
||||
|
||||
private void registerPropertyChangeListener(JComponent[] cs) {
|
||||
for (int i = 0; i < cs.length; i++) {
|
||||
cs[i].getAccessibleContext().addPropertyChangeListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isPropertyNull(IValidatable bean, Binding b) {
|
||||
try {
|
||||
for (Iterator iter = _optComponents.keySet().iterator(); iter.hasNext();) {
|
||||
String property = (String) iter.next();
|
||||
if (b.getProperty().startsWith(property)) {
|
||||
return PropertyUtils.getProperty(bean, property) == null;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
throw new BindingException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables or disables all components bound to properties that begin with given prefix.
|
||||
*/
|
||||
public void setComponentsEnabled(String prefix, boolean enabled) {
|
||||
for (Iterator iter = _bindings.values().iterator(); iter.hasNext();) {
|
||||
Binding b = (Binding) iter.next();
|
||||
if (b.getProperty().startsWith(prefix)) {
|
||||
b.setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all components, set them to their default values.
|
||||
* Clears the _modified flag.
|
||||
*/
|
||||
public void clear(IValidatable bean) {
|
||||
for (Iterator iter = _optComponents.values().iterator(); iter.hasNext();) {
|
||||
((Binding) iter.next()).clear(bean);
|
||||
}
|
||||
for (Iterator iter = _bindings.values().iterator(); iter.hasNext();) {
|
||||
((Binding) iter.next()).clear(bean);
|
||||
}
|
||||
_modified = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies data from the Java Bean to the UI components.
|
||||
* Clears the _modified flag.
|
||||
*/
|
||||
public void put(IValidatable bean) {
|
||||
for (Iterator iter = _optComponents.values().iterator(); iter.hasNext();) {
|
||||
((Binding) iter.next()).put(bean);
|
||||
}
|
||||
for (Iterator iter = _bindings.values().iterator(); iter.hasNext();) {
|
||||
Binding b = (Binding) iter.next();
|
||||
if (isPropertyNull(bean, b)) {
|
||||
b.clear(null);
|
||||
} else {
|
||||
b.put(bean);
|
||||
}
|
||||
}
|
||||
_modified = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies data from UI components to the Java Bean and checks it's class invariants.
|
||||
* Clears the _modified flag.
|
||||
* @throws InvariantViolationException
|
||||
* @throws BindingException
|
||||
*/
|
||||
public void get(IValidatable bean) {
|
||||
try {
|
||||
for (Iterator iter = _optComponents.values().iterator(); iter.hasNext();) {
|
||||
((Binding) iter.next()).get(bean);
|
||||
}
|
||||
for (Iterator iter = _bindings.values().iterator(); iter.hasNext();) {
|
||||
Binding b = (Binding) iter.next();
|
||||
if (!isPropertyNull(bean, b)) {
|
||||
b.get(bean);
|
||||
}
|
||||
}
|
||||
bean.checkInvariants();
|
||||
for (Iterator iter = _optComponents.keySet().iterator(); iter.hasNext();) {
|
||||
String property = (String) iter.next();
|
||||
IValidatable component = (IValidatable) PropertyUtils.getProperty(bean,
|
||||
property);
|
||||
if (component != null) {
|
||||
component.checkInvariants();
|
||||
}
|
||||
}
|
||||
_modified = false; // XXX
|
||||
} catch (InvariantViolationException e) {
|
||||
e.setBinding(getBinding(e.getProperty()));
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new BindingException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private Bindings add(Binding b) {
|
||||
if (_bindings.containsKey(b.getProperty())) {
|
||||
throw new BindingException(Messages.getString("Bindings.duplicate.binding"));
|
||||
}
|
||||
_bindings.put(b.getProperty(), b);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an optional (nullable) Java Bean component of type clazz.
|
||||
*/
|
||||
public Bindings addOptComponent(String property, Class clazz, JToggleButton c,
|
||||
boolean enabledByDefault) {
|
||||
Binding b = new OptComponentBinding(this, property, clazz, c, enabledByDefault);
|
||||
if (_optComponents.containsKey(property)) {
|
||||
throw new BindingException(Messages.getString("Bindings.duplicate.binding"));
|
||||
}
|
||||
_optComponents.put(property, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an optional (nullable) Java Bean component of type clazz.
|
||||
*/
|
||||
public Bindings addOptComponent(String property, Class clazz, JToggleButton c) {
|
||||
return addOptComponent(property, clazz, c, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles JEditorPane, JTextArea, JTextField
|
||||
*/
|
||||
public Bindings add(String property, JTextComponent c, String defaultValue) {
|
||||
registerPropertyChangeListener(c);
|
||||
return add(new JTextComponentBinding(property, c, defaultValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles JEditorPane, JTextArea, JTextField
|
||||
*/
|
||||
public Bindings add(String property, JTextComponent c) {
|
||||
registerPropertyChangeListener(c);
|
||||
return add(new JTextComponentBinding(property, c, ""));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles JToggleButton, JCheckBox
|
||||
*/
|
||||
public Bindings add(String property, JToggleButton c, boolean defaultValue) {
|
||||
registerPropertyChangeListener(c);
|
||||
return add(new JToggleButtonBinding(property, c, defaultValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles JToggleButton, JCheckBox
|
||||
*/
|
||||
public Bindings add(String property, JToggleButton c) {
|
||||
registerPropertyChangeListener(c);
|
||||
return add(new JToggleButtonBinding(property, c, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles JRadioButton
|
||||
*/
|
||||
public Bindings add(String property, JRadioButton[] cs, int defaultValue) {
|
||||
registerPropertyChangeListener(cs);
|
||||
return add(new JRadioButtonBinding(property, cs, defaultValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles JRadioButton
|
||||
*/
|
||||
public Bindings add(String property, JRadioButton[] cs) {
|
||||
registerPropertyChangeListener(cs);
|
||||
return add(new JRadioButtonBinding(property, cs, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles JTextArea
|
||||
*/
|
||||
public Bindings add(String property, JTextArea textArea, String defaultValue) {
|
||||
registerPropertyChangeListener(textArea);
|
||||
return add(new JTextComponentBinding(property, textArea, defaultValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles JTextArea lists
|
||||
*/
|
||||
public Bindings add(String property, JTextArea textArea) {
|
||||
registerPropertyChangeListener(textArea);
|
||||
return add(new JTextAreaBinding(property, textArea));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles Optional JTextArea lists
|
||||
*/
|
||||
public Bindings add(String property, String stateProperty,
|
||||
JToggleButton button, JTextArea textArea) {
|
||||
registerPropertyChangeListener(button);
|
||||
registerPropertyChangeListener(textArea);
|
||||
return add(new OptJTextAreaBinding(property, stateProperty, button, textArea));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles JList
|
||||
*/
|
||||
public Bindings add(String property, JList list) {
|
||||
registerPropertyChangeListener(list);
|
||||
return add(new JListBinding(property, list));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles JComboBox
|
||||
*/
|
||||
public Bindings add(String property, JComboBox combo, int defaultValue) {
|
||||
registerPropertyChangeListener(combo);
|
||||
return add(new JComboBoxBinding(property, combo, defaultValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles JComboBox
|
||||
*/
|
||||
public Bindings add(String property, JComboBox combo) {
|
||||
registerPropertyChangeListener(combo);
|
||||
return add(new JComboBoxBinding(property, combo, 0));
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on 2004-01-30
|
||||
*/
|
||||
package net.sf.launch4j.binding;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2004 Grzegorz Kowal
|
||||
*/
|
||||
public interface IValidatable {
|
||||
public void checkInvariants();
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on Jun 23, 2003
|
||||
*/
|
||||
package net.sf.launch4j.binding;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2003 Grzegorz Kowal
|
||||
*/
|
||||
public class InvariantViolationException extends RuntimeException {
|
||||
private final String _property;
|
||||
private Binding _binding;
|
||||
|
||||
public InvariantViolationException(String msg) {
|
||||
super(msg);
|
||||
_property = null;
|
||||
}
|
||||
|
||||
public InvariantViolationException(String property, String msg) {
|
||||
super(msg);
|
||||
_property = property;
|
||||
}
|
||||
|
||||
public String getProperty() {
|
||||
return _property;
|
||||
}
|
||||
|
||||
public Binding getBinding() {
|
||||
return _binding;
|
||||
}
|
||||
|
||||
public void setBinding(Binding binding) {
|
||||
_binding = binding;
|
||||
}
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2007 Ian Roberts
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on May 10, 2005
|
||||
*/
|
||||
package net.sf.launch4j.binding;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.JComboBox;
|
||||
|
||||
import org.apache.commons.beanutils.PropertyUtils;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2007 Ian Roberts
|
||||
*/
|
||||
public class JComboBoxBinding implements Binding {
|
||||
private final String _property;
|
||||
private final JComboBox _combo;
|
||||
private final int _defaultValue;
|
||||
private final Color _validColor;
|
||||
|
||||
public JComboBoxBinding(String property, JComboBox combo, int defaultValue) {
|
||||
if (property == null || combo == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (property.equals("")
|
||||
|| combo.getItemCount() == 0
|
||||
|| defaultValue < 0 || defaultValue >= combo.getItemCount()) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
_property = property;
|
||||
_combo = combo;
|
||||
_defaultValue = defaultValue;
|
||||
_validColor = combo.getBackground();
|
||||
}
|
||||
|
||||
public String getProperty() {
|
||||
return _property;
|
||||
}
|
||||
|
||||
public void clear(IValidatable bean) {
|
||||
select(_defaultValue);
|
||||
}
|
||||
|
||||
public void put(IValidatable bean) {
|
||||
try {
|
||||
Integer i = (Integer) PropertyUtils.getProperty(bean, _property);
|
||||
if (i == null) {
|
||||
throw new BindingException(
|
||||
Messages.getString("JComboBoxBinding.property.null"));
|
||||
}
|
||||
select(i.intValue());
|
||||
} catch (Exception e) {
|
||||
throw new BindingException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void get(IValidatable bean) {
|
||||
try {
|
||||
PropertyUtils.setProperty(bean, _property, new Integer(_combo.getSelectedIndex()));
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
throw new BindingException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void select(int index) {
|
||||
if (index < 0 || index >= _combo.getItemCount()) {
|
||||
throw new BindingException(
|
||||
Messages.getString("JComboBoxBinding.index.out.of.bounds"));
|
||||
}
|
||||
_combo.setSelectedIndex(index);
|
||||
}
|
||||
|
||||
public void markValid() {
|
||||
_combo.setBackground(_validColor);
|
||||
_combo.requestFocusInWindow();
|
||||
}
|
||||
|
||||
public void markInvalid() {
|
||||
_combo.setBackground(Binding.INVALID_COLOR);
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
_combo.setEnabled(enabled);
|
||||
}
|
||||
}
|
118
build/windows/launcher/launch4j/src/net/sf/launch4j/binding/JListBinding.java
Executable file
@ -0,0 +1,118 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on May 1, 2006
|
||||
*/
|
||||
package net.sf.launch4j.binding;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.DefaultListModel;
|
||||
import javax.swing.JList;
|
||||
|
||||
import org.apache.commons.beanutils.PropertyUtils;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2006 Grzegorz Kowal
|
||||
*/
|
||||
public class JListBinding implements Binding {
|
||||
private final String _property;
|
||||
private final JList _list;
|
||||
private final Color _validColor;
|
||||
|
||||
public JListBinding(String property, JList list) {
|
||||
if (property == null || list == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (property.equals("")) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
_property = property;
|
||||
_list = list;
|
||||
_validColor = _list.getBackground();
|
||||
}
|
||||
|
||||
public String getProperty() {
|
||||
return _property;
|
||||
}
|
||||
|
||||
public void clear(IValidatable bean) {
|
||||
_list.setModel(new DefaultListModel());
|
||||
}
|
||||
|
||||
public void put(IValidatable bean) {
|
||||
try {
|
||||
DefaultListModel model = new DefaultListModel();
|
||||
List list = (List) PropertyUtils.getProperty(bean, _property);
|
||||
if (list != null) {
|
||||
for (Iterator iter = list.iterator(); iter.hasNext();) {
|
||||
model.addElement(iter.next());
|
||||
}
|
||||
}
|
||||
_list.setModel(model);
|
||||
} catch (Exception e) {
|
||||
throw new BindingException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void get(IValidatable bean) {
|
||||
try {
|
||||
DefaultListModel model = (DefaultListModel) _list.getModel();
|
||||
final int size = model.getSize();
|
||||
List list = new ArrayList(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
list.add(model.get(i));
|
||||
}
|
||||
PropertyUtils.setProperty(bean, _property, list);
|
||||
} catch (Exception e) {
|
||||
throw new BindingException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void markValid() {
|
||||
_list.setBackground(_validColor);
|
||||
_list.requestFocusInWindow();
|
||||
}
|
||||
|
||||
public void markInvalid() {
|
||||
_list.setBackground(Binding.INVALID_COLOR);
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
_list.setEnabled(enabled);
|
||||
}
|
||||
}
|
@ -0,0 +1,146 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on May 10, 2005
|
||||
*/
|
||||
package net.sf.launch4j.binding;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.JRadioButton;
|
||||
|
||||
import org.apache.commons.beanutils.PropertyUtils;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class JRadioButtonBinding implements Binding {
|
||||
private final String _property;
|
||||
private final JRadioButton[] _buttons;
|
||||
private final int _defaultValue;
|
||||
private final Color _validColor;
|
||||
|
||||
public JRadioButtonBinding(String property, JRadioButton[] buttons, int defaultValue) {
|
||||
if (property == null || buttons == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
for (int i = 0; i < buttons.length; i++) {
|
||||
if (buttons[i] == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
}
|
||||
if (property.equals("")
|
||||
|| buttons.length == 0
|
||||
|| defaultValue < 0 || defaultValue >= buttons.length) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
_property = property;
|
||||
_buttons = buttons;
|
||||
_defaultValue = defaultValue;
|
||||
_validColor = buttons[0].getBackground();
|
||||
}
|
||||
|
||||
public String getProperty() {
|
||||
return _property;
|
||||
}
|
||||
|
||||
public void clear(IValidatable bean) {
|
||||
select(_defaultValue);
|
||||
}
|
||||
|
||||
public void put(IValidatable bean) {
|
||||
try {
|
||||
Integer i = (Integer) PropertyUtils.getProperty(bean, _property);
|
||||
if (i == null) {
|
||||
throw new BindingException(
|
||||
Messages.getString("JRadioButtonBinding.property.null"));
|
||||
}
|
||||
select(i.intValue());
|
||||
} catch (Exception e) {
|
||||
throw new BindingException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void get(IValidatable bean) {
|
||||
try {
|
||||
for (int i = 0; i < _buttons.length; i++) {
|
||||
if (_buttons[i].isSelected()) {
|
||||
PropertyUtils.setProperty(bean, _property, new Integer(i));
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new BindingException(
|
||||
Messages.getString("JRadioButtonBinding.nothing.selected"));
|
||||
} catch (Exception e) {
|
||||
throw new BindingException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void select(int index) {
|
||||
if (index < 0 || index >= _buttons.length) {
|
||||
throw new BindingException(
|
||||
Messages.getString("JRadioButtonBinding.index.out.of.bounds"));
|
||||
}
|
||||
_buttons[index].setSelected(true);
|
||||
}
|
||||
|
||||
public void markValid() {
|
||||
for (int i = 0; i < _buttons.length; i++) {
|
||||
if (_buttons[i].isSelected()) {
|
||||
_buttons[i].setBackground(_validColor);
|
||||
_buttons[i].requestFocusInWindow();
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new BindingException(
|
||||
Messages.getString("JRadioButtonBinding.nothing.selected"));
|
||||
}
|
||||
|
||||
public void markInvalid() {
|
||||
for (int i = 0; i < _buttons.length; i++) {
|
||||
if (_buttons[i].isSelected()) {
|
||||
_buttons[i].setBackground(Binding.INVALID_COLOR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new BindingException(
|
||||
Messages.getString("JRadioButtonBinding.nothing.selected"));
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
for (int i = 0; i < _buttons.length; i++) {
|
||||
_buttons[i].setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,123 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on Jun 14, 2006
|
||||
*/
|
||||
package net.sf.launch4j.binding;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JTextArea;
|
||||
|
||||
import org.apache.commons.beanutils.PropertyUtils;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2006 Grzegorz Kowal
|
||||
*/
|
||||
public class JTextAreaBinding implements Binding {
|
||||
private final String _property;
|
||||
private final JTextArea _textArea;
|
||||
private final Color _validColor;
|
||||
|
||||
public JTextAreaBinding(String property, JTextArea textArea) {
|
||||
if (property == null || textArea == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (property.equals("")) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
_property = property;
|
||||
_textArea = textArea;
|
||||
_validColor = _textArea.getBackground();
|
||||
}
|
||||
|
||||
public String getProperty() {
|
||||
return _property;
|
||||
}
|
||||
|
||||
public void clear(IValidatable bean) {
|
||||
put(bean);
|
||||
}
|
||||
|
||||
public void put(IValidatable bean) {
|
||||
try {
|
||||
List list = (List) PropertyUtils.getProperty(bean, _property);
|
||||
StringBuffer sb = new StringBuffer();
|
||||
if (list != null) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
sb.append(list.get(i));
|
||||
if (i < list.size() - 1) {
|
||||
sb.append("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
_textArea.setText(sb.toString());
|
||||
} catch (Exception e) {
|
||||
throw new BindingException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void get(IValidatable bean) {
|
||||
try {
|
||||
String text = _textArea.getText();
|
||||
if (!text.equals("")) {
|
||||
String[] items = text.split("\n");
|
||||
List list = new ArrayList();
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
list.add(items[i]);
|
||||
}
|
||||
PropertyUtils.setProperty(bean, _property, list);
|
||||
} else {
|
||||
PropertyUtils.setProperty(bean, _property, null);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BindingException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void markValid() {
|
||||
_textArea.setBackground(_validColor);
|
||||
_textArea.requestFocusInWindow();
|
||||
}
|
||||
|
||||
public void markInvalid() {
|
||||
_textArea.setBackground(Binding.INVALID_COLOR);
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
_textArea.setEnabled(enabled);
|
||||
}
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on Apr 30, 2005
|
||||
*/
|
||||
package net.sf.launch4j.binding;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.text.JTextComponent;
|
||||
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
|
||||
/**
|
||||
* Handles JEditorPane, JTextArea, JTextField
|
||||
*
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class JTextComponentBinding implements Binding {
|
||||
private final String _property;
|
||||
private final JTextComponent _textComponent;
|
||||
private final String _defaultValue;
|
||||
private final Color _validColor;
|
||||
|
||||
public JTextComponentBinding(String property, JTextComponent textComponent,
|
||||
String defaultValue) {
|
||||
if (property == null || textComponent == null || defaultValue == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (property.equals("")) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
_property = property;
|
||||
_textComponent = textComponent;
|
||||
_defaultValue = defaultValue;
|
||||
_validColor = _textComponent.getBackground();
|
||||
}
|
||||
|
||||
public String getProperty() {
|
||||
return _property;
|
||||
}
|
||||
|
||||
public void clear(IValidatable bean) {
|
||||
_textComponent.setText(_defaultValue);
|
||||
}
|
||||
|
||||
public void put(IValidatable bean) {
|
||||
try {
|
||||
String s = BeanUtils.getProperty(bean, _property);
|
||||
// XXX displays zeros as blank
|
||||
_textComponent.setText(s != null && !s.equals("0") ? s : "");
|
||||
} catch (Exception e) {
|
||||
throw new BindingException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void get(IValidatable bean) {
|
||||
try {
|
||||
BeanUtils.setProperty(bean, _property, _textComponent.getText());
|
||||
} catch (Exception e) {
|
||||
throw new BindingException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void markValid() {
|
||||
_textComponent.setBackground(_validColor);
|
||||
_textComponent.requestFocusInWindow();
|
||||
}
|
||||
|
||||
public void markInvalid() {
|
||||
_textComponent.setBackground(Binding.INVALID_COLOR);
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
_textComponent.setEnabled(enabled);
|
||||
}
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on Apr 30, 2005
|
||||
*/
|
||||
package net.sf.launch4j.binding;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.JToggleButton;
|
||||
|
||||
import org.apache.commons.beanutils.PropertyUtils;
|
||||
|
||||
/**
|
||||
* Handles JToggleButton, JCheckBox
|
||||
*
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class JToggleButtonBinding implements Binding {
|
||||
private final String _property;
|
||||
private final JToggleButton _button;
|
||||
private final boolean _defaultValue;
|
||||
private final Color _validColor;
|
||||
|
||||
public JToggleButtonBinding(String property, JToggleButton button,
|
||||
boolean defaultValue) {
|
||||
if (property == null || button == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (property.equals("")) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
_property = property;
|
||||
_button = button;
|
||||
_defaultValue = defaultValue;
|
||||
_validColor = _button.getBackground();
|
||||
}
|
||||
|
||||
public String getProperty() {
|
||||
return _property;
|
||||
}
|
||||
|
||||
public void clear(IValidatable bean) {
|
||||
_button.setSelected(_defaultValue);
|
||||
}
|
||||
|
||||
public void put(IValidatable bean) {
|
||||
try {
|
||||
Boolean b = (Boolean) PropertyUtils.getProperty(bean, _property);
|
||||
_button.setSelected(b != null && b.booleanValue());
|
||||
} catch (Exception e) {
|
||||
throw new BindingException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void get(IValidatable bean) {
|
||||
try {
|
||||
PropertyUtils.setProperty(bean, _property,
|
||||
Boolean.valueOf(_button.isSelected()));
|
||||
} catch (Exception e) {
|
||||
throw new BindingException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void markValid() {
|
||||
_button.setBackground(_validColor);
|
||||
_button.requestFocusInWindow();
|
||||
}
|
||||
|
||||
public void markInvalid() {
|
||||
_button.setBackground(Binding.INVALID_COLOR);
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
_button.setEnabled(enabled);
|
||||
}
|
||||
}
|
78
build/windows/launcher/launch4j/src/net/sf/launch4j/binding/Messages.java
Executable file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.sf.launch4j.binding;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class Messages {
|
||||
private static final String BUNDLE_NAME = "net.sf.launch4j.binding.messages";
|
||||
|
||||
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
|
||||
.getBundle(BUNDLE_NAME);
|
||||
private static final MessageFormat FORMATTER = new MessageFormat("");
|
||||
|
||||
private Messages() {
|
||||
}
|
||||
|
||||
public static String getString(String key) {
|
||||
try {
|
||||
return RESOURCE_BUNDLE.getString(key);
|
||||
} catch (MissingResourceException e) {
|
||||
return '!' + key + '!';
|
||||
}
|
||||
}
|
||||
|
||||
public static String getString(String key, String arg0) {
|
||||
return getString(key, new Object[] {arg0});
|
||||
}
|
||||
|
||||
public static String getString(String key, String arg0, String arg1) {
|
||||
return getString(key, new Object[] {arg0, arg1});
|
||||
}
|
||||
|
||||
public static String getString(String key, String arg0, String arg1, String arg2) {
|
||||
return getString(key, new Object[] {arg0, arg1, arg2});
|
||||
}
|
||||
|
||||
public static String getString(String key, Object[] args) {
|
||||
try {
|
||||
FORMATTER.applyPattern(RESOURCE_BUNDLE.getString(key));
|
||||
return FORMATTER.format(args);
|
||||
} catch (MissingResourceException e) {
|
||||
return '!' + key + '!';
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on May 11, 2005
|
||||
*/
|
||||
package net.sf.launch4j.binding;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.swing.JToggleButton;
|
||||
|
||||
import org.apache.commons.beanutils.PropertyUtils;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class OptComponentBinding implements Binding, ActionListener {
|
||||
private final Bindings _bindings;
|
||||
private final String _property;
|
||||
private final Class _clazz;
|
||||
private final JToggleButton _button;
|
||||
private final boolean _enabledByDefault;
|
||||
|
||||
public OptComponentBinding(Bindings bindings, String property, Class clazz,
|
||||
JToggleButton button, boolean enabledByDefault) {
|
||||
if (property == null || clazz == null || button == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (property.equals("")) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (!Arrays.asList(clazz.getInterfaces()).contains(IValidatable.class)) {
|
||||
throw new IllegalArgumentException(
|
||||
Messages.getString("OptComponentBinding.must.implement")
|
||||
+ IValidatable.class);
|
||||
}
|
||||
_bindings = bindings;
|
||||
_property = property;
|
||||
_clazz = clazz;
|
||||
_button = button;
|
||||
_button.addActionListener(this);
|
||||
_enabledByDefault = enabledByDefault;
|
||||
}
|
||||
|
||||
public String getProperty() {
|
||||
return _property;
|
||||
}
|
||||
|
||||
public void clear(IValidatable bean) {
|
||||
_button.setSelected(_enabledByDefault);
|
||||
updateComponents();
|
||||
}
|
||||
|
||||
public void put(IValidatable bean) {
|
||||
try {
|
||||
Object component = PropertyUtils.getProperty(bean, _property);
|
||||
_button.setSelected(component != null);
|
||||
updateComponents();
|
||||
} catch (Exception e) {
|
||||
throw new BindingException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void get(IValidatable bean) {
|
||||
try {
|
||||
PropertyUtils.setProperty(bean, _property, _button.isSelected()
|
||||
? _clazz.newInstance() : null);
|
||||
} catch (Exception e) {
|
||||
throw new BindingException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void markValid() {}
|
||||
|
||||
public void markInvalid() {}
|
||||
|
||||
public void setEnabled(boolean enabled) {} // XXX implement?
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
updateComponents();
|
||||
}
|
||||
|
||||
private void updateComponents() {
|
||||
_bindings.setComponentsEnabled(_property, _button.isSelected());
|
||||
}
|
||||
}
|
@ -0,0 +1,141 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on Sep 3, 2005
|
||||
*/
|
||||
package net.sf.launch4j.binding;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.JToggleButton;
|
||||
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.apache.commons.beanutils.PropertyUtils;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class OptJTextAreaBinding implements Binding, ActionListener {
|
||||
private final String _property;
|
||||
private final String _stateProperty;
|
||||
private final JToggleButton _button;
|
||||
private final JTextArea _textArea;
|
||||
private final Color _validColor;
|
||||
|
||||
public OptJTextAreaBinding(String property, String stateProperty,
|
||||
JToggleButton button, JTextArea textArea) {
|
||||
if (property == null || button == null || textArea == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (property.equals("")) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
_property = property;
|
||||
_stateProperty = stateProperty;
|
||||
_button = button;
|
||||
_textArea = textArea;
|
||||
_validColor = _textArea.getBackground();
|
||||
button.addActionListener(this);
|
||||
}
|
||||
|
||||
public String getProperty() {
|
||||
return _property;
|
||||
}
|
||||
|
||||
public void clear(IValidatable bean) {
|
||||
put(bean);
|
||||
}
|
||||
|
||||
public void put(IValidatable bean) {
|
||||
try {
|
||||
boolean selected = "true".equals(BeanUtils.getProperty(bean,
|
||||
_stateProperty));
|
||||
_button.setSelected(selected);
|
||||
_textArea.setEnabled(selected);
|
||||
List list = (List) PropertyUtils.getProperty(bean, _property);
|
||||
StringBuffer sb = new StringBuffer();
|
||||
if (list != null) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
sb.append(list.get(i));
|
||||
if (i < list.size() - 1) {
|
||||
sb.append("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
_textArea.setText(sb.toString());
|
||||
} catch (Exception e) {
|
||||
throw new BindingException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void get(IValidatable bean) {
|
||||
try {
|
||||
String text = _textArea.getText();
|
||||
if (_button.isSelected() && !text.equals("")) {
|
||||
String[] items = text.split("\n");
|
||||
List list = new ArrayList();
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
list.add(items[i]);
|
||||
}
|
||||
PropertyUtils.setProperty(bean, _property, list);
|
||||
} else {
|
||||
PropertyUtils.setProperty(bean, _property, null);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BindingException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void markValid() {
|
||||
_textArea.setBackground(_validColor);
|
||||
_textArea.requestFocusInWindow();
|
||||
}
|
||||
|
||||
public void markInvalid() {
|
||||
_textArea.setBackground(Binding.INVALID_COLOR);
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
_textArea.setEnabled(enabled);
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
_textArea.setEnabled(_button.isSelected());
|
||||
}
|
||||
}
|
259
build/windows/launcher/launch4j/src/net/sf/launch4j/binding/Validator.java
Executable file
@ -0,0 +1,259 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on 2004-01-30
|
||||
*/
|
||||
package net.sf.launch4j.binding;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.sf.launch4j.Util;
|
||||
import net.sf.launch4j.config.ConfigPersister;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2004 Grzegorz Kowal
|
||||
*/
|
||||
public class Validator {
|
||||
public static final String ALPHANUMERIC_PATTERN = "[\\w]*?";
|
||||
public static final String ALPHA_PATTERN = "[\\w&&\\D]*?";
|
||||
public static final String NUMERIC_PATTERN = "[\\d]*?";
|
||||
public static final String PATH_PATTERN = "[\\w|[ .,:\\-/\\\\]]*?";
|
||||
|
||||
public static final int MAX_STR = 128;
|
||||
public static final int MAX_PATH = 260;
|
||||
public static final int MAX_BIG_STR = 8192; // or 16384;
|
||||
public static final int MAX_ARGS = 32767 - 2048;
|
||||
|
||||
private Validator() {}
|
||||
|
||||
public static boolean isEmpty(String s) {
|
||||
return s == null || s.equals("");
|
||||
}
|
||||
|
||||
public static void checkNotNull(Object o, String property, String name) {
|
||||
if (o == null) {
|
||||
signalViolation(property,
|
||||
Messages.getString("Validator.empty.field", name));
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkString(String s, int maxLength, String property,
|
||||
String name) {
|
||||
if (s == null || s.length() == 0) {
|
||||
signalViolation(property,
|
||||
Messages.getString("Validator.empty.field", name));
|
||||
}
|
||||
if (s.length() > maxLength) {
|
||||
signalLengthViolation(property, name, maxLength);
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkOptStrings(List strings, int maxLength, int totalMaxLength,
|
||||
String property, String name) {
|
||||
if (strings == null) {
|
||||
return;
|
||||
}
|
||||
int totalLength = 0;
|
||||
for (Iterator iter = strings.iterator(); iter.hasNext();) {
|
||||
String s = (String) iter.next();
|
||||
checkString(s, maxLength, property, name);
|
||||
totalLength += s.length();
|
||||
if (totalLength > totalMaxLength) {
|
||||
signalLengthViolation(property, name, totalMaxLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkString(String s, int maxLength, String pattern,
|
||||
String property, String name) {
|
||||
checkString(s, maxLength, property, name);
|
||||
if (!s.matches(pattern)) {
|
||||
signalViolation(property,
|
||||
Messages.getString("Validator.invalid.data", name));
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkOptStrings(List strings, int maxLength, int totalMaxLength,
|
||||
String pattern, String property, String name, String msg) {
|
||||
if (strings == null) {
|
||||
return;
|
||||
}
|
||||
int totalLength = 0;
|
||||
for (Iterator iter = strings.iterator(); iter.hasNext();) {
|
||||
String s = (String) iter.next();
|
||||
checkString(s, maxLength, property, name);
|
||||
if (!s.matches(pattern)) {
|
||||
signalViolation(property, msg != null
|
||||
? msg
|
||||
: Messages.getString("Validator.invalid.data", name));
|
||||
}
|
||||
totalLength += s.length();
|
||||
if (totalLength > totalMaxLength) {
|
||||
signalLengthViolation(property, name, totalMaxLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkOptString(String s, int maxLength, String property,
|
||||
String name) {
|
||||
if (s == null || s.length() == 0) {
|
||||
return;
|
||||
}
|
||||
if (s.length() > maxLength) {
|
||||
signalLengthViolation(property, name, maxLength);
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkOptString(String s, int maxLength, String pattern,
|
||||
String property, String name) {
|
||||
if (s == null || s.length() == 0) {
|
||||
return;
|
||||
}
|
||||
if (s.length() > maxLength) {
|
||||
signalLengthViolation(property, name, maxLength);
|
||||
}
|
||||
if (!s.matches(pattern)) {
|
||||
signalViolation(property,
|
||||
Messages.getString("Validator.invalid.data", name));
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkRange(int value, int min, int max,
|
||||
String property, String name) {
|
||||
if (value < min || value > max) {
|
||||
signalViolation(property,
|
||||
Messages.getString("Validator.must.be.in.range", name,
|
||||
String.valueOf(min), String.valueOf(max)));
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkRange(char value, char min, char max,
|
||||
String property, String name) {
|
||||
if (value < min || value > max) {
|
||||
signalViolation(property, Messages.getString("Validator.must.be.in.range",
|
||||
name, String.valueOf(min), String.valueOf(max)));
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkMin(int value, int min, String property, String name) {
|
||||
if (value < min) {
|
||||
signalViolation(property,
|
||||
Messages.getString("Validator.must.be.at.least", name,
|
||||
String.valueOf(min)));
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkIn(String s, String[] strings, String property,
|
||||
String name) {
|
||||
if (isEmpty(s)) {
|
||||
signalViolation(property,
|
||||
Messages.getString("Validator.empty.field", name));
|
||||
}
|
||||
List list = Arrays.asList(strings);
|
||||
if (!list.contains(s)) {
|
||||
signalViolation(property,
|
||||
Messages.getString("Validator.invalid.option", name, list.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkTrue(boolean condition, String property, String msg) {
|
||||
if (!condition) {
|
||||
signalViolation(property, msg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkFalse(boolean condition, String property, String msg) {
|
||||
if (condition) {
|
||||
signalViolation(property, msg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkElementsNotNullUnique(Collection c, String property,
|
||||
String msg) {
|
||||
if (c.contains(null)
|
||||
|| new HashSet(c).size() != c.size()) {
|
||||
signalViolation(property,
|
||||
Messages.getString("Validator.already.exists", msg));
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkElementsUnique(Collection c, String property, String msg) {
|
||||
if (new HashSet(c).size() != c.size()) {
|
||||
signalViolation(property,
|
||||
Messages.getString("Validator.already.exists", msg));
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkFile(File f, String property, String fileDescription) {
|
||||
File cfgPath = ConfigPersister.getInstance().getConfigPath();
|
||||
if (f == null
|
||||
|| f.getPath().equals("")
|
||||
|| (!f.exists() && !Util.getAbsoluteFile(cfgPath, f).exists())) {
|
||||
signalViolation(property,
|
||||
Messages.getString("Validator.doesnt.exist", fileDescription));
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkOptFile(File f, String property, String fileDescription) {
|
||||
if (f != null && f.getPath().length() > 0) {
|
||||
checkFile(f, property, fileDescription);
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkRelativeWinPath(String path, String property, String msg) {
|
||||
if (path == null
|
||||
|| path.equals("")
|
||||
|| path.startsWith("/")
|
||||
|| path.startsWith("\\")
|
||||
|| path.indexOf(':') != -1) {
|
||||
signalViolation(property, msg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void signalLengthViolation(String property, String name,
|
||||
int maxLength) {
|
||||
signalViolation(property,
|
||||
Messages.getString("Validator.exceeds.max.length", name,
|
||||
String.valueOf(maxLength)));
|
||||
}
|
||||
|
||||
public static void signalViolation(String property, String msg) {
|
||||
throw new InvariantViolationException(property, msg);
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
#
|
||||
# Launch4j (http://launch4j.sourceforge.net/)
|
||||
# Cross-platform Java application wrapper for creating Windows native executables.
|
||||
#
|
||||
# Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the name of the Launch4j nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
OptComponentBinding.must.implement=Optional component must implement
|
||||
|
||||
Validator.empty.field=Enter: {0}
|
||||
Validator.invalid.data=Invalid data: {0}
|
||||
Validator.must.be.in.range={0} must be in range [{1}-{2}]
|
||||
Validator.must.be.at.least={0} must be at least
|
||||
Validator.already.exists={0} already exists.
|
||||
Validator.doesnt.exist={0} doesn''t exist.
|
||||
Validator.exceeds.max.length={0} exceeds the maximum length of {1} characters.
|
||||
Validator.invalid.option={0} must be one of [{1}]
|
||||
|
||||
Bindings.duplicate.binding=Duplicate binding
|
||||
|
||||
JRadioButtonBinding.property.null=Property is null
|
||||
JRadioButtonBinding.nothing.selected=Nothing selected
|
||||
JRadioButtonBinding.index.out.of.bounds=Button index out of bounds
|
||||
|
||||
JComboBoxBinding.property.null=Property is null
|
||||
JComboBoxBinding.index.out.of.bounds=Combo box index out of bounds
|
@ -0,0 +1,51 @@
|
||||
#
|
||||
# Launch4j (http://launch4j.sourceforge.net/)
|
||||
# Cross-platform Java application wrapper for creating Windows native executables.
|
||||
#
|
||||
# Copyright (c) 2004, 2007 Grzegorz Kowal, Patricio Mart<72>nez Ros
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the name of the Launch4j nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
OptComponentBinding.must.implement=El componente opcional debe ser implementado
|
||||
|
||||
Validator.empty.field=Introduzca: {0}
|
||||
Validator.invalid.data=Dato no v<>lido: {0}
|
||||
Validator.must.be.in.range={0} debe estar en el rango [{1}-{2}]
|
||||
Validator.must.be.at.least={0} deb ser al menos
|
||||
Validator.already.exists={0} ya existe.
|
||||
Validator.doesnt.exist={0} no existe.
|
||||
Validator.exceeds.max.length={0} excede la longitud m<>xima de {1} caracteres.
|
||||
Validator.invalid.option={0} must be one of [{1}]
|
||||
|
||||
Bindings.duplicate.binding=Binding duplicado
|
||||
|
||||
JRadioButtonBinding.property.null=La propiedad es nula
|
||||
JRadioButtonBinding.nothing.selected=Nada seleccionado
|
||||
JRadioButtonBinding.index.out.of.bounds=<EFBFBD>ndice de bot<6F>n fuera de l<>mite
|
||||
JComboBoxBinding.property.null=Property is null
|
||||
JComboBoxBinding.index.out.of.bounds=Combo box index out of bounds
|
87
build/windows/launcher/launch4j/src/net/sf/launch4j/config/ClassPath.java
Executable file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on May 1, 2006
|
||||
*/
|
||||
package net.sf.launch4j.config;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.sf.launch4j.binding.IValidatable;
|
||||
import net.sf.launch4j.binding.Validator;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2006 Grzegorz Kowal
|
||||
*/
|
||||
public class ClassPath implements IValidatable {
|
||||
private String mainClass;
|
||||
private List paths;
|
||||
|
||||
public void checkInvariants() {
|
||||
Validator.checkString(mainClass, Validator.MAX_PATH, "mainClass",
|
||||
Messages.getString("ClassPath.mainClass"));
|
||||
Validator.checkOptStrings(paths,
|
||||
Validator.MAX_PATH,
|
||||
Validator.MAX_BIG_STR,
|
||||
"paths",
|
||||
Messages.getString("ClassPath.path"));
|
||||
}
|
||||
|
||||
public String getMainClass() {
|
||||
return mainClass;
|
||||
}
|
||||
|
||||
public void setMainClass(String mainClass) {
|
||||
this.mainClass = mainClass;
|
||||
}
|
||||
|
||||
public List getPaths() {
|
||||
return paths;
|
||||
}
|
||||
|
||||
public void setPaths(List paths) {
|
||||
this.paths = paths;
|
||||
}
|
||||
|
||||
public String getPathsString() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < paths.size(); i++) {
|
||||
sb.append(paths.get(i));
|
||||
if (i < paths.size() - 1) {
|
||||
sb.append(';');
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
396
build/windows/launcher/launch4j/src/net/sf/launch4j/config/Config.java
Executable file
@ -0,0 +1,396 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on Apr 21, 2005
|
||||
*/
|
||||
package net.sf.launch4j.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.sf.launch4j.binding.IValidatable;
|
||||
import net.sf.launch4j.binding.Validator;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class Config implements IValidatable {
|
||||
|
||||
// 1.x config properties_____________________________________________________________
|
||||
public static final String HEADER = "header";
|
||||
public static final String JAR = "jar";
|
||||
public static final String OUTFILE = "outfile";
|
||||
public static final String ERR_TITLE = "errTitle";
|
||||
public static final String JAR_ARGS = "jarArgs";
|
||||
public static final String CHDIR = "chdir";
|
||||
public static final String CUSTOM_PROC_NAME = "customProcName";
|
||||
public static final String STAY_ALIVE = "stayAlive";
|
||||
public static final String ICON = "icon";
|
||||
|
||||
// __________________________________________________________________________________
|
||||
public static final String DOWNLOAD_URL = "http://java.com/download";
|
||||
|
||||
public static final String GUI_HEADER = "gui";
|
||||
public static final String CONSOLE_HEADER = "console";
|
||||
|
||||
private static final String[] HEADER_TYPES = new String[] { GUI_HEADER,
|
||||
CONSOLE_HEADER };
|
||||
|
||||
private static final String[] PRIORITY_CLASS_NAMES = new String[] { "normal",
|
||||
"idle",
|
||||
"high" };
|
||||
|
||||
private static final int[] PRIORITY_CLASSES = new int[] { 0x00000020,
|
||||
0x00000040,
|
||||
0x00000080 };
|
||||
|
||||
private boolean dontWrapJar;
|
||||
private String headerType = GUI_HEADER;
|
||||
private List headerObjects;
|
||||
private List libs;
|
||||
private File jar;
|
||||
private File outfile;
|
||||
|
||||
// Runtime header configuration
|
||||
private String errTitle;
|
||||
private String cmdLine;
|
||||
private String chdir;
|
||||
private String priority;
|
||||
private String downloadUrl;
|
||||
private String supportUrl;
|
||||
private boolean customProcName;
|
||||
private boolean stayAlive;
|
||||
private File manifest;
|
||||
private File icon;
|
||||
private List variables;
|
||||
private SingleInstance singleInstance;
|
||||
private ClassPath classPath;
|
||||
private Jre jre;
|
||||
private Splash splash;
|
||||
private VersionInfo versionInfo;
|
||||
private Msg messages;
|
||||
|
||||
public void checkInvariants() {
|
||||
Validator.checkTrue(outfile != null && outfile.getPath().endsWith(".exe"),
|
||||
"outfile", Messages.getString("Config.specify.output.exe"));
|
||||
if (dontWrapJar) {
|
||||
if (jar != null && !jar.getPath().equals("")) {
|
||||
Validator.checkRelativeWinPath(jar.getPath(), "jar",
|
||||
Messages.getString("Config.application.jar.path"));
|
||||
} else {
|
||||
Validator.checkTrue(classPath != null, "classPath",
|
||||
Messages.getString("ClassPath.or.jar"));
|
||||
}
|
||||
} else {
|
||||
Validator.checkFile(jar, "jar",
|
||||
Messages.getString("Config.application.jar"));
|
||||
}
|
||||
if (!Validator.isEmpty(chdir)) {
|
||||
Validator.checkRelativeWinPath(chdir, "chdir",
|
||||
Messages.getString("Config.chdir.relative"));
|
||||
Validator.checkFalse(chdir.toLowerCase().equals("true")
|
||||
|| chdir.toLowerCase().equals("false"),
|
||||
"chdir", Messages.getString("Config.chdir.path"));
|
||||
}
|
||||
Validator.checkOptFile(manifest, "manifest", Messages.getString("Config.manifest"));
|
||||
Validator.checkOptFile(icon, "icon", Messages.getString("Config.icon"));
|
||||
Validator.checkOptString(cmdLine, Validator.MAX_BIG_STR, "jarArgs",
|
||||
Messages.getString("Config.jar.arguments"));
|
||||
Validator.checkOptString(errTitle, Validator.MAX_STR, "errTitle",
|
||||
Messages.getString("Config.error.title"));
|
||||
Validator.checkOptString(downloadUrl, 256,
|
||||
"downloadUrl", Messages.getString("Config.download.url"));
|
||||
Validator.checkOptString(supportUrl, 256,
|
||||
"supportUrl", Messages.getString("Config.support.url"));
|
||||
Validator.checkIn(getHeaderType(), HEADER_TYPES, "headerType",
|
||||
Messages.getString("Config.header.type"));
|
||||
Validator.checkFalse(getHeaderType().equals(CONSOLE_HEADER) && splash != null,
|
||||
"headerType",
|
||||
Messages.getString("Config.splash.not.impl.by.console.hdr"));
|
||||
Validator.checkOptStrings(variables,
|
||||
Validator.MAX_ARGS,
|
||||
Validator.MAX_ARGS,
|
||||
"[^=%\t]+=[^=\t]+",
|
||||
"variables",
|
||||
Messages.getString("Config.variables"),
|
||||
Messages.getString("Config.variables.err"));
|
||||
Validator.checkIn(getPriority(), PRIORITY_CLASS_NAMES, "priority",
|
||||
Messages.getString("Config.priority"));
|
||||
jre.checkInvariants();
|
||||
}
|
||||
|
||||
public void validate() {
|
||||
checkInvariants();
|
||||
if (classPath != null) {
|
||||
classPath.checkInvariants();
|
||||
}
|
||||
if (splash != null) {
|
||||
splash.checkInvariants();
|
||||
}
|
||||
if (versionInfo != null) {
|
||||
versionInfo.checkInvariants();
|
||||
}
|
||||
}
|
||||
|
||||
/** Change current directory to EXE location. */
|
||||
public String getChdir() {
|
||||
return chdir;
|
||||
}
|
||||
|
||||
public void setChdir(String chdir) {
|
||||
this.chdir = chdir;
|
||||
}
|
||||
|
||||
/** Constant command line arguments passed to the application. */
|
||||
public String getCmdLine() {
|
||||
return cmdLine;
|
||||
}
|
||||
|
||||
public void setCmdLine(String cmdLine) {
|
||||
this.cmdLine = cmdLine;
|
||||
}
|
||||
|
||||
/** Optional, error message box title. */
|
||||
public String getErrTitle() {
|
||||
return errTitle;
|
||||
}
|
||||
|
||||
public void setErrTitle(String errTitle) {
|
||||
this.errTitle = errTitle;
|
||||
}
|
||||
|
||||
/** launch4j header file. */
|
||||
public String getHeaderType() {
|
||||
return headerType.toLowerCase();
|
||||
}
|
||||
|
||||
public void setHeaderType(String headerType) {
|
||||
this.headerType = headerType;
|
||||
}
|
||||
|
||||
/** launch4j header file index - used by GUI. */
|
||||
public int getHeaderTypeIndex() {
|
||||
int x = Arrays.asList(HEADER_TYPES).indexOf(getHeaderType());
|
||||
return x != -1 ? x : 0;
|
||||
}
|
||||
|
||||
public void setHeaderTypeIndex(int headerTypeIndex) {
|
||||
headerType = HEADER_TYPES[headerTypeIndex];
|
||||
}
|
||||
|
||||
public boolean isCustomHeaderObjects() {
|
||||
return headerObjects != null && !headerObjects.isEmpty();
|
||||
}
|
||||
|
||||
public List getHeaderObjects() {
|
||||
return isCustomHeaderObjects() ? headerObjects
|
||||
: getHeaderType().equals(GUI_HEADER)
|
||||
? LdDefaults.GUI_HEADER_OBJECTS
|
||||
: LdDefaults.CONSOLE_HEADER_OBJECTS;
|
||||
}
|
||||
|
||||
public void setHeaderObjects(List headerObjects) {
|
||||
this.headerObjects = headerObjects;
|
||||
}
|
||||
|
||||
public boolean isCustomLibs() {
|
||||
return libs != null && !libs.isEmpty();
|
||||
}
|
||||
|
||||
public List getLibs() {
|
||||
return isCustomLibs() ? libs : LdDefaults.LIBS;
|
||||
}
|
||||
|
||||
public void setLibs(List libs) {
|
||||
this.libs = libs;
|
||||
}
|
||||
|
||||
/** Wrapper's manifest for User Account Control. */
|
||||
public File getManifest() {
|
||||
return manifest;
|
||||
}
|
||||
|
||||
public void setManifest(File manifest) {
|
||||
this.manifest = manifest;
|
||||
}
|
||||
|
||||
/** ICO file. */
|
||||
public File getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(File icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
/** Jar to wrap. */
|
||||
public File getJar() {
|
||||
return jar;
|
||||
}
|
||||
|
||||
public void setJar(File jar) {
|
||||
this.jar = jar;
|
||||
}
|
||||
|
||||
public List getVariables() {
|
||||
return variables;
|
||||
}
|
||||
|
||||
public void setVariables(List variables) {
|
||||
this.variables = variables;
|
||||
}
|
||||
|
||||
public ClassPath getClassPath() {
|
||||
return classPath;
|
||||
}
|
||||
|
||||
public void setClassPath(ClassPath classpath) {
|
||||
this.classPath = classpath;
|
||||
}
|
||||
|
||||
/** JRE configuration */
|
||||
public Jre getJre() {
|
||||
return jre;
|
||||
}
|
||||
|
||||
public void setJre(Jre jre) {
|
||||
this.jre = jre;
|
||||
}
|
||||
|
||||
/** Output EXE file. */
|
||||
public File getOutfile() {
|
||||
return outfile;
|
||||
}
|
||||
|
||||
public void setOutfile(File outfile) {
|
||||
this.outfile = outfile;
|
||||
}
|
||||
|
||||
/** Custom process name as the output EXE file name. */
|
||||
public boolean isCustomProcName() {
|
||||
return customProcName;
|
||||
}
|
||||
|
||||
public void setCustomProcName(boolean customProcName) {
|
||||
this.customProcName = customProcName;
|
||||
}
|
||||
|
||||
/** Splash screen configuration. */
|
||||
public Splash getSplash() {
|
||||
return splash;
|
||||
}
|
||||
|
||||
public void setSplash(Splash splash) {
|
||||
this.splash = splash;
|
||||
}
|
||||
|
||||
/** Stay alive after launching the application. */
|
||||
public boolean isStayAlive() {
|
||||
return stayAlive;
|
||||
}
|
||||
|
||||
public void setStayAlive(boolean stayAlive) {
|
||||
this.stayAlive = stayAlive;
|
||||
}
|
||||
|
||||
public VersionInfo getVersionInfo() {
|
||||
return versionInfo;
|
||||
}
|
||||
|
||||
public void setVersionInfo(VersionInfo versionInfo) {
|
||||
this.versionInfo = versionInfo;
|
||||
}
|
||||
|
||||
public boolean isDontWrapJar() {
|
||||
return dontWrapJar;
|
||||
}
|
||||
|
||||
public void setDontWrapJar(boolean dontWrapJar) {
|
||||
this.dontWrapJar = dontWrapJar;
|
||||
}
|
||||
|
||||
public int getPriorityIndex() {
|
||||
int x = Arrays.asList(PRIORITY_CLASS_NAMES).indexOf(getPriority());
|
||||
return x != -1 ? x : 0;
|
||||
}
|
||||
|
||||
public void setPriorityIndex(int x) {
|
||||
priority = PRIORITY_CLASS_NAMES[x];
|
||||
}
|
||||
|
||||
public String getPriority() {
|
||||
return Validator.isEmpty(priority) ? PRIORITY_CLASS_NAMES[0] : priority;
|
||||
}
|
||||
|
||||
public void setPriority(String priority) {
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
public int getPriorityClass() {
|
||||
return PRIORITY_CLASSES[getPriorityIndex()];
|
||||
}
|
||||
|
||||
public String getDownloadUrl() {
|
||||
return downloadUrl == null ? DOWNLOAD_URL : downloadUrl;
|
||||
}
|
||||
|
||||
public void setDownloadUrl(String downloadUrl) {
|
||||
this.downloadUrl = downloadUrl;
|
||||
}
|
||||
|
||||
public String getSupportUrl() {
|
||||
return supportUrl;
|
||||
}
|
||||
|
||||
public void setSupportUrl(String supportUrl) {
|
||||
this.supportUrl = supportUrl;
|
||||
}
|
||||
|
||||
public Msg getMessages() {
|
||||
return messages;
|
||||
}
|
||||
|
||||
public void setMessages(Msg messages) {
|
||||
this.messages = messages;
|
||||
}
|
||||
|
||||
public SingleInstance getSingleInstance() {
|
||||
return singleInstance;
|
||||
}
|
||||
|
||||
public void setSingleInstance(SingleInstance singleInstance) {
|
||||
this.singleInstance = singleInstance;
|
||||
}
|
||||
}
|
249
build/windows/launcher/launch4j/src/net/sf/launch4j/config/ConfigPersister.java
Executable file
@ -0,0 +1,249 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on Apr 22, 2005
|
||||
*/
|
||||
package net.sf.launch4j.config;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import net.sf.launch4j.Util;
|
||||
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import com.thoughtworks.xstream.io.xml.DomDriver;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class ConfigPersister {
|
||||
|
||||
private static final ConfigPersister _instance = new ConfigPersister();
|
||||
|
||||
private final XStream _xstream;
|
||||
private Config _config;
|
||||
private File _configPath;
|
||||
|
||||
private ConfigPersister() {
|
||||
_xstream = new XStream(new DomDriver());
|
||||
_xstream.alias("launch4jConfig", Config.class);
|
||||
_xstream.alias("classPath", ClassPath.class);
|
||||
_xstream.alias("jre", Jre.class);
|
||||
_xstream.alias("splash", Splash.class);
|
||||
_xstream.alias("versionInfo", VersionInfo.class);
|
||||
|
||||
_xstream.addImplicitCollection(Config.class, "headerObjects", "obj",
|
||||
String.class);
|
||||
_xstream.addImplicitCollection(Config.class, "libs", "lib", String.class);
|
||||
_xstream.addImplicitCollection(Config.class, "variables", "var", String.class);
|
||||
_xstream.addImplicitCollection(ClassPath.class, "paths", "cp", String.class);
|
||||
_xstream.addImplicitCollection(Jre.class, "options", "opt", String.class);
|
||||
}
|
||||
|
||||
public static ConfigPersister getInstance() {
|
||||
return _instance;
|
||||
}
|
||||
|
||||
public Config getConfig() {
|
||||
return _config;
|
||||
}
|
||||
|
||||
public File getConfigPath() {
|
||||
return _configPath;
|
||||
}
|
||||
|
||||
public File getOutputPath() throws IOException {
|
||||
if (_config.getOutfile().isAbsolute()) {
|
||||
return _config.getOutfile().getParentFile();
|
||||
}
|
||||
File parent = _config.getOutfile().getParentFile();
|
||||
return (parent != null) ? new File(_configPath, parent.getPath()) : _configPath;
|
||||
}
|
||||
|
||||
public File getOutputFile() throws IOException {
|
||||
return _config.getOutfile().isAbsolute()
|
||||
? _config.getOutfile()
|
||||
: new File(getOutputPath(), _config.getOutfile().getName());
|
||||
}
|
||||
|
||||
public void createBlank() {
|
||||
_config = new Config();
|
||||
_config.setJre(new Jre());
|
||||
_configPath = null;
|
||||
}
|
||||
|
||||
public void setAntConfig(Config c, File basedir) {
|
||||
_config = c;
|
||||
_configPath = basedir;
|
||||
}
|
||||
|
||||
public void load(File f) throws ConfigPersisterException {
|
||||
try {
|
||||
FileReader r = new FileReader(f);
|
||||
char[] buf = new char[(int) f.length()];
|
||||
r.read(buf);
|
||||
r.close();
|
||||
// Convert 2.x config to 3.x
|
||||
String s = String.valueOf(buf)
|
||||
.replaceAll("<headerType>0<", "<headerType>gui<")
|
||||
.replaceAll("<headerType>1<", "<headerType>console<")
|
||||
.replaceAll("jarArgs>", "cmdLine>")
|
||||
.replaceAll("<jarArgs[ ]*/>", "<cmdLine/>")
|
||||
.replaceAll("args>", "opt>")
|
||||
.replaceAll("<args[ ]*/>", "<opt/>")
|
||||
.replaceAll("<dontUsePrivateJres>false</dontUsePrivateJres>",
|
||||
"<jdkPreference>" + Jre.JDK_PREFERENCE_PREFER_JRE + "</jdkPreference>")
|
||||
.replaceAll("<dontUsePrivateJres>true</dontUsePrivateJres>",
|
||||
"<jdkPreference>" + Jre.JDK_PREFERENCE_JRE_ONLY + "</jdkPreference>")
|
||||
.replaceAll("<initialHeapSize>0</initialHeapSize>", "")
|
||||
.replaceAll("<maxHeapSize>0</maxHeapSize>", "");
|
||||
_config = (Config) _xstream.fromXML(s);
|
||||
setConfigPath(f);
|
||||
} catch (Exception e) {
|
||||
throw new ConfigPersisterException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Imports launch4j 1.x.x config file.
|
||||
*/
|
||||
public void loadVersion1(File f) throws ConfigPersisterException {
|
||||
try {
|
||||
Props props = new Props(f);
|
||||
_config = new Config();
|
||||
String header = props.getProperty(Config.HEADER);
|
||||
_config.setHeaderType(header == null
|
||||
|| header.toLowerCase().equals("guihead.bin") ? Config.GUI_HEADER
|
||||
: Config.CONSOLE_HEADER);
|
||||
_config.setJar(props.getFile(Config.JAR));
|
||||
_config.setOutfile(props.getFile(Config.OUTFILE));
|
||||
_config.setJre(new Jre());
|
||||
_config.getJre().setPath(props.getProperty(Jre.PATH));
|
||||
_config.getJre().setMinVersion(props.getProperty(Jre.MIN_VERSION));
|
||||
_config.getJre().setMaxVersion(props.getProperty(Jre.MAX_VERSION));
|
||||
String args = props.getProperty(Jre.ARGS);
|
||||
if (args != null) {
|
||||
List jreOptions = new ArrayList();
|
||||
jreOptions.add(args);
|
||||
_config.getJre().setOptions(jreOptions);
|
||||
}
|
||||
_config.setCmdLine(props.getProperty(Config.JAR_ARGS));
|
||||
_config.setChdir("true".equals(props.getProperty(Config.CHDIR))
|
||||
? "." : null);
|
||||
_config.setCustomProcName("true".equals(
|
||||
props.getProperty("setProcName"))); // 1.x
|
||||
_config.setStayAlive("true".equals(props.getProperty(Config.STAY_ALIVE)));
|
||||
_config.setErrTitle(props.getProperty(Config.ERR_TITLE));
|
||||
_config.setIcon(props.getFile(Config.ICON));
|
||||
File splashFile = props.getFile(Splash.SPLASH_FILE);
|
||||
if (splashFile != null) {
|
||||
_config.setSplash(new Splash());
|
||||
_config.getSplash().setFile(splashFile);
|
||||
String waitfor = props.getProperty("waitfor"); // 1.x
|
||||
_config.getSplash().setWaitForWindow(waitfor != null
|
||||
&& !waitfor.equals(""));
|
||||
String splashTimeout = props.getProperty(Splash.TIMEOUT);
|
||||
if (splashTimeout != null) {
|
||||
_config.getSplash().setTimeout(Integer.parseInt(splashTimeout));
|
||||
}
|
||||
_config.getSplash().setTimeoutErr("true".equals(
|
||||
props.getProperty(Splash.TIMEOUT_ERR)));
|
||||
} else {
|
||||
_config.setSplash(null);
|
||||
}
|
||||
setConfigPath(f);
|
||||
} catch (IOException e) {
|
||||
throw new ConfigPersisterException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void save(File f) throws ConfigPersisterException {
|
||||
try {
|
||||
BufferedWriter w = new BufferedWriter(new FileWriter(f));
|
||||
_xstream.toXML(_config, w);
|
||||
w.close();
|
||||
setConfigPath(f);
|
||||
} catch (Exception e) {
|
||||
throw new ConfigPersisterException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void setConfigPath(File configFile) {
|
||||
_configPath = configFile.getAbsoluteFile().getParentFile();
|
||||
}
|
||||
|
||||
private class Props {
|
||||
final Properties _properties = new Properties();
|
||||
|
||||
public Props(File f) throws IOException {
|
||||
FileInputStream is = null;
|
||||
try {
|
||||
is = new FileInputStream(f);
|
||||
_properties.load(is);
|
||||
} finally {
|
||||
Util.close(is);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get property and remove trailing # comments.
|
||||
*/
|
||||
public String getProperty(String key) {
|
||||
String p = _properties.getProperty(key);
|
||||
if (p == null) {
|
||||
return null;
|
||||
}
|
||||
int x = p.indexOf('#');
|
||||
if (x == -1) {
|
||||
return p;
|
||||
}
|
||||
do {
|
||||
x--;
|
||||
} while (x > 0 && (p.charAt(x) == ' ' || p.charAt(x) == '\t'));
|
||||
return (x == 0) ? "" : p.substring(0, x + 1);
|
||||
}
|
||||
|
||||
public File getFile(String key) {
|
||||
String value = getProperty(key);
|
||||
return value != null ? new File(value) : null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on Apr 22, 2005
|
||||
*/
|
||||
package net.sf.launch4j.config;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class ConfigPersisterException extends Exception {
|
||||
|
||||
public ConfigPersisterException(String msg, Throwable t) {
|
||||
super(msg, t);
|
||||
}
|
||||
|
||||
public ConfigPersisterException(Throwable t) {
|
||||
super(t);
|
||||
}
|
||||
}
|
235
build/windows/launcher/launch4j/src/net/sf/launch4j/config/Jre.java
Executable file
@ -0,0 +1,235 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on Apr 21, 2005
|
||||
*/
|
||||
package net.sf.launch4j.config;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.sf.launch4j.binding.IValidatable;
|
||||
import net.sf.launch4j.binding.Validator;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class Jre implements IValidatable {
|
||||
|
||||
// 1.x config properties_____________________________________________________________
|
||||
public static final String PATH = "jrepath";
|
||||
public static final String MIN_VERSION = "javamin";
|
||||
public static final String MAX_VERSION = "javamax";
|
||||
public static final String ARGS = "jvmArgs";
|
||||
|
||||
// __________________________________________________________________________________
|
||||
public static final String VERSION_PATTERN = "(\\d\\.){2}\\d(_\\d+)?";
|
||||
|
||||
public static final String JDK_PREFERENCE_JRE_ONLY = "jreOnly";
|
||||
public static final String JDK_PREFERENCE_PREFER_JRE = "preferJre";
|
||||
public static final String JDK_PREFERENCE_PREFER_JDK = "preferJdk";
|
||||
public static final String JDK_PREFERENCE_JDK_ONLY = "jdkOnly";
|
||||
|
||||
private static final String[] JDK_PREFERENCE_NAMES = new String[] {
|
||||
JDK_PREFERENCE_JRE_ONLY,
|
||||
JDK_PREFERENCE_PREFER_JRE,
|
||||
JDK_PREFERENCE_PREFER_JDK,
|
||||
JDK_PREFERENCE_JDK_ONLY };
|
||||
|
||||
public static final int DEFAULT_JDK_PREFERENCE_INDEX
|
||||
= Arrays.asList(JDK_PREFERENCE_NAMES).indexOf(JDK_PREFERENCE_PREFER_JRE);
|
||||
|
||||
private String path;
|
||||
private String minVersion;
|
||||
private String maxVersion;
|
||||
private String jdkPreference;
|
||||
private Integer initialHeapSize;
|
||||
private Integer initialHeapPercent;
|
||||
private Integer maxHeapSize;
|
||||
private Integer maxHeapPercent;
|
||||
private List options;
|
||||
|
||||
public void checkInvariants() {
|
||||
Validator.checkOptString(minVersion, 10, VERSION_PATTERN,
|
||||
"jre.minVersion", Messages.getString("Jre.min.version"));
|
||||
Validator.checkOptString(maxVersion, 10, VERSION_PATTERN,
|
||||
"jre.maxVersion", Messages.getString("Jre.max.version"));
|
||||
if (Validator.isEmpty(path)) {
|
||||
Validator.checkFalse(Validator.isEmpty(minVersion),
|
||||
"jre.minVersion", Messages.getString("Jre.specify.jre.min.version.or.path"));
|
||||
} else {
|
||||
Validator.checkString(path, Validator.MAX_PATH,
|
||||
"jre.path", Messages.getString("Jre.bundled.path"));
|
||||
}
|
||||
if (!Validator.isEmpty(maxVersion)) {
|
||||
Validator.checkFalse(Validator.isEmpty(minVersion),
|
||||
"jre.minVersion", Messages.getString("Jre.specify.min.version"));
|
||||
Validator.checkTrue(minVersion.compareTo(maxVersion) < 0,
|
||||
"jre.maxVersion", Messages.getString("Jre.max.greater.than.min"));
|
||||
}
|
||||
Validator.checkTrue(initialHeapSize == null || maxHeapSize != null,
|
||||
"jre.maxHeapSize", Messages.getString("Jre.initial.and.max.heap"));
|
||||
Validator.checkTrue(initialHeapSize == null || initialHeapSize.intValue() > 0,
|
||||
"jre.initialHeapSize", Messages.getString("Jre.initial.heap"));
|
||||
Validator.checkTrue(maxHeapSize == null || (maxHeapSize.intValue()
|
||||
>= ((initialHeapSize != null) ? initialHeapSize.intValue() : 1)),
|
||||
"jre.maxHeapSize", Messages.getString("Jre.max.heap"));
|
||||
Validator.checkTrue(initialHeapPercent == null || maxHeapPercent != null,
|
||||
"jre.maxHeapPercent", Messages.getString("Jre.initial.and.max.heap"));
|
||||
if (initialHeapPercent != null) {
|
||||
Validator.checkRange(initialHeapPercent.intValue(), 1, 100,
|
||||
"jre.initialHeapPercent",
|
||||
Messages.getString("Jre.initial.heap.percent"));
|
||||
}
|
||||
if (maxHeapPercent != null) {
|
||||
Validator.checkRange(maxHeapPercent.intValue(),
|
||||
initialHeapPercent != null ? initialHeapPercent.intValue() : 1, 100,
|
||||
"jre.maxHeapPercent",
|
||||
Messages.getString("Jre.max.heap.percent"));
|
||||
}
|
||||
Validator.checkIn(getJdkPreference(), JDK_PREFERENCE_NAMES,
|
||||
"jre.jdkPreference", Messages.getString("Jre.jdkPreference.invalid"));
|
||||
Validator.checkOptStrings(options,
|
||||
Validator.MAX_ARGS,
|
||||
Validator.MAX_ARGS,
|
||||
"[^\"]*|([^\"]*\"[^\"]*\"[^\"]*)*",
|
||||
"jre.options",
|
||||
Messages.getString("Jre.jvm.options"),
|
||||
Messages.getString("Jre.jvm.options.unclosed.quotation"));
|
||||
|
||||
// Quoted variable references: "[^%]*|([^%]*\"([^%]*%[^%]+%[^%]*)+\"[^%]*)*"
|
||||
Validator.checkOptStrings(options,
|
||||
Validator.MAX_ARGS,
|
||||
Validator.MAX_ARGS,
|
||||
"[^%]*|([^%]*([^%]*%[^%]+%[^%]*)+[^%]*)*",
|
||||
"jre.options",
|
||||
Messages.getString("Jre.jvm.options"),
|
||||
Messages.getString("Jre.jvm.options.variable"));
|
||||
}
|
||||
|
||||
/** JVM options */
|
||||
public List getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
public void setOptions(List options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
/** Max Java version (x.x.x) */
|
||||
public String getMaxVersion() {
|
||||
return maxVersion;
|
||||
}
|
||||
|
||||
public void setMaxVersion(String maxVersion) {
|
||||
this.maxVersion = maxVersion;
|
||||
}
|
||||
|
||||
/** Min Java version (x.x.x) */
|
||||
public String getMinVersion() {
|
||||
return minVersion;
|
||||
}
|
||||
|
||||
public void setMinVersion(String minVersion) {
|
||||
this.minVersion = minVersion;
|
||||
}
|
||||
|
||||
/** Preference for standalone JRE or JDK-private JRE */
|
||||
public String getJdkPreference() {
|
||||
return Validator.isEmpty(jdkPreference) ? JDK_PREFERENCE_PREFER_JRE
|
||||
: jdkPreference;
|
||||
}
|
||||
|
||||
public void setJdkPreference(String jdkPreference) {
|
||||
this.jdkPreference = jdkPreference;
|
||||
}
|
||||
|
||||
/** Preference for standalone JRE or JDK-private JRE */
|
||||
public int getJdkPreferenceIndex() {
|
||||
int x = Arrays.asList(JDK_PREFERENCE_NAMES).indexOf(getJdkPreference());
|
||||
return x != -1 ? x : DEFAULT_JDK_PREFERENCE_INDEX;
|
||||
}
|
||||
|
||||
public void setJdkPreferenceIndex(int x) {
|
||||
jdkPreference = JDK_PREFERENCE_NAMES[x];
|
||||
}
|
||||
|
||||
/** JRE path */
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
/** Initial heap size in MB */
|
||||
public Integer getInitialHeapSize() {
|
||||
return initialHeapSize;
|
||||
}
|
||||
|
||||
public void setInitialHeapSize(Integer initialHeapSize) {
|
||||
this.initialHeapSize = getInteger(initialHeapSize);
|
||||
}
|
||||
|
||||
/** Max heap size in MB */
|
||||
public Integer getMaxHeapSize() {
|
||||
return maxHeapSize;
|
||||
}
|
||||
|
||||
public void setMaxHeapSize(Integer maxHeapSize) {
|
||||
this.maxHeapSize = getInteger(maxHeapSize);
|
||||
}
|
||||
|
||||
public Integer getInitialHeapPercent() {
|
||||
return initialHeapPercent;
|
||||
}
|
||||
|
||||
public void setInitialHeapPercent(Integer initialHeapPercent) {
|
||||
this.initialHeapPercent = getInteger(initialHeapPercent);
|
||||
}
|
||||
|
||||
public Integer getMaxHeapPercent() {
|
||||
return maxHeapPercent;
|
||||
}
|
||||
|
||||
public void setMaxHeapPercent(Integer maxHeapPercent) {
|
||||
this.maxHeapPercent = getInteger(maxHeapPercent);
|
||||
}
|
||||
|
||||
/** Convert 0 to null */
|
||||
private Integer getInteger(Integer i) {
|
||||
return i != null && i.intValue() == 0 ? null : i;
|
||||
}
|
||||
}
|
62
build/windows/launcher/launch4j/src/net/sf/launch4j/config/LdDefaults.java
Executable file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on Sep 3, 2005
|
||||
*/
|
||||
package net.sf.launch4j.config;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class LdDefaults {
|
||||
|
||||
public static final List GUI_HEADER_OBJECTS = Arrays.asList(new String[] {
|
||||
"w32api/crt2.o",
|
||||
"head/guihead.o",
|
||||
"head/head.o" });
|
||||
|
||||
public static final List CONSOLE_HEADER_OBJECTS = Arrays.asList(new String[] {
|
||||
"w32api/crt2.o",
|
||||
"head/consolehead.o",
|
||||
"head/head.o"});
|
||||
|
||||
public static final List LIBS = Arrays.asList(new String[] {
|
||||
"w32api/libmingw32.a",
|
||||
"w32api/libgcc.a",
|
||||
"w32api/libmsvcrt.a",
|
||||
"w32api/libkernel32.a",
|
||||
"w32api/libuser32.a",
|
||||
"w32api/libadvapi32.a",
|
||||
"w32api/libshell32.a" });
|
||||
}
|
78
build/windows/launcher/launch4j/src/net/sf/launch4j/config/Messages.java
Executable file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.sf.launch4j.config;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class Messages {
|
||||
private static final String BUNDLE_NAME = "net.sf.launch4j.config.messages";
|
||||
|
||||
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
|
||||
.getBundle(BUNDLE_NAME);
|
||||
private static final MessageFormat FORMATTER = new MessageFormat("");
|
||||
|
||||
private Messages() {
|
||||
}
|
||||
|
||||
public static String getString(String key) {
|
||||
try {
|
||||
return RESOURCE_BUNDLE.getString(key);
|
||||
} catch (MissingResourceException e) {
|
||||
return '!' + key + '!';
|
||||
}
|
||||
}
|
||||
|
||||
public static String getString(String key, String arg0) {
|
||||
return getString(key, new Object[] {arg0});
|
||||
}
|
||||
|
||||
public static String getString(String key, String arg0, String arg1) {
|
||||
return getString(key, new Object[] {arg0, arg1});
|
||||
}
|
||||
|
||||
public static String getString(String key, String arg0, String arg1, String arg2) {
|
||||
return getString(key, new Object[] {arg0, arg1, arg2});
|
||||
}
|
||||
|
||||
public static String getString(String key, Object[] args) {
|
||||
try {
|
||||
FORMATTER.applyPattern(RESOURCE_BUNDLE.getString(key));
|
||||
return FORMATTER.format(args);
|
||||
} catch (MissingResourceException e) {
|
||||
return '!' + key + '!';
|
||||
}
|
||||
}
|
||||
}
|
111
build/windows/launcher/launch4j/src/net/sf/launch4j/config/Msg.java
Executable file
@ -0,0 +1,111 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on Oct 8, 2006
|
||||
*/
|
||||
package net.sf.launch4j.config;
|
||||
|
||||
import net.sf.launch4j.binding.IValidatable;
|
||||
import net.sf.launch4j.binding.Validator;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2006 Grzegorz Kowal
|
||||
*/
|
||||
public class Msg implements IValidatable {
|
||||
private String startupErr;
|
||||
private String bundledJreErr;
|
||||
private String jreVersionErr;
|
||||
private String launcherErr;
|
||||
private String instanceAlreadyExistsMsg;
|
||||
|
||||
public void checkInvariants() {
|
||||
Validator.checkOptString(startupErr, 1024, "startupErr",
|
||||
Messages.getString("Msg.startupErr"));
|
||||
Validator.checkOptString(bundledJreErr, 1024, "bundledJreErr",
|
||||
Messages.getString("Msg.bundledJreErr"));
|
||||
Validator.checkOptString(jreVersionErr, 1024, "jreVersionErr",
|
||||
Messages.getString("Msg.jreVersionErr"));
|
||||
Validator.checkOptString(launcherErr, 1024, "launcherErr",
|
||||
Messages.getString("Msg.launcherErr"));
|
||||
Validator.checkOptString(instanceAlreadyExistsMsg, 1024, "instanceAlreadyExistsMsg",
|
||||
Messages.getString("Msg.instanceAlreadyExistsMsg"));
|
||||
}
|
||||
|
||||
public String getStartupErr() {
|
||||
return !Validator.isEmpty(startupErr) ? startupErr
|
||||
: "An error occurred while starting the application.";
|
||||
}
|
||||
|
||||
public void setStartupErr(String startupErr) {
|
||||
this.startupErr = startupErr;
|
||||
}
|
||||
|
||||
public String getBundledJreErr() {
|
||||
return !Validator.isEmpty(bundledJreErr) ? bundledJreErr
|
||||
: "This application was configured to use a bundled Java Runtime" +
|
||||
" Environment but the runtime is missing or corrupted.";
|
||||
}
|
||||
|
||||
public void setBundledJreErr(String bundledJreErr) {
|
||||
this.bundledJreErr = bundledJreErr;
|
||||
}
|
||||
|
||||
public String getJreVersionErr() {
|
||||
return !Validator.isEmpty(jreVersionErr) ? jreVersionErr
|
||||
: "This application requires a Java Runtime Environment";
|
||||
}
|
||||
|
||||
public void setJreVersionErr(String jreVersionErr) {
|
||||
this.jreVersionErr = jreVersionErr;
|
||||
}
|
||||
|
||||
public String getLauncherErr() {
|
||||
return !Validator.isEmpty(launcherErr) ? launcherErr
|
||||
: "The registry refers to a nonexistent Java Runtime Environment" +
|
||||
" installation or the runtime is corrupted.";
|
||||
}
|
||||
|
||||
public void setLauncherErr(String launcherErr) {
|
||||
this.launcherErr = launcherErr;
|
||||
}
|
||||
|
||||
public String getInstanceAlreadyExistsMsg() {
|
||||
return !Validator.isEmpty(instanceAlreadyExistsMsg) ? instanceAlreadyExistsMsg
|
||||
: "An application instance is already running.";
|
||||
}
|
||||
|
||||
public void setInstanceAlreadyExistsMsg(String instanceAlreadyExistsMsg) {
|
||||
this.instanceAlreadyExistsMsg = instanceAlreadyExistsMsg;
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Created on 2007-09-16
|
||||
*/
|
||||
package net.sf.launch4j.config;
|
||||
|
||||
import net.sf.launch4j.binding.IValidatable;
|
||||
import net.sf.launch4j.binding.Validator;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2007 Grzegorz Kowal
|
||||
*/
|
||||
public class SingleInstance implements IValidatable {
|
||||
|
||||
private String mutexName;
|
||||
private String windowTitle;
|
||||
|
||||
public void checkInvariants() {
|
||||
Validator.checkString(mutexName, Validator.MAX_STR,
|
||||
"singleInstance.mutexName",
|
||||
Messages.getString("SingleInstance.mutexName"));
|
||||
Validator.checkOptString(windowTitle, Validator.MAX_STR,
|
||||
"singleInstance.windowTitle",
|
||||
Messages.getString("SingleInstance.windowTitle"));
|
||||
}
|
||||
|
||||
public String getWindowTitle() {
|
||||
return windowTitle;
|
||||
}
|
||||
|
||||
public void setWindowTitle(String appWindowName) {
|
||||
this.windowTitle = appWindowName;
|
||||
}
|
||||
|
||||
public String getMutexName() {
|
||||
return mutexName;
|
||||
}
|
||||
|
||||
public void setMutexName(String mutexName) {
|
||||
this.mutexName = mutexName;
|
||||
}
|
||||
}
|
103
build/windows/launcher/launch4j/src/net/sf/launch4j/config/Splash.java
Executable file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on Apr 21, 2005
|
||||
*/
|
||||
package net.sf.launch4j.config;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.sf.launch4j.binding.IValidatable;
|
||||
import net.sf.launch4j.binding.Validator;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class Splash implements IValidatable {
|
||||
|
||||
// 1.x config properties_____________________________________________________________
|
||||
public static final String SPLASH_FILE = "splash";
|
||||
public static final String WAIT_FOR_TITLE = "waitForTitle";
|
||||
public static final String TIMEOUT = "splashTimeout";
|
||||
public static final String TIMEOUT_ERR = "splashTimeoutErr";
|
||||
|
||||
// __________________________________________________________________________________
|
||||
private File file;
|
||||
private boolean waitForWindow = true;
|
||||
private int timeout = 60;
|
||||
private boolean timeoutErr = true;
|
||||
|
||||
public void checkInvariants() {
|
||||
Validator.checkFile(file, "splash.file",
|
||||
Messages.getString("Splash.splash.file"));
|
||||
Validator.checkRange(timeout, 1, 60 * 15, "splash.timeout",
|
||||
Messages.getString("Splash.splash.timeout"));
|
||||
}
|
||||
|
||||
/** Splash screen in BMP format. */
|
||||
public File getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
public void setFile(File file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
/** Splash timeout in seconds. */
|
||||
public int getTimeout() {
|
||||
return timeout;
|
||||
}
|
||||
|
||||
public void setTimeout(int timeout) {
|
||||
this.timeout = timeout;
|
||||
}
|
||||
|
||||
/** Signal error on splash timeout. */
|
||||
public boolean isTimeoutErr() {
|
||||
return timeoutErr;
|
||||
}
|
||||
|
||||
public void setTimeoutErr(boolean timeoutErr) {
|
||||
this.timeoutErr = timeoutErr;
|
||||
}
|
||||
|
||||
/** Hide splash screen when the child process displayes the first window. */
|
||||
public boolean getWaitForWindow() {
|
||||
return waitForWindow;
|
||||
}
|
||||
|
||||
public void setWaitForWindow(boolean waitForWindow) {
|
||||
this.waitForWindow = waitForWindow;
|
||||
}
|
||||
}
|
168
build/windows/launcher/launch4j/src/net/sf/launch4j/config/VersionInfo.java
Executable file
@ -0,0 +1,168 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on May 21, 2005
|
||||
*/
|
||||
package net.sf.launch4j.config;
|
||||
|
||||
import net.sf.launch4j.binding.IValidatable;
|
||||
import net.sf.launch4j.binding.Validator;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class VersionInfo implements IValidatable {
|
||||
public static final String VERSION_PATTERN = "(\\d+\\.){3}\\d+";
|
||||
|
||||
private String fileVersion;
|
||||
private String txtFileVersion;
|
||||
private String fileDescription;
|
||||
private String copyright;
|
||||
private String productVersion;
|
||||
private String txtProductVersion;
|
||||
private String productName;
|
||||
private String companyName;
|
||||
private String internalName;
|
||||
private String originalFilename;
|
||||
|
||||
public void checkInvariants() {
|
||||
Validator.checkString(fileVersion, 20, VERSION_PATTERN,
|
||||
"versionInfo.fileVersion",
|
||||
Messages.getString("VersionInfo.file.version"));
|
||||
Validator.checkString(txtFileVersion, 50, "versionInfo.txtFileVersion",
|
||||
Messages.getString("VersionInfo.txt.file.version"));
|
||||
Validator.checkString(fileDescription, 150, "versionInfo.fileDescription",
|
||||
Messages.getString("VersionInfo.file.description"));
|
||||
Validator.checkString(copyright, 150, "versionInfo.copyright",
|
||||
Messages.getString("VersionInfo.copyright"));
|
||||
Validator.checkString(productVersion, 20, VERSION_PATTERN,
|
||||
"versionInfo.productVersion",
|
||||
Messages.getString("VersionInfo.product.version"));
|
||||
Validator.checkString(txtProductVersion, 50, "versionInfo.txtProductVersion",
|
||||
Messages.getString("VersionInfo.txt.product.version"));
|
||||
Validator.checkString(productName, 150, "versionInfo.productName",
|
||||
Messages.getString("VersionInfo.product.name"));
|
||||
Validator.checkOptString(companyName, 150, "versionInfo.companyName",
|
||||
Messages.getString("VersionInfo.company.name"));
|
||||
Validator.checkString(internalName, 50, "versionInfo.internalName",
|
||||
Messages.getString("VersionInfo.internal.name"));
|
||||
Validator.checkTrue(!internalName.endsWith(".exe"), "versionInfo.internalName",
|
||||
Messages.getString("VersionInfo.internal.name.not.exe"));
|
||||
Validator.checkString(originalFilename, 50, "versionInfo.originalFilename",
|
||||
Messages.getString("VersionInfo.original.filename"));
|
||||
Validator.checkTrue(originalFilename.endsWith(".exe"),
|
||||
"versionInfo.originalFilename",
|
||||
Messages.getString("VersionInfo.original.filename.exe"));
|
||||
}
|
||||
|
||||
public String getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
|
||||
public void setCompanyName(String companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
|
||||
public String getCopyright() {
|
||||
return copyright;
|
||||
}
|
||||
|
||||
public void setCopyright(String copyright) {
|
||||
this.copyright = copyright;
|
||||
}
|
||||
|
||||
public String getFileDescription() {
|
||||
return fileDescription;
|
||||
}
|
||||
|
||||
public void setFileDescription(String fileDescription) {
|
||||
this.fileDescription = fileDescription;
|
||||
}
|
||||
|
||||
public String getFileVersion() {
|
||||
return fileVersion;
|
||||
}
|
||||
|
||||
public void setFileVersion(String fileVersion) {
|
||||
this.fileVersion = fileVersion;
|
||||
}
|
||||
|
||||
public String getInternalName() {
|
||||
return internalName;
|
||||
}
|
||||
|
||||
public void setInternalName(String internalName) {
|
||||
this.internalName = internalName;
|
||||
}
|
||||
|
||||
public String getOriginalFilename() {
|
||||
return originalFilename;
|
||||
}
|
||||
|
||||
public void setOriginalFilename(String originalFilename) {
|
||||
this.originalFilename = originalFilename;
|
||||
}
|
||||
|
||||
public String getProductName() {
|
||||
return productName;
|
||||
}
|
||||
|
||||
public void setProductName(String productName) {
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public String getProductVersion() {
|
||||
return productVersion;
|
||||
}
|
||||
|
||||
public void setProductVersion(String productVersion) {
|
||||
this.productVersion = productVersion;
|
||||
}
|
||||
|
||||
public String getTxtFileVersion() {
|
||||
return txtFileVersion;
|
||||
}
|
||||
|
||||
public void setTxtFileVersion(String txtFileVersion) {
|
||||
this.txtFileVersion = txtFileVersion;
|
||||
}
|
||||
|
||||
public String getTxtProductVersion() {
|
||||
return txtProductVersion;
|
||||
}
|
||||
|
||||
public void setTxtProductVersion(String txtProductVersion) {
|
||||
this.txtProductVersion = txtProductVersion;
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
#
|
||||
# Launch4j (http://launch4j.sourceforge.net/)
|
||||
# Cross-platform Java application wrapper for creating Windows native executables.
|
||||
#
|
||||
# Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the name of the Launch4j nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
Splash.splash.file=Splash file
|
||||
Splash.splash.timeout=Splash timeout
|
||||
|
||||
Config.specify.output.exe=Specify output file with .exe extension.
|
||||
Config.application.jar=Application jar
|
||||
Config.application.jar.path=Specify runtime path of the jar relative to the executable.
|
||||
Config.chdir.relative='chdir' must be a path relative to the executable.
|
||||
Config.chdir.path='chdir' is now a path instead of a boolean, please check the docs.
|
||||
Config.manifest=Manifest
|
||||
Config.icon=Icon
|
||||
Config.jar.arguments=Jar arguments
|
||||
Config.error.title=Error title
|
||||
Config.download.url=Download URL
|
||||
Config.support.url=Support URL
|
||||
Config.header.type=Header type
|
||||
Config.splash.not.impl.by.console.hdr=Splash screen is not implemented by console header.
|
||||
Config.variables=Environment variables
|
||||
Config.variables.err=Environment variable assignment should have the form varname=[value][%varref%]...
|
||||
Config.priority=Process priority
|
||||
|
||||
ClassPath.mainClass=Main class
|
||||
ClassPath.or.jar=Specify runtime path of a jar or the classpath.
|
||||
ClassPath.path=Classpath
|
||||
|
||||
VersionInfo.file.version=File version, should be 'x.x.x.x'
|
||||
VersionInfo.txt.file.version=Free form file version
|
||||
VersionInfo.file.description=File description
|
||||
VersionInfo.copyright=Copyright
|
||||
VersionInfo.product.version=Product version, should be 'x.x.x.x'
|
||||
VersionInfo.txt.product.version=Free from product version
|
||||
VersionInfo.product.name=Product name
|
||||
VersionInfo.company.name=Company name
|
||||
VersionInfo.internal.name=Internal name
|
||||
VersionInfo.internal.name.not.exe=Internal name shouldn't have the .exe extension.
|
||||
VersionInfo.original.filename=Original filename
|
||||
VersionInfo.original.filename.exe=Original filename should end with the .exe extension.
|
||||
|
||||
Jre.min.version=Minimum JRE version should be x.x.x[_xx]
|
||||
Jre.max.version=Maximum JRE version should be x.x.x[_xx]
|
||||
Jre.specify.jre.min.version.or.path=Specify minimum JRE version and/or bundled JRE path.
|
||||
Jre.bundled.path=Bundled JRE path
|
||||
Jre.specify.min.version=Specify minimum JRE version.
|
||||
Jre.max.greater.than.min=Maximum JRE version must be greater than the minimum.\nTo use a certain JRE version, you may set the min/max range to [1.4.2 - 1.4.2_10] for example.
|
||||
Jre.initial.and.max.heap=If you change the initial heap size please also specify the maximum size.
|
||||
Jre.initial.heap=Initial heap size must be greater than 0, leave the field blank to use the JVM default.
|
||||
Jre.max.heap=Maximum heap size cannot be less than the initial size, leave the field blank to use the JVM default.
|
||||
Jre.initial.heap.percent=Initial heap %
|
||||
Jre.max.heap.percent=Maximum heap %
|
||||
Jre.jdkPreference.invalid=Unrecognised value for JDK preference, should be between 0 and 3 inclusive.
|
||||
Jre.jvm.options=JVM arguments
|
||||
Jre.jvm.options.unclosed.quotation=JVM arguments contain an unclosed quotation.
|
||||
Jre.jvm.options.variable=Invalid environment variable reference.
|
||||
|
||||
Msg.startupErr=Startup error message
|
||||
Msg.bundledJreErr=Bundled JRE error message
|
||||
Msg.jreVersionErr=JRE version error message
|
||||
Msg.launcherErr=Launcher error message
|
||||
|
||||
SingleInstance.mutexName=Mutex name
|
||||
SingleInstance.windowTitle=Window title
|
@ -0,0 +1,75 @@
|
||||
#
|
||||
# Launch4j (http://launch4j.sourceforge.net/)
|
||||
# Cross-platform Java application wrapper for creating Windows native executables.
|
||||
#
|
||||
# Copyright (c) 2004, 2007 Grzegorz Kowal, Patricio Mart<72>nez Ros
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the name of the Launch4j nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
Splash.splash.file = Fichero de la pantalla de bienvenida
|
||||
Splash.splash.timeout = Tiempo de espera de la pantalla de bienvenida
|
||||
|
||||
Config.specify.output.exe = Especifique el fichero de salida con extensi\u00F3n .exe.
|
||||
Config.application.jar = Aplicaci\u00F3n jar
|
||||
Config.application.jar.path = Especifique la ruta del jar relativa al ejecutable.
|
||||
Config.chdir.relative = 'Cambiar al directorio' debe ser una ruta relativa al ejecutable.
|
||||
Config.chdir.path = 'Cambiar al directorio' ahora es una ruta en lugar de un booleano, por favor consulte la documentaci\u00F3n.
|
||||
Config.icon = Icono
|
||||
Config.jar.arguments = Argumentos del jar
|
||||
Config.error.title = T\u00EDtulo de error
|
||||
Config.header.type = Tipo de cabecera
|
||||
Config.splash.not.impl.by.console.hdr = La pantalla de bienvenida no est\u00E1 implementada para la cabecera de tipo consola.
|
||||
|
||||
VersionInfo.file.version = La versi\u00F3n del fichero, deber\u00EDa ser 'x.x.x.x'
|
||||
VersionInfo.txt.file.version = Forma libre de versi\u00F3n del fichero
|
||||
VersionInfo.file.description = Descripci\u00F3n del fichero
|
||||
VersionInfo.copyright = Copyright
|
||||
VersionInfo.product.version = Versi\u00F3n del producto, deber\u00EDa ser 'x.x.x.x'
|
||||
VersionInfo.txt.product.version = Forma libre de versi\u00F3n del producto
|
||||
VersionInfo.product.name = Nombre del producto
|
||||
VersionInfo.company.name = Nombre de la organizaci\u00F3n
|
||||
VersionInfo.internal.name = Nombre interno
|
||||
VersionInfo.internal.name.not.exe = El nombre interno no deber\u00EDa tener extensi\u00F3n .exe.
|
||||
VersionInfo.original.filename = Nombre original del fichero
|
||||
VersionInfo.original.filename.exe = El nombre original del fichero debe acabar con extensi\u00F3n .exe.
|
||||
Jre.min.version = La versi\u00F3n m\u00EDnima del JRE deber\u00EDa ser x.x.x[_xx]
|
||||
Jre.max.version = La versi\u00F3n m\u00E1xima del JRE deber\u00EDa ser x.x.x[_xx]
|
||||
Jre.specify.jre.min.version.or.path=Specify minimum JRE version and/or bundled JRE path.
|
||||
Jre.bundled.path.rel = La ruta del JRE debe ser relativa al ejecutable.
|
||||
Jre.specify.min.version = Especifique la versi\u00F3n m\u00EDnima del JRE.
|
||||
Jre.max.greater.than.min = La versi\u00F3n m\u00E1xima del JRE debe ser mayor que la m\u00EDnima.\nPara usar cierta versi\u00F3n del JRE, puede esyablecer el rango m\u00EDnimo/m\u00E1ximo a [1.4.2 - 1.4.2_10], por ejemplo.
|
||||
Jre.jvm.options = Argumentos de la JVM
|
||||
|
||||
Msg.startupErr=Startup error message
|
||||
Msg.bundledJreErr=Bundled JRE error message
|
||||
Msg.jreVersionErr=JRE version error message
|
||||
Msg.launcherErr=Launcher error message
|
||||
|
||||
SingleInstance.mutexName=Mutex name
|
||||
SingleInstance.windowTitle=Window title
|
||||
|
283
build/windows/launcher/launch4j/src/net/sf/launch4j/form/BasicForm.java
Executable file
@ -0,0 +1,283 @@
|
||||
package net.sf.launch4j.form;
|
||||
|
||||
import com.jeta.forms.components.separator.TitledSeparator;
|
||||
import com.jgoodies.forms.layout.CellConstraints;
|
||||
import com.jgoodies.forms.layout.FormLayout;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JRadioButton;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
public abstract class BasicForm extends JPanel
|
||||
{
|
||||
protected final JButton _outfileButton = new JButton();
|
||||
protected final JLabel _outfileLabel = new JLabel();
|
||||
protected final JLabel _iconLabel = new JLabel();
|
||||
protected final JLabel _jarLabel = new JLabel();
|
||||
protected final JButton _jarButton = new JButton();
|
||||
protected final JButton _iconButton = new JButton();
|
||||
protected final JLabel _cmdLineLabel = new JLabel();
|
||||
protected final JLabel _optionsLabel = new JLabel();
|
||||
protected final JLabel _chdirLabel = new JLabel();
|
||||
protected final JLabel _processPriorityLabel = new JLabel();
|
||||
protected final JRadioButton _normalPriorityRadio = new JRadioButton();
|
||||
protected final ButtonGroup _buttongroup1 = new ButtonGroup();
|
||||
protected final JRadioButton _idlePriorityRadio = new JRadioButton();
|
||||
protected final JRadioButton _highPriorityRadio = new JRadioButton();
|
||||
protected final JCheckBox _customProcNameCheck = new JCheckBox();
|
||||
protected final JCheckBox _stayAliveCheck = new JCheckBox();
|
||||
protected final JTextField _cmdLineField = new JTextField();
|
||||
protected final JTextField _chdirField = new JTextField();
|
||||
protected final JTextField _iconField = new JTextField();
|
||||
protected final JCheckBox _dontWrapJarCheck = new JCheckBox();
|
||||
protected final JTextField _jarField = new JTextField();
|
||||
protected final JTextField _outfileField = new JTextField();
|
||||
protected final JLabel _errorTitleLabel = new JLabel();
|
||||
protected final JTextField _errorTitleField = new JTextField();
|
||||
protected final JLabel _downloadUrlLabel = new JLabel();
|
||||
protected final JTextField _downloadUrlField = new JTextField();
|
||||
protected final JLabel _supportUrlLabel = new JLabel();
|
||||
protected final JTextField _supportUrlField = new JTextField();
|
||||
protected final JTextField _manifestField = new JTextField();
|
||||
protected final JButton _manifestButton = new JButton();
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
public BasicForm()
|
||||
{
|
||||
initializePanel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds fill components to empty cells in the first row and first column of the grid.
|
||||
* This ensures that the grid spacing will be the same as shown in the designer.
|
||||
* @param cols an array of column indices in the first row where fill components should be added.
|
||||
* @param rows an array of row indices in the first column where fill components should be added.
|
||||
*/
|
||||
void addFillComponents( Container panel, int[] cols, int[] rows )
|
||||
{
|
||||
Dimension filler = new Dimension(10,10);
|
||||
|
||||
boolean filled_cell_11 = false;
|
||||
CellConstraints cc = new CellConstraints();
|
||||
if ( cols.length > 0 && rows.length > 0 )
|
||||
{
|
||||
if ( cols[0] == 1 && rows[0] == 1 )
|
||||
{
|
||||
/** add a rigid area */
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(1,1) );
|
||||
filled_cell_11 = true;
|
||||
}
|
||||
}
|
||||
|
||||
for( int index = 0; index < cols.length; index++ )
|
||||
{
|
||||
if ( cols[index] == 1 && filled_cell_11 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) );
|
||||
}
|
||||
|
||||
for( int index = 0; index < rows.length; index++ )
|
||||
{
|
||||
if ( rows[index] == 1 && filled_cell_11 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to load an image file from the CLASSPATH
|
||||
* @param imageName the package and name of the file to load relative to the CLASSPATH
|
||||
* @return an ImageIcon instance with the specified image file
|
||||
* @throws IllegalArgumentException if the image resource cannot be loaded.
|
||||
*/
|
||||
public ImageIcon loadImage( String imageName )
|
||||
{
|
||||
try
|
||||
{
|
||||
ClassLoader classloader = getClass().getClassLoader();
|
||||
java.net.URL url = classloader.getResource( imageName );
|
||||
if ( url != null )
|
||||
{
|
||||
ImageIcon icon = new ImageIcon( url );
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
throw new IllegalArgumentException( "Unable to load image: " + imageName );
|
||||
}
|
||||
|
||||
public JPanel createPanel()
|
||||
{
|
||||
JPanel jpanel1 = new JPanel();
|
||||
FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:26PX:NONE,FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE");
|
||||
CellConstraints cc = new CellConstraints();
|
||||
jpanel1.setLayout(formlayout1);
|
||||
|
||||
_outfileButton.setIcon(loadImage("images/open16.png"));
|
||||
_outfileButton.setName("outfileButton");
|
||||
jpanel1.add(_outfileButton,cc.xy(12,2));
|
||||
|
||||
_outfileLabel.setIcon(loadImage("images/asterix.gif"));
|
||||
_outfileLabel.setName("outfileLabel");
|
||||
_outfileLabel.setText(Messages.getString("outfile"));
|
||||
jpanel1.add(_outfileLabel,cc.xy(2,2));
|
||||
|
||||
_iconLabel.setName("iconLabel");
|
||||
_iconLabel.setText(Messages.getString("icon"));
|
||||
jpanel1.add(_iconLabel,cc.xy(2,10));
|
||||
|
||||
_jarLabel.setIcon(loadImage("images/asterix.gif"));
|
||||
_jarLabel.setName("jarLabel");
|
||||
_jarLabel.setText(Messages.getString("jar"));
|
||||
jpanel1.add(_jarLabel,cc.xy(2,4));
|
||||
|
||||
_jarButton.setIcon(loadImage("images/open16.png"));
|
||||
_jarButton.setName("jarButton");
|
||||
jpanel1.add(_jarButton,cc.xy(12,4));
|
||||
|
||||
_iconButton.setIcon(loadImage("images/open16.png"));
|
||||
_iconButton.setName("iconButton");
|
||||
jpanel1.add(_iconButton,cc.xy(12,10));
|
||||
|
||||
_cmdLineLabel.setName("cmdLineLabel");
|
||||
_cmdLineLabel.setText(Messages.getString("cmdLine"));
|
||||
_cmdLineLabel.setToolTipText("");
|
||||
jpanel1.add(_cmdLineLabel,cc.xy(2,14));
|
||||
|
||||
_optionsLabel.setName("optionsLabel");
|
||||
_optionsLabel.setText(Messages.getString("options"));
|
||||
jpanel1.add(_optionsLabel,cc.xy(2,18));
|
||||
|
||||
_chdirLabel.setName("chdirLabel");
|
||||
_chdirLabel.setText(Messages.getString("chdir"));
|
||||
jpanel1.add(_chdirLabel,cc.xy(2,12));
|
||||
|
||||
_processPriorityLabel.setName("processPriorityLabel");
|
||||
_processPriorityLabel.setText(Messages.getString("priority"));
|
||||
jpanel1.add(_processPriorityLabel,cc.xy(2,16));
|
||||
|
||||
_normalPriorityRadio.setActionCommand(Messages.getString("normalPriority"));
|
||||
_normalPriorityRadio.setName("normalPriorityRadio");
|
||||
_normalPriorityRadio.setText(Messages.getString("normalPriority"));
|
||||
_buttongroup1.add(_normalPriorityRadio);
|
||||
jpanel1.add(_normalPriorityRadio,cc.xy(4,16));
|
||||
|
||||
_idlePriorityRadio.setActionCommand(Messages.getString("idlePriority"));
|
||||
_idlePriorityRadio.setName("idlePriorityRadio");
|
||||
_idlePriorityRadio.setText(Messages.getString("idlePriority"));
|
||||
_buttongroup1.add(_idlePriorityRadio);
|
||||
jpanel1.add(_idlePriorityRadio,cc.xy(6,16));
|
||||
|
||||
_highPriorityRadio.setActionCommand(Messages.getString("highPriority"));
|
||||
_highPriorityRadio.setName("highPriorityRadio");
|
||||
_highPriorityRadio.setText(Messages.getString("highPriority"));
|
||||
_buttongroup1.add(_highPriorityRadio);
|
||||
jpanel1.add(_highPriorityRadio,cc.xy(8,16));
|
||||
|
||||
_customProcNameCheck.setActionCommand("Custom process name");
|
||||
_customProcNameCheck.setName("customProcNameCheck");
|
||||
_customProcNameCheck.setText(Messages.getString("customProcName"));
|
||||
jpanel1.add(_customProcNameCheck,cc.xywh(4,18,7,1));
|
||||
|
||||
_stayAliveCheck.setActionCommand("Stay alive after launching a GUI application");
|
||||
_stayAliveCheck.setName("stayAliveCheck");
|
||||
_stayAliveCheck.setText(Messages.getString("stayAlive"));
|
||||
jpanel1.add(_stayAliveCheck,cc.xywh(4,20,7,1));
|
||||
|
||||
_cmdLineField.setName("cmdLineField");
|
||||
_cmdLineField.setToolTipText(Messages.getString("cmdLineTip"));
|
||||
jpanel1.add(_cmdLineField,cc.xywh(4,14,7,1));
|
||||
|
||||
_chdirField.setName("chdirField");
|
||||
_chdirField.setToolTipText(Messages.getString("chdirTip"));
|
||||
jpanel1.add(_chdirField,cc.xywh(4,12,7,1));
|
||||
|
||||
_iconField.setName("iconField");
|
||||
_iconField.setToolTipText(Messages.getString("iconTip"));
|
||||
jpanel1.add(_iconField,cc.xywh(4,10,7,1));
|
||||
|
||||
_dontWrapJarCheck.setActionCommand("Don't wrap the jar, launch it only");
|
||||
_dontWrapJarCheck.setName("dontWrapJarCheck");
|
||||
_dontWrapJarCheck.setText(Messages.getString("dontWrapJar"));
|
||||
jpanel1.add(_dontWrapJarCheck,cc.xywh(4,6,7,1));
|
||||
|
||||
_jarField.setName("jarField");
|
||||
_jarField.setToolTipText(Messages.getString("jarTip"));
|
||||
jpanel1.add(_jarField,cc.xywh(4,4,7,1));
|
||||
|
||||
_outfileField.setName("outfileField");
|
||||
_outfileField.setToolTipText(Messages.getString("outfileTip"));
|
||||
jpanel1.add(_outfileField,cc.xywh(4,2,7,1));
|
||||
|
||||
TitledSeparator titledseparator1 = new TitledSeparator();
|
||||
titledseparator1.setText(Messages.getString("downloadAndSupport"));
|
||||
jpanel1.add(titledseparator1,cc.xywh(2,22,11,1));
|
||||
|
||||
_errorTitleLabel.setName("errorTitleLabel");
|
||||
_errorTitleLabel.setText(Messages.getString("errorTitle"));
|
||||
jpanel1.add(_errorTitleLabel,cc.xy(2,24));
|
||||
|
||||
_errorTitleField.setName("errorTitleField");
|
||||
_errorTitleField.setToolTipText(Messages.getString("errorTitleTip"));
|
||||
jpanel1.add(_errorTitleField,cc.xywh(4,24,7,1));
|
||||
|
||||
_downloadUrlLabel.setIcon(loadImage("images/asterix.gif"));
|
||||
_downloadUrlLabel.setName("downloadUrlLabel");
|
||||
_downloadUrlLabel.setText(Messages.getString("downloadUrl"));
|
||||
jpanel1.add(_downloadUrlLabel,cc.xy(2,26));
|
||||
|
||||
_downloadUrlField.setName("downloadUrlField");
|
||||
jpanel1.add(_downloadUrlField,cc.xywh(4,26,7,1));
|
||||
|
||||
_supportUrlLabel.setName("supportUrlLabel");
|
||||
_supportUrlLabel.setText(Messages.getString("supportUrl"));
|
||||
jpanel1.add(_supportUrlLabel,cc.xy(2,28));
|
||||
|
||||
_supportUrlField.setName("supportUrlField");
|
||||
jpanel1.add(_supportUrlField,cc.xywh(4,28,7,1));
|
||||
|
||||
JLabel jlabel1 = new JLabel();
|
||||
jlabel1.setText(Messages.getString("manifest"));
|
||||
jpanel1.add(jlabel1,cc.xy(2,8));
|
||||
|
||||
_manifestField.setName("manifestField");
|
||||
_manifestField.setToolTipText(Messages.getString("manifestTip"));
|
||||
jpanel1.add(_manifestField,cc.xywh(4,8,7,1));
|
||||
|
||||
_manifestButton.setIcon(loadImage("images/open16.png"));
|
||||
_manifestButton.setName("manifestButton");
|
||||
jpanel1.add(_manifestButton,cc.xy(12,8));
|
||||
|
||||
addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29 });
|
||||
return jpanel1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializer
|
||||
*/
|
||||
protected void initializePanel()
|
||||
{
|
||||
setLayout(new BorderLayout());
|
||||
add(createPanel(), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
|
||||
}
|
BIN
build/windows/launcher/launch4j/src/net/sf/launch4j/form/BasicForm.jfrm
Executable file
193
build/windows/launcher/launch4j/src/net/sf/launch4j/form/ClassPathForm.java
Executable file
@ -0,0 +1,193 @@
|
||||
package net.sf.launch4j.form;
|
||||
|
||||
import com.jgoodies.forms.layout.CellConstraints;
|
||||
import com.jgoodies.forms.layout.FormLayout;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
public abstract class ClassPathForm extends JPanel
|
||||
{
|
||||
protected final JTextField _classpathField = new JTextField();
|
||||
protected final JLabel _classpathFieldLabel = new JLabel();
|
||||
protected final JLabel _classpathListLabel = new JLabel();
|
||||
protected final JList _classpathList = new JList();
|
||||
protected final JLabel _mainclassLabel = new JLabel();
|
||||
protected final JTextField _mainclassField = new JTextField();
|
||||
protected final JButton _acceptClasspathButton = new JButton();
|
||||
protected final JButton _removeClasspathButton = new JButton();
|
||||
protected final JButton _importClasspathButton = new JButton();
|
||||
protected final JButton _classpathUpButton = new JButton();
|
||||
protected final JButton _classpathDownButton = new JButton();
|
||||
protected final JCheckBox _classpathCheck = new JCheckBox();
|
||||
protected final JButton _newClasspathButton = new JButton();
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
public ClassPathForm()
|
||||
{
|
||||
initializePanel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds fill components to empty cells in the first row and first column of the grid.
|
||||
* This ensures that the grid spacing will be the same as shown in the designer.
|
||||
* @param cols an array of column indices in the first row where fill components should be added.
|
||||
* @param rows an array of row indices in the first column where fill components should be added.
|
||||
*/
|
||||
void addFillComponents( Container panel, int[] cols, int[] rows )
|
||||
{
|
||||
Dimension filler = new Dimension(10,10);
|
||||
|
||||
boolean filled_cell_11 = false;
|
||||
CellConstraints cc = new CellConstraints();
|
||||
if ( cols.length > 0 && rows.length > 0 )
|
||||
{
|
||||
if ( cols[0] == 1 && rows[0] == 1 )
|
||||
{
|
||||
/** add a rigid area */
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(1,1) );
|
||||
filled_cell_11 = true;
|
||||
}
|
||||
}
|
||||
|
||||
for( int index = 0; index < cols.length; index++ )
|
||||
{
|
||||
if ( cols[index] == 1 && filled_cell_11 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) );
|
||||
}
|
||||
|
||||
for( int index = 0; index < rows.length; index++ )
|
||||
{
|
||||
if ( rows[index] == 1 && filled_cell_11 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to load an image file from the CLASSPATH
|
||||
* @param imageName the package and name of the file to load relative to the CLASSPATH
|
||||
* @return an ImageIcon instance with the specified image file
|
||||
* @throws IllegalArgumentException if the image resource cannot be loaded.
|
||||
*/
|
||||
public ImageIcon loadImage( String imageName )
|
||||
{
|
||||
try
|
||||
{
|
||||
ClassLoader classloader = getClass().getClassLoader();
|
||||
java.net.URL url = classloader.getResource( imageName );
|
||||
if ( url != null )
|
||||
{
|
||||
ImageIcon icon = new ImageIcon( url );
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
throw new IllegalArgumentException( "Unable to load image: " + imageName );
|
||||
}
|
||||
|
||||
public JPanel createPanel()
|
||||
{
|
||||
JPanel jpanel1 = new JPanel();
|
||||
FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:26PX:NONE,FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE");
|
||||
CellConstraints cc = new CellConstraints();
|
||||
jpanel1.setLayout(formlayout1);
|
||||
|
||||
_classpathField.setName("classpathField");
|
||||
jpanel1.add(_classpathField,cc.xywh(4,11,7,1));
|
||||
|
||||
_classpathFieldLabel.setIcon(loadImage("images/asterix.gif"));
|
||||
_classpathFieldLabel.setName("classpathFieldLabel");
|
||||
_classpathFieldLabel.setText(Messages.getString("editClassPath"));
|
||||
jpanel1.add(_classpathFieldLabel,cc.xy(2,11));
|
||||
|
||||
_classpathListLabel.setName("classpathListLabel");
|
||||
_classpathListLabel.setText(Messages.getString("classPath"));
|
||||
jpanel1.add(_classpathListLabel,cc.xy(2,6));
|
||||
|
||||
_classpathList.setName("classpathList");
|
||||
JScrollPane jscrollpane1 = new JScrollPane();
|
||||
jscrollpane1.setViewportView(_classpathList);
|
||||
jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
jpanel1.add(jscrollpane1,cc.xywh(4,6,7,4));
|
||||
|
||||
_mainclassLabel.setIcon(loadImage("images/asterix.gif"));
|
||||
_mainclassLabel.setName("mainclassLabel");
|
||||
_mainclassLabel.setText(Messages.getString("mainClass"));
|
||||
jpanel1.add(_mainclassLabel,cc.xy(2,4));
|
||||
|
||||
_mainclassField.setName("mainclassField");
|
||||
jpanel1.add(_mainclassField,cc.xywh(4,4,7,1));
|
||||
|
||||
_acceptClasspathButton.setActionCommand("Add");
|
||||
_acceptClasspathButton.setIcon(loadImage("images/ok16.png"));
|
||||
_acceptClasspathButton.setName("acceptClasspathButton");
|
||||
_acceptClasspathButton.setText(Messages.getString("accept"));
|
||||
jpanel1.add(_acceptClasspathButton,cc.xy(8,13));
|
||||
|
||||
_removeClasspathButton.setActionCommand("Remove");
|
||||
_removeClasspathButton.setIcon(loadImage("images/cancel16.png"));
|
||||
_removeClasspathButton.setName("removeClasspathButton");
|
||||
_removeClasspathButton.setText(Messages.getString("remove"));
|
||||
jpanel1.add(_removeClasspathButton,cc.xy(10,13));
|
||||
|
||||
_importClasspathButton.setIcon(loadImage("images/open16.png"));
|
||||
_importClasspathButton.setName("importClasspathButton");
|
||||
_importClasspathButton.setToolTipText(Messages.getString("importClassPath"));
|
||||
jpanel1.add(_importClasspathButton,cc.xy(12,4));
|
||||
|
||||
_classpathUpButton.setIcon(loadImage("images/up16.png"));
|
||||
_classpathUpButton.setName("classpathUpButton");
|
||||
jpanel1.add(_classpathUpButton,cc.xy(12,6));
|
||||
|
||||
_classpathDownButton.setIcon(loadImage("images/down16.png"));
|
||||
_classpathDownButton.setName("classpathDownButton");
|
||||
jpanel1.add(_classpathDownButton,cc.xy(12,8));
|
||||
|
||||
_classpathCheck.setActionCommand("Custom classpath");
|
||||
_classpathCheck.setName("classpathCheck");
|
||||
_classpathCheck.setText(Messages.getString("customClassPath"));
|
||||
jpanel1.add(_classpathCheck,cc.xy(4,2));
|
||||
|
||||
_newClasspathButton.setActionCommand("New");
|
||||
_newClasspathButton.setIcon(loadImage("images/new16.png"));
|
||||
_newClasspathButton.setName("newClasspathButton");
|
||||
_newClasspathButton.setText(Messages.getString("new"));
|
||||
jpanel1.add(_newClasspathButton,cc.xy(6,13));
|
||||
|
||||
addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14 });
|
||||
return jpanel1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializer
|
||||
*/
|
||||
protected void initializePanel()
|
||||
{
|
||||
setLayout(new BorderLayout());
|
||||
add(createPanel(), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
|
||||
}
|
BIN
build/windows/launcher/launch4j/src/net/sf/launch4j/form/ClassPathForm.jfrm
Executable file
132
build/windows/launcher/launch4j/src/net/sf/launch4j/form/ConfigForm.java
Executable file
@ -0,0 +1,132 @@
|
||||
package net.sf.launch4j.form;
|
||||
|
||||
import com.jeta.forms.components.separator.TitledSeparator;
|
||||
import com.jgoodies.forms.layout.CellConstraints;
|
||||
import com.jgoodies.forms.layout.FormLayout;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTabbedPane;
|
||||
import javax.swing.JTextArea;
|
||||
|
||||
public abstract class ConfigForm extends JPanel
|
||||
{
|
||||
protected final JTextArea _logTextArea = new JTextArea();
|
||||
protected final TitledSeparator _logSeparator = new TitledSeparator();
|
||||
protected final JTabbedPane _tab = new JTabbedPane();
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
public ConfigForm()
|
||||
{
|
||||
initializePanel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds fill components to empty cells in the first row and first column of the grid.
|
||||
* This ensures that the grid spacing will be the same as shown in the designer.
|
||||
* @param cols an array of column indices in the first row where fill components should be added.
|
||||
* @param rows an array of row indices in the first column where fill components should be added.
|
||||
*/
|
||||
void addFillComponents( Container panel, int[] cols, int[] rows )
|
||||
{
|
||||
Dimension filler = new Dimension(10,10);
|
||||
|
||||
boolean filled_cell_11 = false;
|
||||
CellConstraints cc = new CellConstraints();
|
||||
if ( cols.length > 0 && rows.length > 0 )
|
||||
{
|
||||
if ( cols[0] == 1 && rows[0] == 1 )
|
||||
{
|
||||
/** add a rigid area */
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(1,1) );
|
||||
filled_cell_11 = true;
|
||||
}
|
||||
}
|
||||
|
||||
for( int index = 0; index < cols.length; index++ )
|
||||
{
|
||||
if ( cols[index] == 1 && filled_cell_11 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) );
|
||||
}
|
||||
|
||||
for( int index = 0; index < rows.length; index++ )
|
||||
{
|
||||
if ( rows[index] == 1 && filled_cell_11 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to load an image file from the CLASSPATH
|
||||
* @param imageName the package and name of the file to load relative to the CLASSPATH
|
||||
* @return an ImageIcon instance with the specified image file
|
||||
* @throws IllegalArgumentException if the image resource cannot be loaded.
|
||||
*/
|
||||
public ImageIcon loadImage( String imageName )
|
||||
{
|
||||
try
|
||||
{
|
||||
ClassLoader classloader = getClass().getClassLoader();
|
||||
java.net.URL url = classloader.getResource( imageName );
|
||||
if ( url != null )
|
||||
{
|
||||
ImageIcon icon = new ImageIcon( url );
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
throw new IllegalArgumentException( "Unable to load image: " + imageName );
|
||||
}
|
||||
|
||||
public JPanel createPanel()
|
||||
{
|
||||
JPanel jpanel1 = new JPanel();
|
||||
FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:3DLU:NONE,FILL:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE");
|
||||
CellConstraints cc = new CellConstraints();
|
||||
jpanel1.setLayout(formlayout1);
|
||||
|
||||
_logTextArea.setName("logTextArea");
|
||||
JScrollPane jscrollpane1 = new JScrollPane();
|
||||
jscrollpane1.setViewportView(_logTextArea);
|
||||
jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
jpanel1.add(jscrollpane1,cc.xy(2,6));
|
||||
|
||||
_logSeparator.setName("logSeparator");
|
||||
_logSeparator.setText(Messages.getString("log"));
|
||||
jpanel1.add(_logSeparator,cc.xy(2,4));
|
||||
|
||||
_tab.setName("tab");
|
||||
jpanel1.add(_tab,cc.xywh(1,2,3,1));
|
||||
|
||||
addFillComponents(jpanel1,new int[]{ 1,2,3 },new int[]{ 1,3,4,5,6,7 });
|
||||
return jpanel1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializer
|
||||
*/
|
||||
protected void initializePanel()
|
||||
{
|
||||
setLayout(new BorderLayout());
|
||||
add(createPanel(), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
|
||||
}
|
BIN
build/windows/launcher/launch4j/src/net/sf/launch4j/form/ConfigForm.jfrm
Executable file
@ -0,0 +1,127 @@
|
||||
package net.sf.launch4j.form;
|
||||
|
||||
import com.jgoodies.forms.layout.CellConstraints;
|
||||
import com.jgoodies.forms.layout.FormLayout;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
|
||||
public abstract class EnvironmentVarsForm extends JPanel
|
||||
{
|
||||
protected final JTextArea _envVarsTextArea = new JTextArea();
|
||||
protected final JLabel _envVarsLabel = new JLabel();
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
public EnvironmentVarsForm()
|
||||
{
|
||||
initializePanel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds fill components to empty cells in the first row and first column of the grid.
|
||||
* This ensures that the grid spacing will be the same as shown in the designer.
|
||||
* @param cols an array of column indices in the first row where fill components should be added.
|
||||
* @param rows an array of row indices in the first column where fill components should be added.
|
||||
*/
|
||||
void addFillComponents( Container panel, int[] cols, int[] rows )
|
||||
{
|
||||
Dimension filler = new Dimension(10,10);
|
||||
|
||||
boolean filled_cell_11 = false;
|
||||
CellConstraints cc = new CellConstraints();
|
||||
if ( cols.length > 0 && rows.length > 0 )
|
||||
{
|
||||
if ( cols[0] == 1 && rows[0] == 1 )
|
||||
{
|
||||
/** add a rigid area */
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(1,1) );
|
||||
filled_cell_11 = true;
|
||||
}
|
||||
}
|
||||
|
||||
for( int index = 0; index < cols.length; index++ )
|
||||
{
|
||||
if ( cols[index] == 1 && filled_cell_11 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) );
|
||||
}
|
||||
|
||||
for( int index = 0; index < rows.length; index++ )
|
||||
{
|
||||
if ( rows[index] == 1 && filled_cell_11 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to load an image file from the CLASSPATH
|
||||
* @param imageName the package and name of the file to load relative to the CLASSPATH
|
||||
* @return an ImageIcon instance with the specified image file
|
||||
* @throws IllegalArgumentException if the image resource cannot be loaded.
|
||||
*/
|
||||
public ImageIcon loadImage( String imageName )
|
||||
{
|
||||
try
|
||||
{
|
||||
ClassLoader classloader = getClass().getClassLoader();
|
||||
java.net.URL url = classloader.getResource( imageName );
|
||||
if ( url != null )
|
||||
{
|
||||
ImageIcon icon = new ImageIcon( url );
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
throw new IllegalArgumentException( "Unable to load image: " + imageName );
|
||||
}
|
||||
|
||||
public JPanel createPanel()
|
||||
{
|
||||
JPanel jpanel1 = new JPanel();
|
||||
FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE");
|
||||
CellConstraints cc = new CellConstraints();
|
||||
jpanel1.setLayout(formlayout1);
|
||||
|
||||
_envVarsTextArea.setName("envVarsTextArea");
|
||||
JScrollPane jscrollpane1 = new JScrollPane();
|
||||
jscrollpane1.setViewportView(_envVarsTextArea);
|
||||
jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
jpanel1.add(jscrollpane1,cc.xy(4,2));
|
||||
|
||||
_envVarsLabel.setName("envVarsLabel");
|
||||
_envVarsLabel.setText(Messages.getString("setVariables"));
|
||||
jpanel1.add(_envVarsLabel,new CellConstraints(2,2,1,1,CellConstraints.DEFAULT,CellConstraints.TOP));
|
||||
|
||||
addFillComponents(jpanel1,new int[]{ 1,2,3,4,5 },new int[]{ 1,2,3 });
|
||||
return jpanel1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializer
|
||||
*/
|
||||
protected void initializePanel()
|
||||
{
|
||||
setLayout(new BorderLayout());
|
||||
add(createPanel(), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
|
||||
}
|
171
build/windows/launcher/launch4j/src/net/sf/launch4j/form/HeaderForm.java
Executable file
@ -0,0 +1,171 @@
|
||||
package net.sf.launch4j.form;
|
||||
|
||||
import com.jeta.forms.components.separator.TitledSeparator;
|
||||
import com.jgoodies.forms.layout.CellConstraints;
|
||||
import com.jgoodies.forms.layout.FormLayout;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JRadioButton;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
|
||||
public abstract class HeaderForm extends JPanel
|
||||
{
|
||||
protected final JLabel _headerTypeLabel = new JLabel();
|
||||
protected final JRadioButton _guiHeaderRadio = new JRadioButton();
|
||||
protected final ButtonGroup _headerButtonGroup = new ButtonGroup();
|
||||
protected final JRadioButton _consoleHeaderRadio = new JRadioButton();
|
||||
protected final JTextArea _headerObjectsTextArea = new JTextArea();
|
||||
protected final JTextArea _libsTextArea = new JTextArea();
|
||||
protected final JCheckBox _headerObjectsCheck = new JCheckBox();
|
||||
protected final JCheckBox _libsCheck = new JCheckBox();
|
||||
protected final TitledSeparator _linkerOptionsSeparator = new TitledSeparator();
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
public HeaderForm()
|
||||
{
|
||||
initializePanel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds fill components to empty cells in the first row and first column of the grid.
|
||||
* This ensures that the grid spacing will be the same as shown in the designer.
|
||||
* @param cols an array of column indices in the first row where fill components should be added.
|
||||
* @param rows an array of row indices in the first column where fill components should be added.
|
||||
*/
|
||||
void addFillComponents( Container panel, int[] cols, int[] rows )
|
||||
{
|
||||
Dimension filler = new Dimension(10,10);
|
||||
|
||||
boolean filled_cell_11 = false;
|
||||
CellConstraints cc = new CellConstraints();
|
||||
if ( cols.length > 0 && rows.length > 0 )
|
||||
{
|
||||
if ( cols[0] == 1 && rows[0] == 1 )
|
||||
{
|
||||
/** add a rigid area */
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(1,1) );
|
||||
filled_cell_11 = true;
|
||||
}
|
||||
}
|
||||
|
||||
for( int index = 0; index < cols.length; index++ )
|
||||
{
|
||||
if ( cols[index] == 1 && filled_cell_11 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) );
|
||||
}
|
||||
|
||||
for( int index = 0; index < rows.length; index++ )
|
||||
{
|
||||
if ( rows[index] == 1 && filled_cell_11 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to load an image file from the CLASSPATH
|
||||
* @param imageName the package and name of the file to load relative to the CLASSPATH
|
||||
* @return an ImageIcon instance with the specified image file
|
||||
* @throws IllegalArgumentException if the image resource cannot be loaded.
|
||||
*/
|
||||
public ImageIcon loadImage( String imageName )
|
||||
{
|
||||
try
|
||||
{
|
||||
ClassLoader classloader = getClass().getClassLoader();
|
||||
java.net.URL url = classloader.getResource( imageName );
|
||||
if ( url != null )
|
||||
{
|
||||
ImageIcon icon = new ImageIcon( url );
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
throw new IllegalArgumentException( "Unable to load image: " + imageName );
|
||||
}
|
||||
|
||||
public JPanel createPanel()
|
||||
{
|
||||
JPanel jpanel1 = new JPanel();
|
||||
FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:DEFAULT:GROW(0.2),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE");
|
||||
CellConstraints cc = new CellConstraints();
|
||||
jpanel1.setLayout(formlayout1);
|
||||
|
||||
_headerTypeLabel.setName("headerTypeLabel");
|
||||
_headerTypeLabel.setText(Messages.getString("headerType"));
|
||||
jpanel1.add(_headerTypeLabel,cc.xy(2,2));
|
||||
|
||||
_guiHeaderRadio.setActionCommand("GUI");
|
||||
_guiHeaderRadio.setName("guiHeaderRadio");
|
||||
_guiHeaderRadio.setText(Messages.getString("gui"));
|
||||
_headerButtonGroup.add(_guiHeaderRadio);
|
||||
jpanel1.add(_guiHeaderRadio,cc.xy(4,2));
|
||||
|
||||
_consoleHeaderRadio.setActionCommand("Console");
|
||||
_consoleHeaderRadio.setName("consoleHeaderRadio");
|
||||
_consoleHeaderRadio.setText(Messages.getString("console"));
|
||||
_headerButtonGroup.add(_consoleHeaderRadio);
|
||||
jpanel1.add(_consoleHeaderRadio,cc.xy(6,2));
|
||||
|
||||
_headerObjectsTextArea.setName("headerObjectsTextArea");
|
||||
JScrollPane jscrollpane1 = new JScrollPane();
|
||||
jscrollpane1.setViewportView(_headerObjectsTextArea);
|
||||
jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
jpanel1.add(jscrollpane1,cc.xywh(4,6,4,1));
|
||||
|
||||
_libsTextArea.setName("libsTextArea");
|
||||
JScrollPane jscrollpane2 = new JScrollPane();
|
||||
jscrollpane2.setViewportView(_libsTextArea);
|
||||
jscrollpane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
jscrollpane2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
jpanel1.add(jscrollpane2,cc.xywh(4,8,4,1));
|
||||
|
||||
_headerObjectsCheck.setActionCommand("Object files");
|
||||
_headerObjectsCheck.setName("headerObjectsCheck");
|
||||
_headerObjectsCheck.setText(Messages.getString("objectFiles"));
|
||||
jpanel1.add(_headerObjectsCheck,new CellConstraints(2,6,1,1,CellConstraints.DEFAULT,CellConstraints.TOP));
|
||||
|
||||
_libsCheck.setActionCommand("w32api");
|
||||
_libsCheck.setName("libsCheck");
|
||||
_libsCheck.setText(Messages.getString("libs"));
|
||||
jpanel1.add(_libsCheck,new CellConstraints(2,8,1,1,CellConstraints.DEFAULT,CellConstraints.TOP));
|
||||
|
||||
_linkerOptionsSeparator.setName("linkerOptionsSeparator");
|
||||
_linkerOptionsSeparator.setText(Messages.getString("linkerOptions"));
|
||||
jpanel1.add(_linkerOptionsSeparator,cc.xywh(2,4,6,1));
|
||||
|
||||
addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8 },new int[]{ 1,2,3,4,5,6,7,8,9 });
|
||||
return jpanel1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializer
|
||||
*/
|
||||
protected void initializePanel()
|
||||
{
|
||||
setLayout(new BorderLayout());
|
||||
add(createPanel(), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
|
||||
}
|
BIN
build/windows/launcher/launch4j/src/net/sf/launch4j/form/HeaderForm.jfrm
Executable file
266
build/windows/launcher/launch4j/src/net/sf/launch4j/form/JreForm.java
Executable file
@ -0,0 +1,266 @@
|
||||
package net.sf.launch4j.form;
|
||||
|
||||
import com.jgoodies.forms.layout.CellConstraints;
|
||||
import com.jgoodies.forms.layout.FormLayout;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
public abstract class JreForm extends JPanel
|
||||
{
|
||||
protected final JLabel _jrePathLabel = new JLabel();
|
||||
protected final JLabel _jreMinLabel = new JLabel();
|
||||
protected final JLabel _jreMaxLabel = new JLabel();
|
||||
protected final JLabel _jvmOptionsTextLabel = new JLabel();
|
||||
protected final JTextField _jrePathField = new JTextField();
|
||||
protected final JTextField _jreMinField = new JTextField();
|
||||
protected final JTextField _jreMaxField = new JTextField();
|
||||
protected final JTextArea _jvmOptionsTextArea = new JTextArea();
|
||||
protected final JLabel _initialHeapSizeLabel = new JLabel();
|
||||
protected final JLabel _maxHeapSizeLabel = new JLabel();
|
||||
protected final JTextField _initialHeapSizeField = new JTextField();
|
||||
protected final JTextField _maxHeapSizeField = new JTextField();
|
||||
protected final JComboBox _varCombo = new JComboBox();
|
||||
protected final JButton _propertyButton = new JButton();
|
||||
protected final JButton _optionButton = new JButton();
|
||||
protected final JButton _envPropertyButton = new JButton();
|
||||
protected final JButton _envOptionButton = new JButton();
|
||||
protected final JTextField _envVarField = new JTextField();
|
||||
protected final JTextField _maxHeapPercentField = new JTextField();
|
||||
protected final JTextField _initialHeapPercentField = new JTextField();
|
||||
protected final JComboBox _jdkPreferenceCombo = new JComboBox();
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
public JreForm()
|
||||
{
|
||||
initializePanel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds fill components to empty cells in the first row and first column of the grid.
|
||||
* This ensures that the grid spacing will be the same as shown in the designer.
|
||||
* @param cols an array of column indices in the first row where fill components should be added.
|
||||
* @param rows an array of row indices in the first column where fill components should be added.
|
||||
*/
|
||||
void addFillComponents( Container panel, int[] cols, int[] rows )
|
||||
{
|
||||
Dimension filler = new Dimension(10,10);
|
||||
|
||||
boolean filled_cell_11 = false;
|
||||
CellConstraints cc = new CellConstraints();
|
||||
if ( cols.length > 0 && rows.length > 0 )
|
||||
{
|
||||
if ( cols[0] == 1 && rows[0] == 1 )
|
||||
{
|
||||
/** add a rigid area */
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(1,1) );
|
||||
filled_cell_11 = true;
|
||||
}
|
||||
}
|
||||
|
||||
for( int index = 0; index < cols.length; index++ )
|
||||
{
|
||||
if ( cols[index] == 1 && filled_cell_11 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) );
|
||||
}
|
||||
|
||||
for( int index = 0; index < rows.length; index++ )
|
||||
{
|
||||
if ( rows[index] == 1 && filled_cell_11 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to load an image file from the CLASSPATH
|
||||
* @param imageName the package and name of the file to load relative to the CLASSPATH
|
||||
* @return an ImageIcon instance with the specified image file
|
||||
* @throws IllegalArgumentException if the image resource cannot be loaded.
|
||||
*/
|
||||
public ImageIcon loadImage( String imageName )
|
||||
{
|
||||
try
|
||||
{
|
||||
ClassLoader classloader = getClass().getClassLoader();
|
||||
java.net.URL url = classloader.getResource( imageName );
|
||||
if ( url != null )
|
||||
{
|
||||
ImageIcon icon = new ImageIcon( url );
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
throw new IllegalArgumentException( "Unable to load image: " + imageName );
|
||||
}
|
||||
|
||||
public JPanel createPanel()
|
||||
{
|
||||
JPanel jpanel1 = new JPanel();
|
||||
FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:60DLU:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:60DLU:NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:50DLU:GROW(1.0),CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE");
|
||||
CellConstraints cc = new CellConstraints();
|
||||
jpanel1.setLayout(formlayout1);
|
||||
|
||||
_jrePathLabel.setName("jrePathLabel");
|
||||
_jrePathLabel.setText(Messages.getString("jrePath"));
|
||||
jpanel1.add(_jrePathLabel,cc.xy(2,2));
|
||||
|
||||
_jreMinLabel.setName("jreMinLabel");
|
||||
_jreMinLabel.setText(Messages.getString("jreMin"));
|
||||
jpanel1.add(_jreMinLabel,cc.xy(2,4));
|
||||
|
||||
_jreMaxLabel.setName("jreMaxLabel");
|
||||
_jreMaxLabel.setText(Messages.getString("jreMax"));
|
||||
jpanel1.add(_jreMaxLabel,cc.xy(2,6));
|
||||
|
||||
_jvmOptionsTextLabel.setName("jvmOptionsTextLabel");
|
||||
_jvmOptionsTextLabel.setText(Messages.getString("jvmOptions"));
|
||||
jpanel1.add(_jvmOptionsTextLabel,new CellConstraints(2,12,1,1,CellConstraints.DEFAULT,CellConstraints.TOP));
|
||||
|
||||
_jrePathField.setName("jrePathField");
|
||||
_jrePathField.setToolTipText(Messages.getString("jrePathTip"));
|
||||
jpanel1.add(_jrePathField,cc.xywh(4,2,7,1));
|
||||
|
||||
_jreMinField.setName("jreMinField");
|
||||
jpanel1.add(_jreMinField,cc.xy(4,4));
|
||||
|
||||
_jreMaxField.setName("jreMaxField");
|
||||
jpanel1.add(_jreMaxField,cc.xy(4,6));
|
||||
|
||||
_jvmOptionsTextArea.setName("jvmOptionsTextArea");
|
||||
_jvmOptionsTextArea.setToolTipText(Messages.getString("jvmOptionsTip"));
|
||||
JScrollPane jscrollpane1 = new JScrollPane();
|
||||
jscrollpane1.setViewportView(_jvmOptionsTextArea);
|
||||
jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
jpanel1.add(jscrollpane1,cc.xywh(4,12,7,1));
|
||||
|
||||
_initialHeapSizeLabel.setName("initialHeapSizeLabel");
|
||||
_initialHeapSizeLabel.setText(Messages.getString("initialHeapSize"));
|
||||
jpanel1.add(_initialHeapSizeLabel,cc.xy(2,8));
|
||||
|
||||
_maxHeapSizeLabel.setName("maxHeapSizeLabel");
|
||||
_maxHeapSizeLabel.setText(Messages.getString("maxHeapSize"));
|
||||
jpanel1.add(_maxHeapSizeLabel,cc.xy(2,10));
|
||||
|
||||
JLabel jlabel1 = new JLabel();
|
||||
jlabel1.setText("MB");
|
||||
jpanel1.add(jlabel1,cc.xy(6,8));
|
||||
|
||||
JLabel jlabel2 = new JLabel();
|
||||
jlabel2.setText("MB");
|
||||
jpanel1.add(jlabel2,cc.xy(6,10));
|
||||
|
||||
_initialHeapSizeField.setName("initialHeapSizeField");
|
||||
jpanel1.add(_initialHeapSizeField,cc.xy(4,8));
|
||||
|
||||
_maxHeapSizeField.setName("maxHeapSizeField");
|
||||
jpanel1.add(_maxHeapSizeField,cc.xy(4,10));
|
||||
|
||||
jpanel1.add(createPanel1(),cc.xywh(2,14,9,1));
|
||||
_maxHeapPercentField.setName("maxHeapPercentField");
|
||||
jpanel1.add(_maxHeapPercentField,cc.xy(8,10));
|
||||
|
||||
_initialHeapPercentField.setName("initialHeapPercentField");
|
||||
jpanel1.add(_initialHeapPercentField,cc.xy(8,8));
|
||||
|
||||
_jdkPreferenceCombo.setName("jdkPreferenceCombo");
|
||||
jpanel1.add(_jdkPreferenceCombo,cc.xywh(8,4,3,1));
|
||||
|
||||
JLabel jlabel3 = new JLabel();
|
||||
jlabel3.setText(Messages.getString("freeMemory"));
|
||||
jpanel1.add(jlabel3,cc.xy(10,8));
|
||||
|
||||
JLabel jlabel4 = new JLabel();
|
||||
jlabel4.setText(Messages.getString("freeMemory"));
|
||||
jpanel1.add(jlabel4,cc.xy(10,10));
|
||||
|
||||
addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 });
|
||||
return jpanel1;
|
||||
}
|
||||
|
||||
public JPanel createPanel1()
|
||||
{
|
||||
JPanel jpanel1 = new JPanel();
|
||||
FormLayout formlayout1 = new FormLayout("RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE");
|
||||
CellConstraints cc = new CellConstraints();
|
||||
jpanel1.setLayout(formlayout1);
|
||||
|
||||
_varCombo.setName("varCombo");
|
||||
jpanel1.add(_varCombo,cc.xy(3,1));
|
||||
|
||||
_propertyButton.setActionCommand("Add");
|
||||
_propertyButton.setIcon(loadImage("images/edit_add16.png"));
|
||||
_propertyButton.setName("propertyButton");
|
||||
_propertyButton.setText(Messages.getString("property"));
|
||||
_propertyButton.setToolTipText(Messages.getString("propertyTip"));
|
||||
jpanel1.add(_propertyButton,cc.xy(5,1));
|
||||
|
||||
_optionButton.setActionCommand("Add");
|
||||
_optionButton.setIcon(loadImage("images/edit_add16.png"));
|
||||
_optionButton.setName("optionButton");
|
||||
_optionButton.setText(Messages.getString("option"));
|
||||
_optionButton.setToolTipText(Messages.getString("optionTip"));
|
||||
jpanel1.add(_optionButton,cc.xy(7,1));
|
||||
|
||||
_envPropertyButton.setActionCommand("Add");
|
||||
_envPropertyButton.setIcon(loadImage("images/edit_add16.png"));
|
||||
_envPropertyButton.setName("envPropertyButton");
|
||||
_envPropertyButton.setText(Messages.getString("property"));
|
||||
_envPropertyButton.setToolTipText(Messages.getString("propertyTip"));
|
||||
jpanel1.add(_envPropertyButton,cc.xy(5,3));
|
||||
|
||||
JLabel jlabel1 = new JLabel();
|
||||
jlabel1.setText(Messages.getString("varsAndRegistry"));
|
||||
jpanel1.add(jlabel1,cc.xy(1,1));
|
||||
|
||||
JLabel jlabel2 = new JLabel();
|
||||
jlabel2.setIcon(loadImage("images/asterix.gif"));
|
||||
jlabel2.setText(Messages.getString("envVar"));
|
||||
jpanel1.add(jlabel2,cc.xy(1,3));
|
||||
|
||||
_envOptionButton.setActionCommand("Add");
|
||||
_envOptionButton.setIcon(loadImage("images/edit_add16.png"));
|
||||
_envOptionButton.setName("envOptionButton");
|
||||
_envOptionButton.setText(Messages.getString("option"));
|
||||
_envOptionButton.setToolTipText(Messages.getString("optionTip"));
|
||||
jpanel1.add(_envOptionButton,cc.xy(7,3));
|
||||
|
||||
_envVarField.setName("envVarField");
|
||||
jpanel1.add(_envVarField,cc.xy(3,3));
|
||||
|
||||
addFillComponents(jpanel1,new int[]{ 2,4,6 },new int[]{ 2 });
|
||||
return jpanel1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializer
|
||||
*/
|
||||
protected void initializePanel()
|
||||
{
|
||||
setLayout(new BorderLayout());
|
||||
add(createPanel(), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
|
||||
}
|
BIN
build/windows/launcher/launch4j/src/net/sf/launch4j/form/JreForm.jfrm
Executable file
55
build/windows/launcher/launch4j/src/net/sf/launch4j/form/Messages.java
Executable file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.sf.launch4j.form;
|
||||
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
class Messages {
|
||||
private static final String BUNDLE_NAME = "net.sf.launch4j.form.messages";
|
||||
|
||||
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
|
||||
.getBundle(BUNDLE_NAME);
|
||||
|
||||
private Messages() {
|
||||
}
|
||||
|
||||
public static String getString(String key) {
|
||||
try {
|
||||
return RESOURCE_BUNDLE.getString(key);
|
||||
} catch (MissingResourceException e) {
|
||||
return '!' + key + '!';
|
||||
}
|
||||
}
|
||||
}
|
183
build/windows/launcher/launch4j/src/net/sf/launch4j/form/MessagesForm.java
Executable file
@ -0,0 +1,183 @@
|
||||
package net.sf.launch4j.form;
|
||||
|
||||
import com.jgoodies.forms.layout.CellConstraints;
|
||||
import com.jgoodies.forms.layout.FormLayout;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
|
||||
public abstract class MessagesForm extends JPanel
|
||||
{
|
||||
protected final JTextArea _startupErrTextArea = new JTextArea();
|
||||
protected final JTextArea _bundledJreErrTextArea = new JTextArea();
|
||||
protected final JTextArea _jreVersionErrTextArea = new JTextArea();
|
||||
protected final JTextArea _launcherErrTextArea = new JTextArea();
|
||||
protected final JCheckBox _messagesCheck = new JCheckBox();
|
||||
protected final JTextArea _instanceAlreadyExistsMsgTextArea = new JTextArea();
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
public MessagesForm()
|
||||
{
|
||||
initializePanel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds fill components to empty cells in the first row and first column of the grid.
|
||||
* This ensures that the grid spacing will be the same as shown in the designer.
|
||||
* @param cols an array of column indices in the first row where fill components should be added.
|
||||
* @param rows an array of row indices in the first column where fill components should be added.
|
||||
*/
|
||||
void addFillComponents( Container panel, int[] cols, int[] rows )
|
||||
{
|
||||
Dimension filler = new Dimension(10,10);
|
||||
|
||||
boolean filled_cell_11 = false;
|
||||
CellConstraints cc = new CellConstraints();
|
||||
if ( cols.length > 0 && rows.length > 0 )
|
||||
{
|
||||
if ( cols[0] == 1 && rows[0] == 1 )
|
||||
{
|
||||
/** add a rigid area */
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(1,1) );
|
||||
filled_cell_11 = true;
|
||||
}
|
||||
}
|
||||
|
||||
for( int index = 0; index < cols.length; index++ )
|
||||
{
|
||||
if ( cols[index] == 1 && filled_cell_11 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) );
|
||||
}
|
||||
|
||||
for( int index = 0; index < rows.length; index++ )
|
||||
{
|
||||
if ( rows[index] == 1 && filled_cell_11 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to load an image file from the CLASSPATH
|
||||
* @param imageName the package and name of the file to load relative to the CLASSPATH
|
||||
* @return an ImageIcon instance with the specified image file
|
||||
* @throws IllegalArgumentException if the image resource cannot be loaded.
|
||||
*/
|
||||
public ImageIcon loadImage( String imageName )
|
||||
{
|
||||
try
|
||||
{
|
||||
ClassLoader classloader = getClass().getClassLoader();
|
||||
java.net.URL url = classloader.getResource( imageName );
|
||||
if ( url != null )
|
||||
{
|
||||
ImageIcon icon = new ImageIcon( url );
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
throw new IllegalArgumentException( "Unable to load image: " + imageName );
|
||||
}
|
||||
|
||||
public JPanel createPanel()
|
||||
{
|
||||
JPanel jpanel1 = new JPanel();
|
||||
FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE");
|
||||
CellConstraints cc = new CellConstraints();
|
||||
jpanel1.setLayout(formlayout1);
|
||||
|
||||
_startupErrTextArea.setName("startupErrTextArea");
|
||||
JScrollPane jscrollpane1 = new JScrollPane();
|
||||
jscrollpane1.setViewportView(_startupErrTextArea);
|
||||
jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
jpanel1.add(jscrollpane1,cc.xy(4,4));
|
||||
|
||||
_bundledJreErrTextArea.setName("bundledJreErrTextArea");
|
||||
JScrollPane jscrollpane2 = new JScrollPane();
|
||||
jscrollpane2.setViewportView(_bundledJreErrTextArea);
|
||||
jscrollpane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
jscrollpane2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
jpanel1.add(jscrollpane2,cc.xy(4,6));
|
||||
|
||||
_jreVersionErrTextArea.setName("jreVersionErrTextArea");
|
||||
_jreVersionErrTextArea.setToolTipText(Messages.getString("jreVersionErrTip"));
|
||||
JScrollPane jscrollpane3 = new JScrollPane();
|
||||
jscrollpane3.setViewportView(_jreVersionErrTextArea);
|
||||
jscrollpane3.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
jscrollpane3.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
jpanel1.add(jscrollpane3,cc.xy(4,8));
|
||||
|
||||
_launcherErrTextArea.setName("launcherErrTextArea");
|
||||
JScrollPane jscrollpane4 = new JScrollPane();
|
||||
jscrollpane4.setViewportView(_launcherErrTextArea);
|
||||
jscrollpane4.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
jscrollpane4.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
jpanel1.add(jscrollpane4,cc.xy(4,10));
|
||||
|
||||
JLabel jlabel1 = new JLabel();
|
||||
jlabel1.setText(Messages.getString("startupErr"));
|
||||
jpanel1.add(jlabel1,new CellConstraints(2,4,1,1,CellConstraints.DEFAULT,CellConstraints.TOP));
|
||||
|
||||
JLabel jlabel2 = new JLabel();
|
||||
jlabel2.setText(Messages.getString("bundledJreErr"));
|
||||
jpanel1.add(jlabel2,new CellConstraints(2,6,1,1,CellConstraints.DEFAULT,CellConstraints.TOP));
|
||||
|
||||
JLabel jlabel3 = new JLabel();
|
||||
jlabel3.setText(Messages.getString("jreVersionErr"));
|
||||
jpanel1.add(jlabel3,new CellConstraints(2,8,1,1,CellConstraints.DEFAULT,CellConstraints.TOP));
|
||||
|
||||
JLabel jlabel4 = new JLabel();
|
||||
jlabel4.setText(Messages.getString("launcherErr"));
|
||||
jpanel1.add(jlabel4,new CellConstraints(2,10,1,1,CellConstraints.DEFAULT,CellConstraints.TOP));
|
||||
|
||||
_messagesCheck.setActionCommand("Add version information");
|
||||
_messagesCheck.setName("messagesCheck");
|
||||
_messagesCheck.setText(Messages.getString("addMessages"));
|
||||
jpanel1.add(_messagesCheck,cc.xy(4,2));
|
||||
|
||||
JLabel jlabel5 = new JLabel();
|
||||
jlabel5.setText(Messages.getString("instanceAlreadyExistsMsg"));
|
||||
jpanel1.add(jlabel5,new CellConstraints(2,12,1,1,CellConstraints.DEFAULT,CellConstraints.TOP));
|
||||
|
||||
_instanceAlreadyExistsMsgTextArea.setName("instanceAlreadyExistsMsgTextArea");
|
||||
_instanceAlreadyExistsMsgTextArea.setToolTipText(Messages.getString("instanceAlreadyExistsMsgTip"));
|
||||
JScrollPane jscrollpane5 = new JScrollPane();
|
||||
jscrollpane5.setViewportView(_instanceAlreadyExistsMsgTextArea);
|
||||
jscrollpane5.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
jscrollpane5.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
jpanel1.add(jscrollpane5,cc.xy(4,12));
|
||||
|
||||
addFillComponents(jpanel1,new int[]{ 1,2,3,4,5 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13 });
|
||||
return jpanel1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializer
|
||||
*/
|
||||
protected void initializePanel()
|
||||
{
|
||||
setLayout(new BorderLayout());
|
||||
add(createPanel(), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
|
||||
}
|
BIN
build/windows/launcher/launch4j/src/net/sf/launch4j/form/MessagesForm.jfrm
Executable file
141
build/windows/launcher/launch4j/src/net/sf/launch4j/form/SingleInstanceForm.java
Executable file
@ -0,0 +1,141 @@
|
||||
package net.sf.launch4j.form;
|
||||
|
||||
import com.jgoodies.forms.layout.CellConstraints;
|
||||
import com.jgoodies.forms.layout.FormLayout;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
public abstract class SingleInstanceForm extends JPanel
|
||||
{
|
||||
protected final JLabel _splashFileLabel = new JLabel();
|
||||
protected final JTextField _mutexNameField = new JTextField();
|
||||
protected final JCheckBox _singleInstanceCheck = new JCheckBox();
|
||||
protected final JTextField _windowTitleField = new JTextField();
|
||||
protected final JLabel _splashFileLabel1 = new JLabel();
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
public SingleInstanceForm()
|
||||
{
|
||||
initializePanel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds fill components to empty cells in the first row and first column of the grid.
|
||||
* This ensures that the grid spacing will be the same as shown in the designer.
|
||||
* @param cols an array of column indices in the first row where fill components should be added.
|
||||
* @param rows an array of row indices in the first column where fill components should be added.
|
||||
*/
|
||||
void addFillComponents( Container panel, int[] cols, int[] rows )
|
||||
{
|
||||
Dimension filler = new Dimension(10,10);
|
||||
|
||||
boolean filled_cell_11 = false;
|
||||
CellConstraints cc = new CellConstraints();
|
||||
if ( cols.length > 0 && rows.length > 0 )
|
||||
{
|
||||
if ( cols[0] == 1 && rows[0] == 1 )
|
||||
{
|
||||
/** add a rigid area */
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(1,1) );
|
||||
filled_cell_11 = true;
|
||||
}
|
||||
}
|
||||
|
||||
for( int index = 0; index < cols.length; index++ )
|
||||
{
|
||||
if ( cols[index] == 1 && filled_cell_11 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) );
|
||||
}
|
||||
|
||||
for( int index = 0; index < rows.length; index++ )
|
||||
{
|
||||
if ( rows[index] == 1 && filled_cell_11 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to load an image file from the CLASSPATH
|
||||
* @param imageName the package and name of the file to load relative to the CLASSPATH
|
||||
* @return an ImageIcon instance with the specified image file
|
||||
* @throws IllegalArgumentException if the image resource cannot be loaded.
|
||||
*/
|
||||
public ImageIcon loadImage( String imageName )
|
||||
{
|
||||
try
|
||||
{
|
||||
ClassLoader classloader = getClass().getClassLoader();
|
||||
java.net.URL url = classloader.getResource( imageName );
|
||||
if ( url != null )
|
||||
{
|
||||
ImageIcon icon = new ImageIcon( url );
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
throw new IllegalArgumentException( "Unable to load image: " + imageName );
|
||||
}
|
||||
|
||||
public JPanel createPanel()
|
||||
{
|
||||
JPanel jpanel1 = new JPanel();
|
||||
FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:60DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE");
|
||||
CellConstraints cc = new CellConstraints();
|
||||
jpanel1.setLayout(formlayout1);
|
||||
|
||||
_splashFileLabel.setIcon(loadImage("images/asterix.gif"));
|
||||
_splashFileLabel.setName("splashFileLabel");
|
||||
_splashFileLabel.setText(Messages.getString("mutexName"));
|
||||
jpanel1.add(_splashFileLabel,cc.xy(2,4));
|
||||
|
||||
_mutexNameField.setName("mutexNameField");
|
||||
_mutexNameField.setToolTipText(Messages.getString("mutexNameTip"));
|
||||
jpanel1.add(_mutexNameField,cc.xywh(4,4,2,1));
|
||||
|
||||
_singleInstanceCheck.setActionCommand("Enable splash screen");
|
||||
_singleInstanceCheck.setName("singleInstanceCheck");
|
||||
_singleInstanceCheck.setText(Messages.getString("enableSingleInstance"));
|
||||
jpanel1.add(_singleInstanceCheck,cc.xywh(4,2,2,1));
|
||||
|
||||
_windowTitleField.setName("windowTitleField");
|
||||
_windowTitleField.setToolTipText(Messages.getString("windowTitleTip"));
|
||||
jpanel1.add(_windowTitleField,cc.xywh(4,6,2,1));
|
||||
|
||||
_splashFileLabel1.setName("splashFileLabel");
|
||||
_splashFileLabel1.setText(Messages.getString("windowTitle"));
|
||||
jpanel1.add(_splashFileLabel1,cc.xy(2,6));
|
||||
|
||||
addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6 },new int[]{ 1,2,3,4,5,6,7 });
|
||||
return jpanel1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializer
|
||||
*/
|
||||
protected void initializePanel()
|
||||
{
|
||||
setLayout(new BorderLayout());
|
||||
add(createPanel(), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
|
||||
}
|
BIN
build/windows/launcher/launch4j/src/net/sf/launch4j/form/SingleInstanceForm.jfrm
Executable file
166
build/windows/launcher/launch4j/src/net/sf/launch4j/form/SplashForm.java
Executable file
@ -0,0 +1,166 @@
|
||||
package net.sf.launch4j.form;
|
||||
|
||||
import com.jgoodies.forms.layout.CellConstraints;
|
||||
import com.jgoodies.forms.layout.FormLayout;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
public abstract class SplashForm extends JPanel
|
||||
{
|
||||
protected final JLabel _splashFileLabel = new JLabel();
|
||||
protected final JLabel _waitForWindowLabel = new JLabel();
|
||||
protected final JLabel _timeoutLabel = new JLabel();
|
||||
protected final JCheckBox _timeoutErrCheck = new JCheckBox();
|
||||
protected final JTextField _splashFileField = new JTextField();
|
||||
protected final JTextField _timeoutField = new JTextField();
|
||||
protected final JButton _splashFileButton = new JButton();
|
||||
protected final JCheckBox _splashCheck = new JCheckBox();
|
||||
protected final JCheckBox _waitForWindowCheck = new JCheckBox();
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
public SplashForm()
|
||||
{
|
||||
initializePanel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds fill components to empty cells in the first row and first column of the grid.
|
||||
* This ensures that the grid spacing will be the same as shown in the designer.
|
||||
* @param cols an array of column indices in the first row where fill components should be added.
|
||||
* @param rows an array of row indices in the first column where fill components should be added.
|
||||
*/
|
||||
void addFillComponents( Container panel, int[] cols, int[] rows )
|
||||
{
|
||||
Dimension filler = new Dimension(10,10);
|
||||
|
||||
boolean filled_cell_11 = false;
|
||||
CellConstraints cc = new CellConstraints();
|
||||
if ( cols.length > 0 && rows.length > 0 )
|
||||
{
|
||||
if ( cols[0] == 1 && rows[0] == 1 )
|
||||
{
|
||||
/** add a rigid area */
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(1,1) );
|
||||
filled_cell_11 = true;
|
||||
}
|
||||
}
|
||||
|
||||
for( int index = 0; index < cols.length; index++ )
|
||||
{
|
||||
if ( cols[index] == 1 && filled_cell_11 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) );
|
||||
}
|
||||
|
||||
for( int index = 0; index < rows.length; index++ )
|
||||
{
|
||||
if ( rows[index] == 1 && filled_cell_11 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to load an image file from the CLASSPATH
|
||||
* @param imageName the package and name of the file to load relative to the CLASSPATH
|
||||
* @return an ImageIcon instance with the specified image file
|
||||
* @throws IllegalArgumentException if the image resource cannot be loaded.
|
||||
*/
|
||||
public ImageIcon loadImage( String imageName )
|
||||
{
|
||||
try
|
||||
{
|
||||
ClassLoader classloader = getClass().getClassLoader();
|
||||
java.net.URL url = classloader.getResource( imageName );
|
||||
if ( url != null )
|
||||
{
|
||||
ImageIcon icon = new ImageIcon( url );
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
throw new IllegalArgumentException( "Unable to load image: " + imageName );
|
||||
}
|
||||
|
||||
public JPanel createPanel()
|
||||
{
|
||||
JPanel jpanel1 = new JPanel();
|
||||
FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:60DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:26PX:NONE,FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE");
|
||||
CellConstraints cc = new CellConstraints();
|
||||
jpanel1.setLayout(formlayout1);
|
||||
|
||||
_splashFileLabel.setIcon(loadImage("images/asterix.gif"));
|
||||
_splashFileLabel.setName("splashFileLabel");
|
||||
_splashFileLabel.setText(Messages.getString("splashFile"));
|
||||
jpanel1.add(_splashFileLabel,cc.xy(2,4));
|
||||
|
||||
_waitForWindowLabel.setName("waitForWindowLabel");
|
||||
_waitForWindowLabel.setText(Messages.getString("waitForWindow"));
|
||||
jpanel1.add(_waitForWindowLabel,cc.xy(2,6));
|
||||
|
||||
_timeoutLabel.setIcon(loadImage("images/asterix.gif"));
|
||||
_timeoutLabel.setName("timeoutLabel");
|
||||
_timeoutLabel.setText(Messages.getString("timeout"));
|
||||
jpanel1.add(_timeoutLabel,cc.xy(2,8));
|
||||
|
||||
_timeoutErrCheck.setActionCommand("Signal error on timeout");
|
||||
_timeoutErrCheck.setName("timeoutErrCheck");
|
||||
_timeoutErrCheck.setText(Messages.getString("timeoutErr"));
|
||||
_timeoutErrCheck.setToolTipText(Messages.getString("timeoutErrTip"));
|
||||
jpanel1.add(_timeoutErrCheck,cc.xywh(4,10,2,1));
|
||||
|
||||
_splashFileField.setName("splashFileField");
|
||||
_splashFileField.setToolTipText(Messages.getString("splashFileTip"));
|
||||
jpanel1.add(_splashFileField,cc.xywh(4,4,2,1));
|
||||
|
||||
_timeoutField.setName("timeoutField");
|
||||
_timeoutField.setToolTipText(Messages.getString("timeoutTip"));
|
||||
jpanel1.add(_timeoutField,cc.xy(4,8));
|
||||
|
||||
_splashFileButton.setIcon(loadImage("images/open16.png"));
|
||||
_splashFileButton.setName("splashFileButton");
|
||||
jpanel1.add(_splashFileButton,cc.xy(7,4));
|
||||
|
||||
_splashCheck.setActionCommand("Enable splash screen");
|
||||
_splashCheck.setName("splashCheck");
|
||||
_splashCheck.setText(Messages.getString("enableSplash"));
|
||||
jpanel1.add(_splashCheck,cc.xywh(4,2,2,1));
|
||||
|
||||
_waitForWindowCheck.setActionCommand("Close splash screen when an application window appears");
|
||||
_waitForWindowCheck.setName("waitForWindowCheck");
|
||||
_waitForWindowCheck.setText(Messages.getString("waitForWindowText"));
|
||||
jpanel1.add(_waitForWindowCheck,cc.xywh(4,6,2,1));
|
||||
|
||||
addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11 });
|
||||
return jpanel1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializer
|
||||
*/
|
||||
protected void initializePanel()
|
||||
{
|
||||
setLayout(new BorderLayout());
|
||||
add(createPanel(), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
|
||||
}
|
BIN
build/windows/launcher/launch4j/src/net/sf/launch4j/form/SplashForm.jfrm
Executable file
232
build/windows/launcher/launch4j/src/net/sf/launch4j/form/VersionInfoForm.java
Executable file
@ -0,0 +1,232 @@
|
||||
package net.sf.launch4j.form;
|
||||
|
||||
import com.jeta.forms.components.separator.TitledSeparator;
|
||||
import com.jgoodies.forms.layout.CellConstraints;
|
||||
import com.jgoodies.forms.layout.FormLayout;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
public abstract class VersionInfoForm extends JPanel
|
||||
{
|
||||
protected final JCheckBox _versionInfoCheck = new JCheckBox();
|
||||
protected final JLabel _fileVersionLabel = new JLabel();
|
||||
protected final JTextField _fileVersionField = new JTextField();
|
||||
protected final TitledSeparator _addVersionInfoSeparator = new TitledSeparator();
|
||||
protected final JLabel _productVersionLabel = new JLabel();
|
||||
protected final JTextField _productVersionField = new JTextField();
|
||||
protected final JLabel _fileDescriptionLabel = new JLabel();
|
||||
protected final JTextField _fileDescriptionField = new JTextField();
|
||||
protected final JLabel _copyrightLabel = new JLabel();
|
||||
protected final JTextField _copyrightField = new JTextField();
|
||||
protected final JLabel _txtFileVersionLabel = new JLabel();
|
||||
protected final JTextField _txtFileVersionField = new JTextField();
|
||||
protected final JLabel _txtProductVersionLabel = new JLabel();
|
||||
protected final JTextField _txtProductVersionField = new JTextField();
|
||||
protected final JLabel _productNameLabel = new JLabel();
|
||||
protected final JTextField _productNameField = new JTextField();
|
||||
protected final JLabel _originalFilenameLabel = new JLabel();
|
||||
protected final JTextField _originalFilenameField = new JTextField();
|
||||
protected final JLabel _internalNameLabel = new JLabel();
|
||||
protected final JTextField _internalNameField = new JTextField();
|
||||
protected final JLabel _companyNameLabel = new JLabel();
|
||||
protected final JTextField _companyNameField = new JTextField();
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
public VersionInfoForm()
|
||||
{
|
||||
initializePanel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds fill components to empty cells in the first row and first column of the grid.
|
||||
* This ensures that the grid spacing will be the same as shown in the designer.
|
||||
* @param cols an array of column indices in the first row where fill components should be added.
|
||||
* @param rows an array of row indices in the first column where fill components should be added.
|
||||
*/
|
||||
void addFillComponents( Container panel, int[] cols, int[] rows )
|
||||
{
|
||||
Dimension filler = new Dimension(10,10);
|
||||
|
||||
boolean filled_cell_11 = false;
|
||||
CellConstraints cc = new CellConstraints();
|
||||
if ( cols.length > 0 && rows.length > 0 )
|
||||
{
|
||||
if ( cols[0] == 1 && rows[0] == 1 )
|
||||
{
|
||||
/** add a rigid area */
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(1,1) );
|
||||
filled_cell_11 = true;
|
||||
}
|
||||
}
|
||||
|
||||
for( int index = 0; index < cols.length; index++ )
|
||||
{
|
||||
if ( cols[index] == 1 && filled_cell_11 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) );
|
||||
}
|
||||
|
||||
for( int index = 0; index < rows.length; index++ )
|
||||
{
|
||||
if ( rows[index] == 1 && filled_cell_11 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to load an image file from the CLASSPATH
|
||||
* @param imageName the package and name of the file to load relative to the CLASSPATH
|
||||
* @return an ImageIcon instance with the specified image file
|
||||
* @throws IllegalArgumentException if the image resource cannot be loaded.
|
||||
*/
|
||||
public ImageIcon loadImage( String imageName )
|
||||
{
|
||||
try
|
||||
{
|
||||
ClassLoader classloader = getClass().getClassLoader();
|
||||
java.net.URL url = classloader.getResource( imageName );
|
||||
if ( url != null )
|
||||
{
|
||||
ImageIcon icon = new ImageIcon( url );
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
throw new IllegalArgumentException( "Unable to load image: " + imageName );
|
||||
}
|
||||
|
||||
public JPanel createPanel()
|
||||
{
|
||||
JPanel jpanel1 = new JPanel();
|
||||
FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:60DLU:NONE,FILL:7DLU:NONE,RIGHT:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE");
|
||||
CellConstraints cc = new CellConstraints();
|
||||
jpanel1.setLayout(formlayout1);
|
||||
|
||||
_versionInfoCheck.setActionCommand("Add version information");
|
||||
_versionInfoCheck.setName("versionInfoCheck");
|
||||
_versionInfoCheck.setText(Messages.getString("addVersionInfo"));
|
||||
jpanel1.add(_versionInfoCheck,cc.xywh(4,2,5,1));
|
||||
|
||||
_fileVersionLabel.setIcon(loadImage("images/asterix.gif"));
|
||||
_fileVersionLabel.setName("fileVersionLabel");
|
||||
_fileVersionLabel.setText(Messages.getString("fileVersion"));
|
||||
jpanel1.add(_fileVersionLabel,cc.xy(2,4));
|
||||
|
||||
_fileVersionField.setName("fileVersionField");
|
||||
_fileVersionField.setToolTipText(Messages.getString("fileVersionTip"));
|
||||
jpanel1.add(_fileVersionField,cc.xy(4,4));
|
||||
|
||||
_addVersionInfoSeparator.setName("addVersionInfoSeparator");
|
||||
_addVersionInfoSeparator.setText("Additional information");
|
||||
jpanel1.add(_addVersionInfoSeparator,cc.xywh(2,10,7,1));
|
||||
|
||||
_productVersionLabel.setIcon(loadImage("images/asterix.gif"));
|
||||
_productVersionLabel.setName("productVersionLabel");
|
||||
_productVersionLabel.setText(Messages.getString("productVersion"));
|
||||
jpanel1.add(_productVersionLabel,cc.xy(2,12));
|
||||
|
||||
_productVersionField.setName("productVersionField");
|
||||
_productVersionField.setToolTipText(Messages.getString("productVersionTip"));
|
||||
jpanel1.add(_productVersionField,cc.xy(4,12));
|
||||
|
||||
_fileDescriptionLabel.setIcon(loadImage("images/asterix.gif"));
|
||||
_fileDescriptionLabel.setName("fileDescriptionLabel");
|
||||
_fileDescriptionLabel.setText(Messages.getString("fileDescription"));
|
||||
jpanel1.add(_fileDescriptionLabel,cc.xy(2,6));
|
||||
|
||||
_fileDescriptionField.setName("fileDescriptionField");
|
||||
_fileDescriptionField.setToolTipText(Messages.getString("fileDescriptionTip"));
|
||||
jpanel1.add(_fileDescriptionField,cc.xywh(4,6,5,1));
|
||||
|
||||
_copyrightLabel.setIcon(loadImage("images/asterix.gif"));
|
||||
_copyrightLabel.setName("copyrightLabel");
|
||||
_copyrightLabel.setText(Messages.getString("copyright"));
|
||||
jpanel1.add(_copyrightLabel,cc.xy(2,8));
|
||||
|
||||
_copyrightField.setName("copyrightField");
|
||||
jpanel1.add(_copyrightField,cc.xywh(4,8,5,1));
|
||||
|
||||
_txtFileVersionLabel.setIcon(loadImage("images/asterix.gif"));
|
||||
_txtFileVersionLabel.setName("txtFileVersionLabel");
|
||||
_txtFileVersionLabel.setText(Messages.getString("txtFileVersion"));
|
||||
jpanel1.add(_txtFileVersionLabel,cc.xy(6,4));
|
||||
|
||||
_txtFileVersionField.setName("txtFileVersionField");
|
||||
_txtFileVersionField.setToolTipText(Messages.getString("txtFileVersionTip"));
|
||||
jpanel1.add(_txtFileVersionField,cc.xy(8,4));
|
||||
|
||||
_txtProductVersionLabel.setIcon(loadImage("images/asterix.gif"));
|
||||
_txtProductVersionLabel.setName("txtProductVersionLabel");
|
||||
_txtProductVersionLabel.setText(Messages.getString("txtProductVersion"));
|
||||
jpanel1.add(_txtProductVersionLabel,cc.xy(6,12));
|
||||
|
||||
_txtProductVersionField.setName("txtProductVersionField");
|
||||
_txtProductVersionField.setToolTipText(Messages.getString("txtProductVersionTip"));
|
||||
jpanel1.add(_txtProductVersionField,cc.xy(8,12));
|
||||
|
||||
_productNameLabel.setIcon(loadImage("images/asterix.gif"));
|
||||
_productNameLabel.setName("productNameLabel");
|
||||
_productNameLabel.setText(Messages.getString("productName"));
|
||||
jpanel1.add(_productNameLabel,cc.xy(2,14));
|
||||
|
||||
_productNameField.setName("productNameField");
|
||||
jpanel1.add(_productNameField,cc.xywh(4,14,5,1));
|
||||
|
||||
_originalFilenameLabel.setIcon(loadImage("images/asterix.gif"));
|
||||
_originalFilenameLabel.setName("originalFilenameLabel");
|
||||
_originalFilenameLabel.setText(Messages.getString("originalFilename"));
|
||||
jpanel1.add(_originalFilenameLabel,cc.xy(2,20));
|
||||
|
||||
_originalFilenameField.setName("originalFilenameField");
|
||||
_originalFilenameField.setToolTipText(Messages.getString("originalFilenameTip"));
|
||||
jpanel1.add(_originalFilenameField,cc.xywh(4,20,5,1));
|
||||
|
||||
_internalNameLabel.setIcon(loadImage("images/asterix.gif"));
|
||||
_internalNameLabel.setName("internalNameLabel");
|
||||
_internalNameLabel.setText(Messages.getString("internalName"));
|
||||
jpanel1.add(_internalNameLabel,cc.xy(2,18));
|
||||
|
||||
_internalNameField.setName("internalNameField");
|
||||
_internalNameField.setToolTipText(Messages.getString("internalNameTip"));
|
||||
jpanel1.add(_internalNameField,cc.xywh(4,18,5,1));
|
||||
|
||||
_companyNameLabel.setName("companyNameLabel");
|
||||
_companyNameLabel.setText(Messages.getString("companyName"));
|
||||
jpanel1.add(_companyNameLabel,cc.xy(2,16));
|
||||
|
||||
_companyNameField.setName("companyNameField");
|
||||
jpanel1.add(_companyNameField,cc.xywh(4,16,5,1));
|
||||
|
||||
addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21 });
|
||||
return jpanel1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializer
|
||||
*/
|
||||
protected void initializePanel()
|
||||
{
|
||||
setLayout(new BorderLayout());
|
||||
add(createPanel(), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
|
||||
}
|
BIN
build/windows/launcher/launch4j/src/net/sf/launch4j/form/VersionInfoForm.jfrm
Executable file
146
build/windows/launcher/launch4j/src/net/sf/launch4j/form/messages.properties
Executable file
@ -0,0 +1,146 @@
|
||||
#
|
||||
# Launch4j (http://launch4j.sourceforge.net/)
|
||||
# Cross-platform Java application wrapper for creating Windows native executables.
|
||||
#
|
||||
# Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the name of the Launch4j nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
log=Log
|
||||
|
||||
outfile=Output file:
|
||||
outfileTip=Output executable file.
|
||||
customProcName=Custom process name and XP style manifest
|
||||
stayAlive=Stay alive after launching a GUI application
|
||||
manifest=Manifest:
|
||||
manifestTip=Wrapper's manifest for User Account Control, will not enable XP styles!
|
||||
icon=Icon:
|
||||
iconTip=Application icon.
|
||||
jar=Jar:
|
||||
jarTip=Application jar.
|
||||
dontWrapJar=Dont't wrap the jar, launch only
|
||||
cmdLine=Command line args:
|
||||
cmdLineTip=Constant command line arguments passed to the application.
|
||||
options=Options:
|
||||
chdir=Change dir:
|
||||
chdirTip=Change current directory to a location relative to the executable. Empty field has no effect, . - changes directory to the exe location.
|
||||
priority=Process priority:
|
||||
normalPriority=Normal
|
||||
idlePriority=Idle
|
||||
highPriority=High
|
||||
downloadAndSupport=Java download and support
|
||||
errorTitle=Error title:
|
||||
errorTitleTip=Launch4j signals errors using a message box, you can set it's title to the application's name.
|
||||
downloadUrl=Java download URL:
|
||||
supportUrl=Support URL:
|
||||
|
||||
new=New
|
||||
accept=Accept
|
||||
remove=Remove
|
||||
customClassPath=Custom classpath
|
||||
classPath=Classpath:
|
||||
mainClass=Main class:
|
||||
editClassPath=Edit item:
|
||||
importClassPath=Import attributes from a jar's manifest.
|
||||
|
||||
headerType=Header type:
|
||||
gui=GUI
|
||||
console=Console
|
||||
objectFiles=Object files:
|
||||
libs=w32api:
|
||||
linkerOptions=Custom header - linker options
|
||||
|
||||
enableSingleInstance=Allow only a single instance of the application
|
||||
mutexName=Mutex name
|
||||
mutexNameTip=Mutex name that will uniquely identify your application.
|
||||
windowTitle=Window title
|
||||
windowTitleTip=Title of the GUI application window to bring up on attempt to start a next instance.
|
||||
|
||||
jrePath=Bundled JRE path:
|
||||
jrePathTip=Bundled JRE path relative to the executable or absolute.
|
||||
jreMin=Min JRE version:
|
||||
jreMax=Max JRE version:
|
||||
dontUsePrivateJres=Don't use private JREs
|
||||
jvmOptions=JVM options:
|
||||
jvmOptionsTip=Accepts everything you would normally pass to java/javaw launcher: assertion options, system properties and X options.
|
||||
initialHeapSize=Initial heap size:
|
||||
maxHeapSize=Max heap size:
|
||||
freeMemory=% of free memory
|
||||
jdkPreference=JDK/JRE preference:
|
||||
addVariables=Add variables:
|
||||
addVariablesTip=Add special variable or map environment variables to system properties.
|
||||
exeDirVarTip=Executable's runtime directory path.
|
||||
exeFileVarTip=Executable's runtime file path (directory and filename).
|
||||
varsAndRegistry=Variables / registry:
|
||||
envVar=Environment var:
|
||||
property=Property
|
||||
propertyTip=Map a variable to a system property.
|
||||
option=Option
|
||||
optionTip=Pass a JVM option using a variable.
|
||||
|
||||
setVariables=Set variables:
|
||||
|
||||
enableSplash=Enable splash screen
|
||||
splashFile=Splash file:
|
||||
splashFileTip=Splash screen file in BMP format.
|
||||
waitForWindow=Wait for window
|
||||
waitForWindowText=Close splash screen when an application window appears
|
||||
timeout=Timeout [s]:
|
||||
timeoutTip=Number of seconds after which the splash screen must close. Splash timeout may cause an error depending on splashTimeoutErr property.
|
||||
timeoutErr=Signal error on timeout
|
||||
timeoutErrTip=True signals an error on splash timeout, false closes the splash screen quietly.
|
||||
|
||||
version=Version
|
||||
additionalInfo=Additional information
|
||||
addVersionInfo=Add version information
|
||||
fileVersion=File version:
|
||||
fileVersionTip=Version number 'x.x.x.x'
|
||||
productVersion=Product version:
|
||||
productVersionTip=Version number 'x.x.x.x'
|
||||
fileDescription=File description:
|
||||
fileDescriptionTip=File description presented to the user.
|
||||
copyright=Copyright:
|
||||
txtFileVersion=Free form:
|
||||
txtFileVersionTip=Free form file version, for example '1.20.RC1'.
|
||||
txtProductVersion=Free form:
|
||||
txtProductVersionTip=Free form product version, for example '1.20.RC1'.
|
||||
productName=Product name:
|
||||
originalFilename=Original filename:
|
||||
originalFilenameTip=Original name of the file without the path. Allows to determine whether a file has been renamed by a user.
|
||||
internalName=Internal name:
|
||||
internalNameTip=Internal name without extension, original filename or module name for example.
|
||||
companyName=Company name:
|
||||
|
||||
addMessages=Add custom messages
|
||||
startupErr=Startup error:
|
||||
bundledJreErr=Bundled JRE error:
|
||||
jreVersionErr=JRE version error:
|
||||
jreVersionErrTip=Launch4j will append the required version number at the end of this message.
|
||||
launcherErr=Launcher error:
|
||||
instanceAlreadyExistsMsg=Inst. already exists:
|
||||
instanceAlreadyExistsMsgTip=Message displayed by single instance console applications if an instance already exists.
|
118
build/windows/launcher/launch4j/src/net/sf/launch4j/form/messages_es.properties
Executable file
@ -0,0 +1,118 @@
|
||||
#
|
||||
# Launch4j (http://launch4j.sourceforge.net/)
|
||||
# Cross-platform Java application wrapper for creating Windows native executables.
|
||||
#
|
||||
# Copyright (c) 2004, 2007 Grzegorz Kowal, Patricio Mart<72>nez Ros
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the name of the Launch4j nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
log = Registro
|
||||
|
||||
outfile = Fichero de salida
|
||||
outfileTip = Fichero ejecutable de salida.
|
||||
errorTitle = T\u00EDtulo de error
|
||||
errorTitleTip = Launch4j indica los errores usando una ventana de mensaje, usted puede ponerle el nombre de la aplicaci\u00F3n a esta ventana.
|
||||
customProcName = Nombre personalizado del proceso
|
||||
stayAlive = Mantener abierto despu\u00E9s de lanzar una aplicaci\u00F3n GUI
|
||||
icon = Icono
|
||||
iconTip = Icono de la aplicaci\u00F3n.
|
||||
jar = Jar
|
||||
jarTip = Jar de la aplicaci\u00F3n.
|
||||
dontWrapJar = No empaquetar el jar, s\u00F3lo lanzar
|
||||
cmdLine = Argumentos del jar
|
||||
cmdLine = Argumentos de l\u00EDnea de \u00F3rdenes pasados a la aplicaci\u00F3n.
|
||||
options = Opciones
|
||||
chdir = Cambiar al directorio
|
||||
chdirTip = Cambia el directorio actual a la localizaci\u00F3n relativa al ejecutable. Si el campo se deja vac\u00EDo, no tiene efecto, . - cambia el directorio a la localizaci\u00F3n del exe.
|
||||
headerType = Tipo de cabecera
|
||||
gui = GUI
|
||||
console = Consola
|
||||
objectFiles = Ficheros objeto
|
||||
libs = w32api
|
||||
linkerOptions = Cabecera personalizada - opciones del enlazador
|
||||
jrePath = Ruta del JRE
|
||||
jrePathTip = Ruta relativa al ejecutable del JRE.
|
||||
jreMin = Versi\u00F3n m\u00EDnima del JRE
|
||||
jreMax = Versi\u00F3n m\u00E1xima del JRE
|
||||
jvmOptions = Argumentos de la JVM
|
||||
jvmOptionsTip = Acepta cualquier argumento que normalmente se le pasar\u00EDa al lanzador java/javaw\: opciones assertion, propiedades de sistema y opciones X.
|
||||
initialHeapSize = Tama\u00F1o inicial de la pila
|
||||
maxHeapSize = Tama\u00F1o m\u00E1ximo de la pila
|
||||
freeMemory=% of free memory
|
||||
addVariables = A\u00F1adir variables
|
||||
addVariablesTip = A\u00F1adir una variable especial o mapear variables de entorno a las propiedades del sistema.
|
||||
exeDirVarTip = Ruta del directorio del ejecutable.
|
||||
exeFileVarTip = Ruta del fichero ejecutable (directorio y nombre del fichero).
|
||||
other = Otra
|
||||
otherTip = Mapear una variable de entorno a una propiedad del sistema.
|
||||
otherVarTip = Variable de entorno que mapear.
|
||||
add = A\u00F1adir
|
||||
specifyVar = Especificar variable de entorno que a\u00F1adir.
|
||||
enableSplash = Activar pantalla de bienvenida
|
||||
splashFile = Imagen
|
||||
splashFileTip = Imagen en formato BMP para la pantalla de bienvenida.
|
||||
waitForWindow = Esperar la ventana
|
||||
waitForWindowText = Cerrar la pantalla de bienvenida cuando aparezca una ventana de la aplicaci\u00F3n
|
||||
timeout = Tiempo de espera [s]
|
||||
timeoutTip = Numero de segundos despu\u00E9s de los que la pantalla de bienvenida se debe cerrar. Esta propiedad puede causar provocar un error dependiendo de la propiedad splashTimeoutErr.
|
||||
timeoutErr = Se\u00F1al de error asociada al tiempo de espera
|
||||
timeoutErrTip = Marcado (true) se\u00F1ala un error despu\u00E9s del tiempo de espera de la pantalla de bienvenida, no marcado (false) cierra la pantalla de bienvenida silenciosamente
|
||||
addVersionInfo = A\u00F1ade informaci\u00F3n sobre la versi\u00F3n
|
||||
fileVersion = Versi\u00F3n del fichero
|
||||
fileVersionTip = N\u00FAmero de versi\u00F3n 'x.x.x.x'
|
||||
additionalInfo = Informaci\u00F3n adicional
|
||||
productVersion = Versi\u00F3n del producto
|
||||
productVersionTip = N\u00FAmero de versi\u00F3n 'x.x.x.x'
|
||||
fileDescription = Descripci\u00F3n del fichero
|
||||
fileDescriptionTip = Descripci\u00F3n del fichero que se le muestra al usuario.
|
||||
copyright = Copyright
|
||||
txtFileVersion = Forma libre
|
||||
txtFileVersionTip = Forma libre de versi\u00F3n, por ejemplo '1.20.RC1'.
|
||||
txtProductVersion = Forma libre
|
||||
txtProductVersionTip = Forma libre del producto, por ejemplo '1.20.RC1'.
|
||||
productName = Nombre del producto
|
||||
originalFilename = Nombre original del fichero
|
||||
originalFilenameTip = Nombre original del fichero sin la ruta. Permite determinar si un fichero ha sido renombrado por un usuario.
|
||||
internalName = Nombre interno
|
||||
internalNameTip = Nombre interno sin extensi\u00F3n, el nombre original del fichero o el m\u00F3dulo, por ejemplo.
|
||||
companyName = Nombre de la organizaci\u00F3n
|
||||
|
||||
addMessages=Add custom messages
|
||||
startupErr=Startup error:
|
||||
bundledJreErr=Bundled JRE error:
|
||||
jreVersionErr=JRE version error:
|
||||
jreVersionErrTip=Launch4j will append the required version number at the end of this message.
|
||||
launcherErr=Launcher error:
|
||||
instanceAlreadyExistsMsg=Inst. already exists:
|
||||
instanceAlreadyExistsMsgTip=Message displayed by single instance console applications if an instance already exists.
|
||||
|
||||
enableSingleInstance=Allow only a single instance of the application
|
||||
mutexName=Mutex name
|
||||
mutexNameTip=Mutex name that will uniquely identify your application.
|
||||
windowTitle=Window title
|
||||
windowTitleTip=Title of the application window to bring up on attempt to start a next instance.
|
@ -0,0 +1,75 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on May 1, 2006
|
||||
*/
|
||||
package net.sf.launch4j.formimpl;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import net.sf.launch4j.binding.Binding;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2006 Grzegorz Kowal
|
||||
*/
|
||||
public abstract class AbstractAcceptListener implements ActionListener {
|
||||
final JTextField _field;
|
||||
|
||||
public AbstractAcceptListener(JTextField f, boolean listen) {
|
||||
_field = f;
|
||||
if (listen) {
|
||||
_field.addActionListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getText() {
|
||||
return _field.getText();
|
||||
}
|
||||
|
||||
protected void clear() {
|
||||
_field.setText("");
|
||||
_field.requestFocusInWindow();
|
||||
}
|
||||
|
||||
protected void signalViolation(String msg) {
|
||||
final Color bg = _field.getBackground();
|
||||
_field.setBackground(Binding.INVALID_COLOR);
|
||||
MainFrame.getInstance().warn(msg);
|
||||
_field.setBackground(bg);
|
||||
_field.requestFocusInWindow();
|
||||
}
|
||||
}
|
101
build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/BasicFormImpl.java
Executable file
@ -0,0 +1,101 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on May 1, 2006
|
||||
*/
|
||||
package net.sf.launch4j.formimpl;
|
||||
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JRadioButton;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import net.sf.launch4j.FileChooserFilter;
|
||||
import net.sf.launch4j.binding.Bindings;
|
||||
import net.sf.launch4j.config.Config;
|
||||
import net.sf.launch4j.form.BasicForm;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2006 Grzegorz Kowal
|
||||
*/
|
||||
public class BasicFormImpl extends BasicForm {
|
||||
|
||||
public BasicFormImpl(Bindings bindings, JFileChooser fc) {
|
||||
bindings.add("outfile", _outfileField)
|
||||
.add("dontWrapJar", _dontWrapJarCheck)
|
||||
.add("jar", _jarField)
|
||||
.add("manifest", _manifestField)
|
||||
.add("icon", _iconField)
|
||||
.add("cmdLine", _cmdLineField)
|
||||
.add("errTitle", _errorTitleField)
|
||||
.add("downloadUrl", _downloadUrlField, Config.DOWNLOAD_URL)
|
||||
.add("supportUrl", _supportUrlField)
|
||||
.add("chdir", _chdirField)
|
||||
.add("priorityIndex", new JRadioButton[] { _normalPriorityRadio,
|
||||
_idlePriorityRadio,
|
||||
_highPriorityRadio })
|
||||
.add("customProcName", _customProcNameCheck)
|
||||
.add("stayAlive", _stayAliveCheck);
|
||||
|
||||
_dontWrapJarCheck.addChangeListener(new DontWrapJarChangeListener());
|
||||
|
||||
_outfileButton.addActionListener(new BrowseActionListener(true, fc,
|
||||
new FileChooserFilter("Windows executables (.exe)", ".exe"),
|
||||
_outfileField));
|
||||
_jarButton.addActionListener(new BrowseActionListener(false, fc,
|
||||
new FileChooserFilter("Jar files", ".jar"), _jarField));
|
||||
_manifestButton.addActionListener(new BrowseActionListener(false, fc,
|
||||
new FileChooserFilter("Manifest files (.manifest)", ".manifest"),
|
||||
_manifestField));
|
||||
_iconButton.addActionListener(new BrowseActionListener(false, fc,
|
||||
new FileChooserFilter("Icon files (.ico)", ".ico"), _iconField));
|
||||
}
|
||||
|
||||
private class DontWrapJarChangeListener implements ChangeListener {
|
||||
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
boolean dontWrap = _dontWrapJarCheck.isSelected();
|
||||
if (dontWrap) {
|
||||
_jarLabel.setIcon(loadImage("images/asterix-o.gif"));
|
||||
_jarLabel.setText(Messages.getString("jarPath"));
|
||||
_jarField.setToolTipText(Messages.getString("jarPathTip"));
|
||||
} else {
|
||||
_jarLabel.setIcon(loadImage("images/asterix.gif"));
|
||||
_jarLabel.setText(Messages.getString("jar"));
|
||||
_jarField.setToolTipText(Messages.getString("jarTip"));
|
||||
}
|
||||
_jarButton.setEnabled(!dontWrap);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on May 1, 2006
|
||||
*/
|
||||
package net.sf.launch4j.formimpl;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import net.sf.launch4j.FileChooserFilter;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2006 Grzegorz Kowal
|
||||
*/
|
||||
public class BrowseActionListener implements ActionListener {
|
||||
private final boolean _save;
|
||||
private final JFileChooser _fileChooser;
|
||||
private final FileChooserFilter _filter;
|
||||
private final JTextField _field;
|
||||
|
||||
public BrowseActionListener(boolean save, JFileChooser fileChooser,
|
||||
FileChooserFilter filter, JTextField field) {
|
||||
_save = save;
|
||||
_fileChooser = fileChooser;
|
||||
_filter = filter;
|
||||
_field = field;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (!_field.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
_fileChooser.setFileFilter(_filter);
|
||||
_fileChooser.setSelectedFile(new File(""));
|
||||
int result = _save
|
||||
? _fileChooser.showSaveDialog(MainFrame.getInstance())
|
||||
: _fileChooser.showOpenDialog(MainFrame.getInstance());
|
||||
if (result == JFileChooser.APPROVE_OPTION) {
|
||||
_field.setText(_fileChooser.getSelectedFile().getPath());
|
||||
}
|
||||
_fileChooser.removeChoosableFileFilter(_filter);
|
||||
}
|
||||
}
|
@ -0,0 +1,222 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on May 1, 2006
|
||||
*/
|
||||
package net.sf.launch4j.formimpl;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
import javax.swing.DefaultListModel;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
|
||||
import net.sf.launch4j.FileChooserFilter;
|
||||
import net.sf.launch4j.binding.Bindings;
|
||||
import net.sf.launch4j.binding.Validator;
|
||||
import net.sf.launch4j.config.ClassPath;
|
||||
import net.sf.launch4j.form.ClassPathForm;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2006 Grzegorz Kowal
|
||||
*/
|
||||
public class ClassPathFormImpl extends ClassPathForm {
|
||||
private final JFileChooser _fileChooser;
|
||||
private final FileChooserFilter _filter
|
||||
= new FileChooserFilter("Executable jar", ".jar");
|
||||
|
||||
public ClassPathFormImpl(Bindings bindings, JFileChooser fc) {
|
||||
bindings.addOptComponent("classPath", ClassPath.class, _classpathCheck)
|
||||
.add("classPath.mainClass", _mainclassField)
|
||||
.add("classPath.paths", _classpathList);
|
||||
_fileChooser = fc;
|
||||
|
||||
ClasspathCheckListener cpl = new ClasspathCheckListener();
|
||||
_classpathCheck.addChangeListener(cpl);
|
||||
cpl.stateChanged(null);
|
||||
|
||||
_classpathList.setModel(new DefaultListModel());
|
||||
_classpathList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
|
||||
_classpathList.addListSelectionListener(new ClasspathSelectionListener());
|
||||
|
||||
_newClasspathButton.addActionListener(new NewClasspathListener());
|
||||
_acceptClasspathButton.addActionListener(
|
||||
new AcceptClasspathListener(_classpathField));
|
||||
_removeClasspathButton.addActionListener(new RemoveClasspathListener());
|
||||
_importClasspathButton.addActionListener(new ImportClasspathListener());
|
||||
_classpathUpButton.addActionListener(new MoveUpListener());
|
||||
_classpathDownButton.addActionListener(new MoveDownListener());
|
||||
}
|
||||
|
||||
private class ClasspathCheckListener implements ChangeListener {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
boolean on = _classpathCheck.isSelected();
|
||||
_importClasspathButton.setEnabled(on);
|
||||
_classpathUpButton.setEnabled(on);
|
||||
_classpathDownButton.setEnabled(on);
|
||||
_classpathField.setEnabled(on);
|
||||
_newClasspathButton.setEnabled(on);
|
||||
_acceptClasspathButton.setEnabled(on);
|
||||
_removeClasspathButton.setEnabled(on);
|
||||
}
|
||||
}
|
||||
|
||||
private class NewClasspathListener implements ActionListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
_classpathList.clearSelection();
|
||||
_classpathField.setText("");
|
||||
_classpathField.requestFocusInWindow();
|
||||
}
|
||||
}
|
||||
|
||||
private class AcceptClasspathListener extends AbstractAcceptListener {
|
||||
public AcceptClasspathListener(JTextField f) {
|
||||
super(f, true);
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String cp = getText();
|
||||
if (Validator.isEmpty(cp)) {
|
||||
signalViolation(Messages.getString("specifyClassPath"));
|
||||
return;
|
||||
}
|
||||
DefaultListModel model = (DefaultListModel) _classpathList.getModel();
|
||||
if (_classpathList.isSelectionEmpty()) {
|
||||
model.addElement(cp);
|
||||
clear();
|
||||
} else {
|
||||
model.setElementAt(cp, _classpathList.getSelectedIndex());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class ClasspathSelectionListener implements ListSelectionListener {
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
if (e.getValueIsAdjusting()) {
|
||||
return;
|
||||
}
|
||||
if (_classpathList.isSelectionEmpty()) {
|
||||
_classpathField.setText("");
|
||||
} else {
|
||||
_classpathField.setText((String) _classpathList.getSelectedValue());
|
||||
}
|
||||
_classpathField.requestFocusInWindow();
|
||||
}
|
||||
}
|
||||
|
||||
private class RemoveClasspathListener implements ActionListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (_classpathList.isSelectionEmpty()
|
||||
|| !MainFrame.getInstance().confirm(
|
||||
Messages.getString("confirmClassPathRemoval"))) {
|
||||
return;
|
||||
}
|
||||
DefaultListModel model = (DefaultListModel) _classpathList.getModel();
|
||||
while (!_classpathList.isSelectionEmpty()) {
|
||||
model.remove(_classpathList.getSelectedIndex());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class MoveUpListener implements ActionListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
int x = _classpathList.getSelectedIndex();
|
||||
if (x < 1) {
|
||||
return;
|
||||
}
|
||||
DefaultListModel model = (DefaultListModel) _classpathList.getModel();
|
||||
Object o = model.get(x - 1);
|
||||
model.set(x - 1, model.get(x));
|
||||
model.set(x, o);
|
||||
_classpathList.setSelectedIndex(x - 1);
|
||||
}
|
||||
}
|
||||
|
||||
private class MoveDownListener implements ActionListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
DefaultListModel model = (DefaultListModel) _classpathList.getModel();
|
||||
int x = _classpathList.getSelectedIndex();
|
||||
if (x == -1 || x >= model.getSize() - 1) {
|
||||
return;
|
||||
}
|
||||
Object o = model.get(x + 1);
|
||||
model.set(x + 1, model.get(x));
|
||||
model.set(x, o);
|
||||
_classpathList.setSelectedIndex(x + 1);
|
||||
}
|
||||
}
|
||||
|
||||
private class ImportClasspathListener implements ActionListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
_fileChooser.setFileFilter(_filter);
|
||||
_fileChooser.setSelectedFile(new File(""));
|
||||
if (_fileChooser.showOpenDialog(MainFrame.getInstance())
|
||||
== JFileChooser.APPROVE_OPTION) {
|
||||
JarFile jar = new JarFile(_fileChooser.getSelectedFile());
|
||||
if (jar.getManifest() == null) {
|
||||
jar.close();
|
||||
MainFrame.getInstance().info(Messages.getString("noManifest"));
|
||||
return;
|
||||
}
|
||||
Attributes attr = jar.getManifest().getMainAttributes();
|
||||
String mainClass = (String) attr.getValue("Main-Class");
|
||||
String classPath = (String) attr.getValue("Class-Path");
|
||||
jar.close();
|
||||
_mainclassField.setText(mainClass != null ? mainClass : "");
|
||||
DefaultListModel model = new DefaultListModel();
|
||||
if (classPath != null) {
|
||||
String[] paths = classPath.split(" ");
|
||||
for (int i = 0; i < paths.length; i++) {
|
||||
model.addElement(paths[i]);
|
||||
}
|
||||
}
|
||||
_classpathList.setModel(model);
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
MainFrame.getInstance().warn(ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
100
build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/ConfigFormImpl.java
Executable file
@ -0,0 +1,100 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on May 10, 2005
|
||||
*/
|
||||
package net.sf.launch4j.formimpl;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JTextArea;
|
||||
|
||||
import net.sf.launch4j.binding.Binding;
|
||||
import net.sf.launch4j.binding.Bindings;
|
||||
import net.sf.launch4j.binding.IValidatable;
|
||||
import net.sf.launch4j.form.ConfigForm;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class ConfigFormImpl extends ConfigForm {
|
||||
private final Bindings _bindings = new Bindings();
|
||||
private final JFileChooser _fileChooser = new FileChooser(ConfigFormImpl.class);
|
||||
|
||||
public ConfigFormImpl() {
|
||||
_tab.setBorder(BorderFactory.createMatteBorder(0, -1, -1, -1, getBackground()));
|
||||
_tab.addTab(Messages.getString("tab.basic"),
|
||||
new BasicFormImpl(_bindings, _fileChooser));
|
||||
_tab.addTab(Messages.getString("tab.classpath"),
|
||||
new ClassPathFormImpl(_bindings, _fileChooser));
|
||||
_tab.addTab(Messages.getString("tab.header"),
|
||||
new HeaderFormImpl(_bindings));
|
||||
_tab.addTab(Messages.getString("tab.singleInstance"),
|
||||
new SingleInstanceFormImpl(_bindings));
|
||||
_tab.addTab(Messages.getString("tab.jre"),
|
||||
new JreFormImpl(_bindings, _fileChooser));
|
||||
_tab.addTab(Messages.getString("tab.envVars"),
|
||||
new EnvironmentVarsFormImpl(_bindings));
|
||||
_tab.addTab(Messages.getString("tab.splash"),
|
||||
new SplashFormImpl(_bindings, _fileChooser));
|
||||
_tab.addTab(Messages.getString("tab.version"),
|
||||
new VersionInfoFormImpl(_bindings, _fileChooser));
|
||||
_tab.addTab(Messages.getString("tab.messages"),
|
||||
new MessagesFormImpl(_bindings));
|
||||
}
|
||||
|
||||
public void clear(IValidatable bean) {
|
||||
_bindings.clear(bean);
|
||||
}
|
||||
|
||||
public void put(IValidatable bean) {
|
||||
_bindings.put(bean);
|
||||
}
|
||||
|
||||
public void get(IValidatable bean) {
|
||||
_bindings.get(bean);
|
||||
}
|
||||
|
||||
public boolean isModified() {
|
||||
return _bindings.isModified();
|
||||
}
|
||||
|
||||
public JTextArea getLogTextArea() {
|
||||
return _logTextArea;
|
||||
}
|
||||
|
||||
public Binding getBinding(String property) {
|
||||
return _bindings.getBinding(property);
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on Jun 10, 2006
|
||||
*/
|
||||
package net.sf.launch4j.formimpl;
|
||||
|
||||
import net.sf.launch4j.binding.Bindings;
|
||||
import net.sf.launch4j.form.EnvironmentVarsForm;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2006 Grzegorz Kowal
|
||||
*/
|
||||
public class EnvironmentVarsFormImpl extends EnvironmentVarsForm {
|
||||
|
||||
public EnvironmentVarsFormImpl(Bindings bindings) {
|
||||
bindings.add("variables", _envVarsTextArea);
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on Jul 19, 2006
|
||||
*/
|
||||
package net.sf.launch4j.formimpl;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
import javax.swing.JFileChooser;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2006 Grzegorz Kowal
|
||||
*/
|
||||
public class FileChooser extends JFileChooser {
|
||||
private final Preferences _prefs;
|
||||
private final String _key;
|
||||
|
||||
public FileChooser(Class clazz) {
|
||||
_prefs = Preferences.userNodeForPackage(clazz);
|
||||
_key = "currentDir-"
|
||||
+ clazz.getName().substring(clazz.getName().lastIndexOf('.') + 1);
|
||||
String path = _prefs.get(_key, null);
|
||||
if (path != null) {
|
||||
setCurrentDirectory(new File(path));
|
||||
}
|
||||
}
|
||||
|
||||
public void approveSelection() {
|
||||
_prefs.put(_key, getCurrentDirectory().getPath());
|
||||
super.approveSelection();
|
||||
}
|
||||
}
|
67
build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/GlassPane.java
Executable file
@ -0,0 +1,67 @@
|
||||
package net.sf.launch4j.formimpl;
|
||||
|
||||
import java.awt.AWTEvent;
|
||||
import java.awt.Component;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.AWTEventListener;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
/**
|
||||
* This is the glass pane class that intercepts screen interactions during
|
||||
* system busy states.
|
||||
*
|
||||
* Based on JavaWorld article by Yexin Chen.
|
||||
*/
|
||||
public class GlassPane extends JComponent implements AWTEventListener {
|
||||
private final Window _window;
|
||||
|
||||
public GlassPane(Window w) {
|
||||
_window = w;
|
||||
addMouseListener(new MouseAdapter() {});
|
||||
addKeyListener(new KeyAdapter() {});
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
}
|
||||
|
||||
/**
|
||||
* Receives all key events in the AWT and processes the ones that originated
|
||||
* from the current window with the glass pane.
|
||||
*
|
||||
* @param event
|
||||
* the AWTEvent that was fired
|
||||
*/
|
||||
public void eventDispatched(AWTEvent event) {
|
||||
Object source = event.getSource();
|
||||
if (event instanceof KeyEvent
|
||||
&& source instanceof Component) {
|
||||
/*
|
||||
* If the event originated from the window w/glass pane,
|
||||
* consume the event.
|
||||
*/
|
||||
if ((SwingUtilities.windowForComponent((Component) source) == _window)) {
|
||||
((KeyEvent) event).consume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the glass pane as visible or invisible. The mouse cursor will be set
|
||||
* accordingly.
|
||||
*/
|
||||
public void setVisible(boolean visible) {
|
||||
if (visible) {
|
||||
// Start receiving all events and consume them if necessary
|
||||
Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.KEY_EVENT_MASK);
|
||||
} else {
|
||||
// Stop receiving all events
|
||||
Toolkit.getDefaultToolkit().removeAWTEventListener(this);
|
||||
}
|
||||
super.setVisible(visible);
|
||||
}
|
||||
}
|
102
build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/HeaderFormImpl.java
Executable file
@ -0,0 +1,102 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on May 1, 2006
|
||||
*/
|
||||
package net.sf.launch4j.formimpl;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JRadioButton;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import net.sf.launch4j.binding.Binding;
|
||||
import net.sf.launch4j.binding.Bindings;
|
||||
import net.sf.launch4j.config.Config;
|
||||
import net.sf.launch4j.config.ConfigPersister;
|
||||
import net.sf.launch4j.form.HeaderForm;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2006 Grzegorz Kowal
|
||||
*/
|
||||
public class HeaderFormImpl extends HeaderForm {
|
||||
private final Bindings _bindings;
|
||||
|
||||
public HeaderFormImpl(Bindings bindings) {
|
||||
_bindings = bindings;
|
||||
_bindings.add("headerTypeIndex", new JRadioButton[] { _guiHeaderRadio,
|
||||
_consoleHeaderRadio })
|
||||
.add("headerObjects", "customHeaderObjects", _headerObjectsCheck,
|
||||
_headerObjectsTextArea)
|
||||
.add("libs", "customLibs", _libsCheck, _libsTextArea);
|
||||
|
||||
_guiHeaderRadio.addChangeListener(new HeaderTypeChangeListener());
|
||||
_headerObjectsCheck.addActionListener(new HeaderObjectsActionListener());
|
||||
_libsCheck.addActionListener(new LibsActionListener());
|
||||
}
|
||||
|
||||
private class HeaderTypeChangeListener implements ChangeListener {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
Config c = ConfigPersister.getInstance().getConfig();
|
||||
c.setHeaderType(_guiHeaderRadio.isSelected() ? Config.GUI_HEADER
|
||||
: Config.CONSOLE_HEADER);
|
||||
if (!_headerObjectsCheck.isSelected()) {
|
||||
Binding b = _bindings.getBinding("headerObjects");
|
||||
b.put(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class HeaderObjectsActionListener implements ActionListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (!_headerObjectsCheck.isSelected()) {
|
||||
ConfigPersister.getInstance().getConfig().setHeaderObjects(null);
|
||||
Binding b = _bindings.getBinding("headerObjects");
|
||||
b.put(ConfigPersister.getInstance().getConfig());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class LibsActionListener implements ActionListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (!_libsCheck.isSelected()) {
|
||||
ConfigPersister.getInstance().getConfig().setLibs(null);
|
||||
Binding b = _bindings.getBinding("libs");
|
||||
b.put(ConfigPersister.getInstance().getConfig());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
166
build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/JreFormImpl.java
Executable file
@ -0,0 +1,166 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on May 1, 2006
|
||||
*/
|
||||
package net.sf.launch4j.formimpl;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import net.sf.launch4j.binding.Bindings;
|
||||
import net.sf.launch4j.binding.Validator;
|
||||
import net.sf.launch4j.form.JreForm;
|
||||
import net.sf.launch4j.config.Jre;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2006 Grzegorz Kowal
|
||||
*/
|
||||
public class JreFormImpl extends JreForm {
|
||||
|
||||
public JreFormImpl(Bindings bindings, JFileChooser fc) {
|
||||
_jdkPreferenceCombo.setModel(new DefaultComboBoxModel(new String[] {
|
||||
Messages.getString("jdkPreference.jre.only"),
|
||||
Messages.getString("jdkPreference.prefer.jre"),
|
||||
Messages.getString("jdkPreference.prefer.jdk"),
|
||||
Messages.getString("jdkPreference.jdk.only")}));
|
||||
bindings.add("jre.path", _jrePathField)
|
||||
.add("jre.minVersion", _jreMinField)
|
||||
.add("jre.maxVersion", _jreMaxField)
|
||||
.add("jre.jdkPreferenceIndex", _jdkPreferenceCombo,
|
||||
Jre.DEFAULT_JDK_PREFERENCE_INDEX)
|
||||
.add("jre.initialHeapSize", _initialHeapSizeField)
|
||||
.add("jre.initialHeapPercent", _initialHeapPercentField)
|
||||
.add("jre.maxHeapSize", _maxHeapSizeField)
|
||||
.add("jre.maxHeapPercent", _maxHeapPercentField)
|
||||
.add("jre.options", _jvmOptionsTextArea);
|
||||
|
||||
_varCombo.setModel(new DefaultComboBoxModel(new String[] {
|
||||
"EXEDIR", "EXEFILE", "PWD", "OLDPWD",
|
||||
"HKEY_CLASSES_ROOT", "HKEY_CURRENT_USER", "HKEY_LOCAL_MACHINE",
|
||||
"HKEY_USERS", "HKEY_CURRENT_CONFIG" }));
|
||||
|
||||
_varCombo.addActionListener(new VarComboActionListener());
|
||||
_varCombo.setSelectedIndex(0);
|
||||
|
||||
_propertyButton.addActionListener(new PropertyActionListener());
|
||||
_optionButton.addActionListener(new OptionActionListener());
|
||||
|
||||
_envPropertyButton.addActionListener(new EnvPropertyActionListener(_envVarField));
|
||||
_envOptionButton.addActionListener(new EnvOptionActionListener(_envVarField));
|
||||
}
|
||||
|
||||
private class VarComboActionListener implements ActionListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
_optionButton.setEnabled(((String) _varCombo.getSelectedItem())
|
||||
.startsWith("HKEY_"));
|
||||
}
|
||||
}
|
||||
|
||||
private class PropertyActionListener implements ActionListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final int pos = _jvmOptionsTextArea.getCaretPosition();
|
||||
final String var = (String) _varCombo.getSelectedItem();
|
||||
if (var.startsWith("HKEY_")) {
|
||||
_jvmOptionsTextArea.insert("-Dreg.key=\"%"
|
||||
+ var + "\\\\...%\"\n", pos);
|
||||
} else {
|
||||
_jvmOptionsTextArea.insert("-Dlaunch4j." + var.toLowerCase()
|
||||
+ "=\"%" + var + "%\"\n", pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class OptionActionListener implements ActionListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final int pos = _jvmOptionsTextArea.getCaretPosition();
|
||||
final String var = (String) _varCombo.getSelectedItem();
|
||||
if (var.startsWith("HKEY_")) {
|
||||
_jvmOptionsTextArea.insert("%" + var + "\\\\...%\n", pos);
|
||||
} else {
|
||||
_jvmOptionsTextArea.insert("%" + var + "%\n", pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private abstract class EnvActionListener extends AbstractAcceptListener {
|
||||
public EnvActionListener(JTextField f, boolean listen) {
|
||||
super(f, listen);
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final int pos = _jvmOptionsTextArea.getCaretPosition();
|
||||
final String var = getText()
|
||||
.replaceAll("\"", "")
|
||||
.replaceAll("%", "");
|
||||
if (Validator.isEmpty(var)) {
|
||||
signalViolation(Messages.getString("specifyVar"));
|
||||
return;
|
||||
}
|
||||
add(var, pos);
|
||||
clear();
|
||||
}
|
||||
|
||||
protected abstract void add(String var, int pos);
|
||||
}
|
||||
|
||||
private class EnvPropertyActionListener extends EnvActionListener {
|
||||
public EnvPropertyActionListener(JTextField f) {
|
||||
super(f, true);
|
||||
}
|
||||
|
||||
protected void add(String var, int pos) {
|
||||
final String prop = var
|
||||
.replaceAll(" ", ".")
|
||||
.replaceAll("_", ".")
|
||||
.toLowerCase();
|
||||
_jvmOptionsTextArea.insert("-Denv." + prop + "=\"%" + var
|
||||
+ "%\"\n", pos);
|
||||
}
|
||||
}
|
||||
|
||||
private class EnvOptionActionListener extends EnvActionListener {
|
||||
public EnvOptionActionListener(JTextField f) {
|
||||
super(f, false);
|
||||
}
|
||||
|
||||
protected void add(String var, int pos) {
|
||||
_jvmOptionsTextArea.insert("%" + var + "%\n", pos);
|
||||
}
|
||||
}
|
||||
}
|
358
build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/MainFrame.java
Executable file
@ -0,0 +1,358 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created on 2005-05-09
|
||||
*/
|
||||
package net.sf.launch4j.formimpl;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JToolBar;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import com.jgoodies.looks.Options;
|
||||
import com.jgoodies.looks.plastic.PlasticXPLookAndFeel;
|
||||
|
||||
import foxtrot.Task;
|
||||
import foxtrot.Worker;
|
||||
|
||||
import net.sf.launch4j.Builder;
|
||||
import net.sf.launch4j.BuilderException;
|
||||
import net.sf.launch4j.ExecException;
|
||||
import net.sf.launch4j.FileChooserFilter;
|
||||
import net.sf.launch4j.Log;
|
||||
import net.sf.launch4j.Main;
|
||||
import net.sf.launch4j.Util;
|
||||
import net.sf.launch4j.binding.Binding;
|
||||
import net.sf.launch4j.binding.BindingException;
|
||||
import net.sf.launch4j.binding.InvariantViolationException;
|
||||
import net.sf.launch4j.config.Config;
|
||||
import net.sf.launch4j.config.ConfigPersister;
|
||||
import net.sf.launch4j.config.ConfigPersisterException;
|
||||
|
||||
/**
|
||||
* @author Copyright (C) 2005 Grzegorz Kowal
|
||||
*/
|
||||
public class MainFrame extends JFrame {
|
||||
private static MainFrame _instance;
|
||||
|
||||
private final JToolBar _toolBar;
|
||||
private final JButton _runButton;
|
||||
private final ConfigFormImpl _configForm;
|
||||
private final JFileChooser _fileChooser = new FileChooser(MainFrame.class);
|
||||
private File _outfile;
|
||||
private boolean _saved = false;
|
||||
|
||||
public static void createInstance() {
|
||||
try {
|
||||
Toolkit.getDefaultToolkit().setDynamicLayout(true);
|
||||
System.setProperty("sun.awt.noerasebackground","true");
|
||||
|
||||
// JGoodies
|
||||
Options.setDefaultIconSize(new Dimension(16, 16)); // menu icons
|
||||
Options.setUseNarrowButtons(false);
|
||||
Options.setPopupDropShadowEnabled(true);
|
||||
|
||||
UIManager.setLookAndFeel(new PlasticXPLookAndFeel());
|
||||
_instance = new MainFrame();
|
||||
} catch (Exception e) {
|
||||
System.err.println(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static MainFrame getInstance() {
|
||||
return _instance;
|
||||
}
|
||||
|
||||
public MainFrame() {
|
||||
showConfigName(null);
|
||||
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||
addWindowListener(new MainFrameListener());
|
||||
setGlassPane(new GlassPane(this));
|
||||
_fileChooser.setFileFilter(new FileChooserFilter(
|
||||
Messages.getString("MainFrame.config.files"),
|
||||
new String[] {".xml", ".cfg"}));
|
||||
|
||||
_toolBar = new JToolBar();
|
||||
_toolBar.setFloatable(false);
|
||||
_toolBar.setRollover(true);
|
||||
addButton("images/new.png", Messages.getString("MainFrame.new.config"),
|
||||
new NewActionListener());
|
||||
addButton("images/open.png", Messages.getString("MainFrame.open.config"),
|
||||
new OpenActionListener());
|
||||
addButton("images/save.png", Messages.getString("MainFrame.save.config"),
|
||||
new SaveActionListener());
|
||||
_toolBar.addSeparator();
|
||||
addButton("images/build.png", Messages.getString("MainFrame.build.wrapper"),
|
||||
new BuildActionListener());
|
||||
_runButton = addButton("images/run.png",
|
||||
Messages.getString("MainFrame.test.wrapper"),
|
||||
new RunActionListener());
|
||||
setRunEnabled(false);
|
||||
_toolBar.addSeparator();
|
||||
addButton("images/info.png", Messages.getString("MainFrame.about.launch4j"),
|
||||
new AboutActionListener());
|
||||
|
||||
_configForm = new ConfigFormImpl();
|
||||
getContentPane().setLayout(new BorderLayout());
|
||||
getContentPane().add(_toolBar, BorderLayout.NORTH);
|
||||
getContentPane().add(_configForm, BorderLayout.CENTER);
|
||||
pack();
|
||||
Dimension scr = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
Dimension fr = getSize();
|
||||
fr.width += 25;
|
||||
fr.height += 100;
|
||||
setBounds((scr.width - fr.width) / 2, (scr.height - fr.height) / 2,
|
||||
fr.width, fr.height);
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
private JButton addButton(String iconPath, String tooltip, ActionListener l) {
|
||||
ImageIcon icon = new ImageIcon(MainFrame.class.getClassLoader()
|
||||
.getResource(iconPath));
|
||||
JButton b = new JButton(icon);
|
||||
b.setToolTipText(tooltip);
|
||||
b.addActionListener(l);
|
||||
_toolBar.add(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
public void info(String text) {
|
||||
JOptionPane.showMessageDialog(this,
|
||||
text,
|
||||
Main.getName(),
|
||||
JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
|
||||
public void warn(String text) {
|
||||
JOptionPane.showMessageDialog(this,
|
||||
text,
|
||||
Main.getName(),
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
|
||||
public void warn(InvariantViolationException e) {
|
||||
Binding b = e.getBinding();
|
||||
if (b != null) {
|
||||
b.markInvalid();
|
||||
}
|
||||
warn(e.getMessage());
|
||||
if (b != null) {
|
||||
e.getBinding().markValid();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean confirm(String text) {
|
||||
return JOptionPane.showConfirmDialog(MainFrame.this,
|
||||
text,
|
||||
Messages.getString("MainFrame.confirm"),
|
||||
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
|
||||
}
|
||||
|
||||
private boolean isModified() {
|
||||
return (!_configForm.isModified())
|
||||
|| confirm(Messages.getString("MainFrame.discard.changes"));
|
||||
}
|
||||
|
||||
private boolean save() {
|
||||
// XXX
|
||||
try {
|
||||
_configForm.get(ConfigPersister.getInstance().getConfig());
|
||||
if (_fileChooser.showSaveDialog(MainFrame.this) == JOptionPane.YES_OPTION) {
|
||||
File f = _fileChooser.getSelectedFile();
|
||||
if (!f.getPath().endsWith(".xml")) {
|
||||
f = new File(f.getPath() + ".xml");
|
||||
}
|
||||
ConfigPersister.getInstance().save(f);
|
||||
_saved = true;
|
||||
showConfigName(f);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch (InvariantViolationException ex) {
|
||||
warn(ex);
|
||||
return false;
|
||||
} catch (BindingException ex) {
|
||||
warn(ex.getMessage());
|
||||
return false;
|
||||
} catch (ConfigPersisterException ex) {
|
||||
warn(ex.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void showConfigName(File config) {
|
||||
setTitle(Main.getName() + " - " + (config != null ? config.getName()
|
||||
: Messages.getString("MainFrame.untitled")));
|
||||
}
|
||||
|
||||
private void setRunEnabled(boolean enabled) {
|
||||
if (!enabled) {
|
||||
_outfile = null;
|
||||
}
|
||||
_runButton.setEnabled(enabled);
|
||||
}
|
||||
|
||||
private void clearConfig() {
|
||||
ConfigPersister.getInstance().createBlank();
|
||||
_configForm.clear(ConfigPersister.getInstance().getConfig());
|
||||
}
|
||||
|
||||
private class MainFrameListener extends WindowAdapter {
|
||||
public void windowOpened(WindowEvent e) {
|
||||
clearConfig();
|
||||
}
|
||||
|
||||
public void windowClosing(WindowEvent e) {
|
||||
if (isModified()) {
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class NewActionListener implements ActionListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (isModified()) {
|
||||
clearConfig();
|
||||
}
|
||||
_saved = false;
|
||||
showConfigName(null);
|
||||
setRunEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
private class OpenActionListener implements ActionListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
if (isModified() && _fileChooser.showOpenDialog(MainFrame.this)
|
||||
== JOptionPane.YES_OPTION) {
|
||||
final File f = _fileChooser.getSelectedFile();
|
||||
if (f.getPath().endsWith(".xml")) {
|
||||
ConfigPersister.getInstance().load(f);
|
||||
_saved = true;
|
||||
} else {
|
||||
ConfigPersister.getInstance().loadVersion1(f);
|
||||
_saved = false;
|
||||
}
|
||||
_configForm.put(ConfigPersister.getInstance().getConfig());
|
||||
showConfigName(f);
|
||||
setRunEnabled(false);
|
||||
}
|
||||
} catch (ConfigPersisterException ex) {
|
||||
warn(ex.getMessage());
|
||||
} catch (BindingException ex) {
|
||||
warn(ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class SaveActionListener implements ActionListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
save();
|
||||
}
|
||||
}
|
||||
|
||||
private class BuildActionListener implements ActionListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final Log log = Log.getSwingLog(_configForm.getLogTextArea());
|
||||
try {
|
||||
if ((!_saved || _configForm.isModified())
|
||||
&& !save()) {
|
||||
return;
|
||||
}
|
||||
log.clear();
|
||||
ConfigPersister.getInstance().getConfig().checkInvariants();
|
||||
Builder b = new Builder(log);
|
||||
_outfile = b.build();
|
||||
setRunEnabled(ConfigPersister.getInstance().getConfig()
|
||||
.getHeaderType() == Config.GUI_HEADER // TODO fix console app test
|
||||
&& (Util.WINDOWS_OS || !ConfigPersister.getInstance()
|
||||
.getConfig().isDontWrapJar()));
|
||||
} catch (InvariantViolationException ex) {
|
||||
setRunEnabled(false);
|
||||
ex.setBinding(_configForm.getBinding(ex.getProperty()));
|
||||
warn(ex);
|
||||
} catch (BuilderException ex) {
|
||||
setRunEnabled(false);
|
||||
log.append(ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class RunActionListener implements ActionListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
getGlassPane().setVisible(true);
|
||||
Worker.post(new Task() {
|
||||
public Object run() throws ExecException {
|
||||
Log log = Log.getSwingLog(_configForm.getLogTextArea());
|
||||
log.clear();
|
||||
String path = _outfile.getPath();
|
||||
if (Util.WINDOWS_OS) {
|
||||
log.append(Messages.getString("MainFrame.executing") + path);
|
||||
Util.exec(new String[] { path }, log);
|
||||
} else {
|
||||
log.append(Messages.getString("MainFrame.jar.integrity.test")
|
||||
+ path);
|
||||
Util.exec(new String[] { "java", "-jar", path }, log);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
} catch (Exception ex) {
|
||||
// XXX errors logged by exec
|
||||
} finally {
|
||||
getGlassPane().setVisible(false);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private class AboutActionListener implements ActionListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
info(Main.getDescription());
|
||||
}
|
||||
}
|
||||
}
|
55
build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/Messages.java
Executable file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Launch4j nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.sf.launch4j.formimpl;
|
||||
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class Messages {
|
||||
private static final String BUNDLE_NAME = "net.sf.launch4j.formimpl.messages";
|
||||
|
||||
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
|
||||
.getBundle(BUNDLE_NAME);
|
||||
|
||||
private Messages() {
|
||||
}
|
||||
|
||||
public static String getString(String key) {
|
||||
try {
|
||||
return RESOURCE_BUNDLE.getString(key);
|
||||
} catch (MissingResourceException e) {
|
||||
return '!' + key + '!';
|
||||
}
|
||||
}
|
||||
}
|