Java源码示例:net.sf.launch4j.config.Config

示例1
public HeaderFormImpl(Bindings bindings) {
	_bindings = bindings;
	_bindings.add("headerTypeIndex", new JRadioButton[] { _guiHeaderRadio,
														_consoleHeaderRadio,
														_jniGuiHeaderRadio,
														_jniConsoleHeaderRadio })
			.add("headerObjects", "customHeaderObjects", _headerObjectsCheck,
														_headerObjectsTextArea)
			.add("libs", "customLibs", _libsCheck, _libsTextArea);

	_guiHeaderRadio.setActionCommand(Config.GUI_HEADER);
	_consoleHeaderRadio.setActionCommand(Config.CONSOLE_HEADER);
	_jniGuiHeaderRadio.setActionCommand(Config.JNI_GUI_HEADER_32);
	_jniConsoleHeaderRadio.setActionCommand(Config.JNI_CONSOLE_HEADER_32);

	ActionListener headerTypeActionListener = new HeaderTypeActionListener();
	_guiHeaderRadio.addActionListener(headerTypeActionListener);
	_consoleHeaderRadio.addActionListener(headerTypeActionListener);
	_jniGuiHeaderRadio.addActionListener(headerTypeActionListener);
	_jniConsoleHeaderRadio.addActionListener(headerTypeActionListener);
	
	_headerObjectsCheck.addActionListener(new HeaderObjectsActionListener());
	_libsCheck.addActionListener(new LibsActionListener());
}
 
示例2
public HeaderFormImpl(Bindings bindings) {
	_bindings = bindings;
	_bindings.add("headerTypeIndex", new JRadioButton[] { _guiHeaderRadio,
														_consoleHeaderRadio,
														_jniGuiHeaderRadio,
														_jniConsoleHeaderRadio })
			.add("headerObjects", "customHeaderObjects", _headerObjectsCheck,
														_headerObjectsTextArea)
			.add("libs", "customLibs", _libsCheck, _libsTextArea);

	_guiHeaderRadio.setActionCommand(Config.GUI_HEADER);
	_consoleHeaderRadio.setActionCommand(Config.CONSOLE_HEADER);
	_jniGuiHeaderRadio.setActionCommand(Config.JNI_GUI_HEADER_32);
	_jniConsoleHeaderRadio.setActionCommand(Config.JNI_CONSOLE_HEADER_32);

	ActionListener headerTypeActionListener = new HeaderTypeActionListener();
	_guiHeaderRadio.addActionListener(headerTypeActionListener);
	_consoleHeaderRadio.addActionListener(headerTypeActionListener);
	_jniGuiHeaderRadio.addActionListener(headerTypeActionListener);
	_jniConsoleHeaderRadio.addActionListener(headerTypeActionListener);
	
	_headerObjectsCheck.addActionListener(new HeaderObjectsActionListener());
	_libsCheck.addActionListener(new LibsActionListener());
}
 
示例3
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("stayAlive", _stayAliveCheck)
			.add("restartOnCrash", _restartOnCrashCheck);

	_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));
}
 
示例4
public void actionPerformed(ActionEvent e) {
	Config c = ConfigPersister.getInstance().getConfig();
	c.setHeaderType(e.getActionCommand());

	if (!_headerObjectsCheck.isSelected()) {
		Binding b = _bindings.getBinding("headerObjects");
		b.put(c);
		updateLibs();
	}
}
 
示例5
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("stayAlive", _stayAliveCheck)
			.add("restartOnCrash", _restartOnCrashCheck);

	_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));
}
 
示例6
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);
	}
}
 
示例7
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("stayAlive", _stayAliveCheck)
			.add("restartOnCrash", _restartOnCrashCheck);

	_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));
}
 
示例8
public void actionPerformed(ActionEvent e) {
	Config c = ConfigPersister.getInstance().getConfig();
	c.setHeaderType(e.getActionCommand());

	if (!_headerObjectsCheck.isSelected()) {
		Binding b = _bindings.getBinding("headerObjects");
		b.put(c);
		updateLibs();
	}
}
 
示例9
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(GUI_HEADER_STAYS_ALIVE, c.isStayAlive());
	addTrue(RESTART_ON_CRASH, c.isRestartOnCrash());
	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 file = Util.createTempFile("rc");

	if ("MS932".equals(System.getProperty("file.encoding"))) {
		writeKanjiResourceFile(file);
	} else {
		writeResourceFile(file);
	}

	return file;
}
 
示例10
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(GUI_HEADER_STAYS_ALIVE, c.isStayAlive());
	addTrue(RESTART_ON_CRASH, c.isRestartOnCrash());
	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 file = Util.createTempFile("rc");

	if ("MS932".equals(System.getProperty("file.encoding"))) {
		writeKanjiResourceFile(file);
	} else {
		writeResourceFile(file);
	}

	return file;
}
 
示例11
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(GUI_HEADER_STAYS_ALIVE, c.isStayAlive());
	addTrue(RESTART_ON_CRASH, c.isRestartOnCrash());
	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 file = Util.createTempFile("rc");

	if ("MS932".equals(System.getProperty("file.encoding"))) {
		writeKanjiResourceFile(file);
	} else {
		writeResourceFile(file);
	}

	return file;
}