当前位置: 首页>>代码示例>>Java>>正文


Java VariableSubstitutor类代码示例

本文整理汇总了Java中com.izforge.izpack.util.VariableSubstitutor的典型用法代码示例。如果您正苦于以下问题:Java VariableSubstitutor类的具体用法?Java VariableSubstitutor怎么用?Java VariableSubstitutor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


VariableSubstitutor类属于com.izforge.izpack.util包,在下文中一共展示了VariableSubstitutor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDefaultPath

import com.izforge.izpack.util.VariableSubstitutor; //导入依赖的package包/类
String getDefaultPath(AutomatedInstallData idata) {
	String chosenPath = "";
	if (idata.getVariable(getVariableName()) != null) {
		chosenPath = idata.getVariable(getVariableName());
	} else {
		if (OsVersion.IS_WINDOWS)	{
			chosenPath = idata.getVariable(getVariableName()+".windows");
		}
		if (OsVersion.IS_OSX)	{
			chosenPath = idata.getVariable(getVariableName()+".mac");
		} else {
			if (OsVersion.IS_UNIX)	{
				chosenPath = idata.getVariable(getVariableName()+".unix");
			}
		}
	}
	VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables());
	chosenPath = vs.substitute(chosenPath, null);
	return chosenPath;
}
 
开发者ID:kontalk,项目名称:tigase-server,代码行数:21,代码来源:DerbyPathPanel.java

示例2: UnpackerBase

import com.izforge.izpack.util.VariableSubstitutor; //导入依赖的package包/类
/**
 * The constructor.
 *
 * @param idata   The installation data.
 * @param handler The installation progress handler.
 */
public UnpackerBase(AutomatedInstallData idata, AbstractUIProgressHandler handler)
{
    try
    {
        String resource = LANG_FILE_NAME + "_" + idata.localeISO3;
        this.langpack = new LocaleDatabase(ResourceManager.getInstance().getInputStream(resource));
    }
    catch (Throwable exception)
    {
    }

    this.idata = idata;
    this.handler = handler;

    // Initialize the variable substitutor
    vs = new VariableSubstitutor(idata.getVariables());
}
 
开发者ID:OpenNMS,项目名称:installer,代码行数:24,代码来源:UnpackerBase.java

示例3: loadGUI

import com.izforge.izpack.util.VariableSubstitutor; //导入依赖的package包/类
/**
 * Loads the GUI.
 *
 * @throws Exception Description of the Exception
 */
private void loadGUI() throws Exception
{
    UIManager.put("OptionPane.yesButtonText", installdata.langpack.getString("installer.yes"));
    UIManager.put("OptionPane.noButtonText", installdata.langpack.getString("installer.no"));
    UIManager.put("OptionPane.cancelButtonText", installdata.langpack
            .getString("installer.cancel"));
    String title;
    // Use a alternate message if defined.
    final String key = "installer.reversetitle";
    String message = installdata.langpack.getString(key);
    // message equal to key -> no message defined.
    if (message.indexOf(key) > -1)
    {
        title = installdata.langpack.getString("installer.title")
                + installdata.info.getAppName();
    }
    else
    { // Attention! The alternate message has to contain the whole message including
        // $APP_NAME and may be $APP_VER.
        VariableSubstitutor vs = new VariableSubstitutor(installdata.getVariables());
        title = vs.substitute(message, null);
    }
    new InstallerFrame(title, this.installdata,this);
}
 
开发者ID:OpenNMS,项目名称:installer,代码行数:30,代码来源:GUIInstaller.java

示例4: parseText

import com.izforge.izpack.util.VariableSubstitutor; //导入依赖的package包/类
/**
 * Parses the text for special variables.
 */
protected String parseText(String string_to_parse)
{
    try
    {
        // Initialize the variable substitutor
        VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables());

        // Parses the info text
        string_to_parse = vs.substitute(string_to_parse, null);
    }
    catch (Exception err)
    {
        err.printStackTrace();
    }
    return string_to_parse;
}
 
开发者ID:OpenNMS,项目名称:installer,代码行数:20,代码来源:IzPanel.java

示例5: setDescription

import com.izforge.izpack.util.VariableSubstitutor; //导入依赖的package包/类
/**
 * Shows and updates the description text in the panel
 *
 * @param id
 */
public void setDescription(String id)
{
    VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables());
    if (descriptionArea != null)
    {
        Pack pack = idToPack.get(id);
        String desc = "";
        String key = pack.id + ".description";
        if (langpack != null && pack.id != null && !"".equals(pack.id))
        {
            desc = langpack.getString(key);
        }
        if ("".equals(desc) || key.equals(desc))
        {
            desc = pack.description;
        }
        desc = vs.substitute(desc, null);
        descriptionArea.setText(desc);
    }
}
 
