/** * Returns the rules. * * @return the rules */ private RulesEngine getRules() { return installData.getRules(); }
public Status validateData(InstallData idata) { RulesEngine rules = idata.getRules(); if (!rules.isConditionTrue(conditionId)) { return severity; } return Status.OK; }
@Override public Status validateData(InstallData idata) { RulesEngine rules = idata.getRules(); Set<String> conditionIds = rules.getKnownConditionIds(); for (String conditionId : conditionIds) { if (conditionId.toLowerCase().startsWith(this.getClass().getSimpleName().toLowerCase() + ".")) { if (!rules.getCondition(conditionId).isTrue()) { logger.fine("Validation failed on condition: " + conditionId); lastFailedConditionId = conditionId; return Status.ERROR; } } } return Status.OK; }
/** * This returns true if a Shortcut should or can be created. * Returns false to suppress Creation * * @param shortcutSpec * @return true if condition is resolved positive */ private boolean checkConditions(IXMLElement shortcutSpec) { boolean result = true; String condition = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_CONDITION); if (condition != null) { result = installData.getRules().isConditionTrue(condition); } return result; }
RulesEngine rules = installData.getRules(); for (Map.Entry<String, String> packData : packsData.entrySet())
/** * Determines if an existing directory can be written to. * * @param dir the directory * @return {@code true} if the directory can be written to, otherwise {@code false} */ protected boolean checkOverwrite(File dir, Console console) { boolean result = true; // if 'ShowExistingDirectoryWarning' configuration option set 'false' then don't show // "The directory already exists! Are you sure you want to install here and possibly overwrite existing files?" // warning dialog: String show = getPanel().getConfigurationOptionValue(PathInputBase.SHOWEXISTINGDIRECTORYWARNING, installData.getRules()); if ((show == null || Boolean.getBoolean(show)) && dir.isDirectory() && dir.list().length > 0) { Messages messages = installData.getMessages(); result = askUser(messages.get("installer.warning"), messages.get("TargetPanel.warn"), Prompt.Option.NO); } return result; }
/** * Reassemble choices according to current conditions and processor results * when the panel changes */ private void refreshChoices() { ComboField field = (ComboField)getField(); combo.removeAllItems(); int index = 0; for (Choice choice : field.getChoices()) { String conditionId = choice.getConditionId(); if (conditionId == null || getInstallData().getRules().isConditionTrue(conditionId)) { combo.addItem(choice); } boolean selected = field.getSelectedIndex() == index; if (selected) { combo.setSelectedItem(choice); } index++; } }
if (dataValidatorConditionId != null) Condition dataValidatorCondition = installData.getRules().getCondition(dataValidatorConditionId); if (!dataValidatorCondition.isTrue())
String value = option.getValue(installData.getRules()); String newValue = installData.getVariables().replace(value); if (value != null && !value.equals(newValue))
RulesEngine rules = installData.getRules(); boolean paging = Boolean.parseBoolean(panel.getConfigurationOptionValue("console-text-paging", rules)); boolean wordwrap = Boolean.parseBoolean(panel.getConfigurationOptionValue("console-text-wordwrap", rules));
if (installData.getRules().canInstallPack(pack, installData.getVariables()))
/** * Displays the choices. * * @param choices the choices * @param selectedRealIndex the selected choice, or {@code -1} if no choice is selected */ private MappedSelection listChoices(List<Choice> choices, int selectedRealIndex) { int visibleIndex = 0; MappedSelection visibleToRealMapping = new MappedSelection(); for (int i = 0; i < choices.size(); ++i) { Choice choice = choices.get(i); String conditionId = choice.getConditionId(); if (conditionId == null || getField().getInstallData().getRules().isConditionTrue(conditionId)) { boolean isSelected = (i == selectedRealIndex); println(visibleIndex + " [" + (isSelected ? "x" : " ") + "] " + choice.getValue()); visibleToRealMapping.put(Integer.valueOf(visibleIndex), Integer.valueOf(i)); if (isSelected) { // The default when the user hits just ENTER without entering an explicit value visibleToRealMapping.setDefaultVisibleIndex(visibleIndex); } visibleIndex++; } } return visibleToRealMapping; }
/** * Determines if the specified directory can be created. * * @param dir the directory * @return {@code true} if the directory may be created, otherwise {@code false} */ protected boolean checkCreateDirectory(File dir, Console console) { boolean result = true; // if 'ShowCreateDirectoryMessage' configuration option set 'false' then don't show // then don't show "directory will be created" dialog: String show = getPanel().getConfigurationOptionValue(PathInputBase.SHOWCREATEDIRECTORYMESSAGE, installData.getRules()); if (show == null || Boolean.getBoolean(show)) { Messages messages = installData.getMessages(); result = (OK == prompt.confirm(WARNING, messages.get("installer.Message"), messages.get("TargetPanel.createdir") + "\n" + dir, OK_CANCEL, OK)); } return result; }
RulesEngine rules = getInstallData().getRules(); for (AntAction act : actList)
if (panel.hasCondition()) visible = installData.getRules().isConditionTrue(panel.getCondition()); logger.fine("Panel '" + getPanelId() + "' depending on condition '" + panel.getCondition() + "' " + (visible?"can be shown":"will be skipped")); visible = installData.getRules().canShowPanel(panelId, installData.getVariables()); logger.fine("Panel '" + getPanelId() + "' " + (visible?"can be shown":"will be skipped")); visible = installData.getRules().isConditionTrue(panel.getDisplayHiddenCondition()); panel.setDisplayHidden(visible); logger.fine("Panel '" + getPanelId() + "' depending on displayHiddenCondition '" + panel.getDisplayHiddenCondition() + "' " + (visible?"can be shown read-only":"will be skipped")); boolean readonly = installData.getRules().isConditionTrue(panel.getReadonlyCondition()); panel.setReadonly(readonly); logger.fine("Panel '" + getPanelId() + "' depending on readonlyCondition '" + panel.getReadonlyCondition() + "' " + (readonly?"is forcibly read-only":"is editable"));
/** * Reassemble choices according to current conditions and processor results * when the panel changes */ private void refreshChoices() { RadioField field = getField(); int index = 0; for (RadioChoiceView radioChoiceView : choices) { String conditionId = radioChoiceView.getChoice().getConditionId(); JRadioButton radioButton = radioChoiceView.getButton(); if (conditionId == null || getInstallData().getRules().isConditionTrue(conditionId)) { radioButton.setVisible(true); boolean selected = field.getSelectedIndex() == index; if (selected) { radioButton.setSelected(true); } } else { radioButton.setVisible(false); } index++; } }
String value = option.getValue(installData.getRules()); String newValue = installData.getVariables().replace(value); if (value != null && !value.equals(newValue))
getInstallData().getRules()));
public PacksModel(InstallData idata) { this.installData = idata; this.rules = idata.getRules(); try{ this.messages = idata.getMessages().newMessages(Resources.PACK_TRANSLATIONS_RESOURCE_NAME); } catch(ResourceNotFoundException ex){ this.messages=idata.getMessages(); } this.variables = idata.getVariables(); this.packsToInstall = idata.getSelectedPacks(); this.modifyInstallation = Boolean.valueOf(idata.getVariable(InstallData.MODIFY_INSTALLATION)); this.installedPacks = loadInstallationInformation(modifyInstallation); this.packs = getVisiblePacks(); this.hiddenPacks = getHiddenPacks(); this.nameToRow = getNametoRowMapping(packs); this.nameToPack = getNametoPackMapping(idata.getAvailablePacks()); this.packs = setPackProperties(packs, nameToPack); this.checkValues = initCheckValues(packs, packsToInstall); updateConditions(true); updatePacksToInstall(); }
int result = 0; Config config = getConfig(); RulesEngine rules = installData.getRules(); String variableValue = installData.getVariable(variable); for (IXMLElement choice : getSpec().getChildrenNamed(CHOICE))