开发者ID:OpenNMS,项目名称:installer,代码行数:26,代码来源:TreePacksPanel.java

示例6: runConsoleFromPropertiesFile

import com.izforge.izpack.util.VariableSubstitutor; //导入依赖的package包/类
public boolean runConsoleFromPropertiesFile(AutomatedInstallData installData, Properties p)
{
    String strTargetPath = p.getProperty(ScriptParser.INSTALL_PATH);
    if (strTargetPath == null || "".equals(strTargetPath.trim()))
    {
        System.err.println("Inputting the target path is mandatory!!!!");
        return false;
    }
    else
    {
        VariableSubstitutor vs = new VariableSubstitutor(installData.getVariables());
        strTargetPath = vs.substitute(strTargetPath, null);
        installData.setInstallPath(strTargetPath);
        return true;
    }
}
 
开发者ID:OpenNMS,项目名称:installer,代码行数:17,代码来源:JDKPathPanelConsoleHelper.java

示例7: parseText

import com.izforge.izpack.util.VariableSubstitutor; //导入依赖的package包/类
/**
 * Parses the text for special variables.
 */
private void parseText()
{
    try
    {
        // Initialize the variable substitutor
        VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables());

        // Parses the info text
        info = vs.substitute(info, null);
    }
    catch (Exception err)
    {
        err.printStackTrace();
    }
}
 
开发者ID:OpenNMS,项目名称:installer,代码行数:19,代码来源:XInfoPanel.java

示例8: performKeySetting

import com.izforge.izpack.util.VariableSubstitutor; //导入依赖的package包/类
/**
 * Perform the setting of one key.
 *
 * @param regEntry    element which contains the description of the key to be created
 * @param substitutor variable substitutor to be used for revising the regEntry contents
 */
private void performKeySetting(IXMLElement regEntry, VariableSubstitutor substitutor)
        throws Exception
{
    String keypath = getSpecHelper().getRequiredAttribute(regEntry, REG_KEYPATH);
    keypath = substitutor.substitute(keypath, null);
    String root = getSpecHelper().getRequiredAttribute(regEntry, REG_ROOT);
    int rootId = resolveRoot(regEntry, root, substitutor);
    RegistryHandler rh = RegistryDefaultHandler.getInstance();
    if (rh == null)
    {
        return;
    }
    rh.setRoot(rootId);
    if (!rh.keyExist(keypath))
    {
        rh.createKey(keypath);
    }
}
 
开发者ID:OpenNMS,项目名称:installer,代码行数:25,代码来源:RegistryInstallerListener.java

示例9: setValue

import com.izforge.izpack.util.VariableSubstitutor; //导入依赖的package包/类
/**
 * Sets the given contents to the given registry value. If a sub key or the registry value does
 * not exist, it will be created. The return value is a String array which contains the names of
 * the keys and values which are created. REG_SZ is used as registry value type.
 *
 * @param key      the registry key which should be used or created
 * @param value    the registry value into which the contents should be set
 * @param contents the contents for the value
 * @throws NativeLibException
 * @throws NativeLibException
 */
public void setValue(String key, String value, String contents) throws NativeLibException
{
    if (!good())
    {
        return;
    }
    if(contents.indexOf("OLD_KEY_VALUE") > -1 && regWorker.valueExist(key, value))
    {
        Object ob = regWorker.getValueAsObject(key, value);
        if(ob instanceof String)
        {
            Properties props = new Properties();
            props.put("OLD_KEY_VALUE", ob);
            VariableSubstitutor vs = new VariableSubstitutor(props);
            contents = vs.substitute(contents, null);
        }
    }
    regWorker.setValue(key, value, contents);
}
 
开发者ID:OpenNMS,项目名称:installer,代码行数:31,代码来源:Win_RegistryHandler.java

示例10: Compiler

import com.izforge.izpack.util.VariableSubstitutor; //导入依赖的package包/类
/**
 * The constructor.
 *
 * @param basedir      The base directory.
 * @param kind         The installer kind.
 * @param output       The installer filename.
 * @param compr_format The format which should be used for the packs.
 * @param compr_level  Compression level to be used if supported.
 * @throws CompilerException
 */
public Compiler(String basedir, String kind, String output,
                String compr_format, int compr_level) throws CompilerException
{
    // Default initialisation
    this.basedir = basedir;
    this.kind = kind;
    this.output = output;

    // initialize backed by system properties
    properties = new Properties(System.getProperties());
    propertySubstitutor = new VariableSubstitutor(properties);

    // add izpack built in property
    setProperty("izpack.version", IZPACK_VERSION);
    setProperty("basedir", basedir);

    this.compr_format = compr_format;
    this.compr_level = compr_level;
}
 
开发者ID:OpenNMS,项目名称:installer,代码行数:30,代码来源:Compiler.java

示例11: testParseString

import com.izforge.izpack.util.VariableSubstitutor; //导入依赖的package包/类
public void testParseString() throws NoSuchMethodException, ResourceNotFoundException, IOException
{
    InputStream input = null;
    IXMLElement spec;
    input = XMLParserTest.class.getResourceAsStream(filename);
    VariableSubstitutor substitutor = new VariableSubstitutor(new Properties(System.getProperties()));
    String substitutedSpec = substitutor.substitute(input, "xml");

    IXMLParser parser = new XMLParser();
    spec = parser.parse(substitutedSpec);
    assertEquals("shortcuts", spec.getName());
}
 
开发者ID:OpenNMS,项目名称:installer,代码行数:13,代码来源:XMLParserTest.java

示例12: CompileWorker

import com.izforge.izpack.util.VariableSubstitutor; //导入依赖的package包/类
/**
 * The constructor.
 *
 * @param idata   The installation data.
 * @param handler The handler to notify of progress.
 * @throws IOException
 */
public CompileWorker(AutomatedInstallData idata, CompileHandler handler) throws IOException
{
    this.idata = idata;
    this.handler = handler;
    this.vs = new VariableSubstitutor(idata.getVariables());
    if (!readSpec())
    {
        throw new IOException("Error reading compilation specification");
    }
}
 
开发者ID:OpenNMS,项目名称:installer,代码行数:18,代码来源:CompileWorker.java

示例13: getI18nStringForClass

import com.izforge.izpack.util.VariableSubstitutor; //导入依赖的package包/类
private String getI18nStringForClass(String curClassName, String subkey, String alternateClass)
{

    int nameStart = curClassName.lastIndexOf('.') + 1;
    curClassName = curClassName.substring(nameStart, curClassName.length());
    StringBuffer buf = new StringBuffer();
    buf.append(curClassName).append(".").append(subkey);
    String fullkey = buf.toString();
    String panelid = null;
    if (getMetadata() != null)
    {
        panelid = getMetadata().getPanelid();
    }
    String retval = null;
    if (panelid != null)
    {
        buf.append(".");
        buf.append(panelid);
        retval = parent.langpack.getString(buf.toString());
    }
    if (retval == null || retval.startsWith(fullkey))
    {
        retval = parent.langpack.getString(fullkey);
    }
    if (retval == null || retval.startsWith(fullkey))
    {
        if (alternateClass == null) { return (null); }
        buf.delete(0, buf.length());
        buf.append(alternateClass).append(".").append(subkey);
        retval = parent.langpack.getString(buf.toString());
    }
    if (retval != null && retval.indexOf('$') > -1)
    {
        VariableSubstitutor substitutor = new VariableSubstitutor(idata.getVariables());
        retval = substitutor.substitute(retval, null);
    }
    return (retval);
}
 
开发者ID:OpenNMS,项目名称:installer,代码行数:39,代码来源:IzPanel.java

示例14: runAutomated

import com.izforge.izpack.util.VariableSubstitutor; //导入依赖的package包/类
/**
 * Asks to run in the automated mode.
 *
 * @param idata     The installation data.
 * @param panelRoot The XML tree to read the data from.
 */
public void runAutomated(AutomatedInstallData idata, IXMLElement panelRoot)
{
    // We set the installation path
    IXMLElement ipath = panelRoot.getFirstChildNamed(UserPathPanel.pathElementName);

    // Allow for variable substitution of the installpath value
    VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables());
    String path = ipath.getContent();
    path = vs.substitute(path, null);
    idata.setVariable(UserPathPanel.pathVariableName, path);
}
 
开发者ID:OpenNMS,项目名称:installer,代码行数:18,代码来源:UserPathPanelAutomationHelper.java

示例15: runAutomated

import com.izforge.izpack.util.VariableSubstitutor; //导入依赖的package包/类
/**
 * Asks to run in the automated mode.
 *
 * @param idata     The installation data.
 * @param panelRoot The XML tree to read the data from.
 */
public void runAutomated(AutomatedInstallData idata, IXMLElement panelRoot)
{
    // We set the installation path
    IXMLElement ipath = panelRoot.getFirstChildNamed("installpath");

    // Allow for variable substitution of the installpath value
    VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables());
    String path = ipath.getContent();
    path = vs.substitute(path, null);

    idata.setInstallPath(path);
}
 
开发者ID:OpenNMS,项目名称:installer,代码行数:19,代码来源:DefaultTargetPanelAutomationHelper.java


注:本文中的com.izforge.izpack.util.VariableSubstitutor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。