List of usage examples for org.dom4j Node selectSingleNode
Node selectSingleNode(String xpathExpression);
selectSingleNode
evaluates an XPath expression and returns the result as a single Node
instance.
From source file:org.pdfsam.plugin.encrypt.GUI.EncryptMainGUI.java
License:Open Source License
@SuppressWarnings("unchecked") public void loadJobNode(Node arg0) throws LoadJobException { try {//from w w w . jav a2s . com List fileList = arg0.selectNodes("filelist/file"); for (int i = 0; fileList != null && i < fileList.size(); i++) { Node fileNode = (Node) fileList.get(i); if (fileNode != null) { Node fileName = (Node) fileNode.selectSingleNode("@name"); if (fileName != null && fileName.getText().length() > 0) { Node filePwd = (Node) fileNode.selectSingleNode("@password"); selectionPanel.getLoader().addFile(new File(fileName.getText()), (filePwd != null) ? filePwd.getText() : null); } } } Node allowAll = (Node) arg0.selectSingleNode("allowall/@value"); if (allowAll != null && TRUE.equals(allowAll.getText())) { allowAllCheck.doClick(); } else { Node permissions = (Node) arg0.selectSingleNode("permissions"); if (permissions != null) { List listEnab = permissions.selectNodes("enabled"); for (int j = 0; listEnab != null && j < listEnab.size(); j++) { Node enabledNode = (Node) listEnab.get(j); if (enabledNode != null) { permissionsCheck[Integer.parseInt(enabledNode.selectSingleNode("@value").getText())] .setSelected(true); } } } } Node encType = (Node) arg0.selectSingleNode("enctype/@value"); if (encType != null) { encryptType.setSelectedItem((String) encType.getText()); } Node userPwd = (Node) arg0.selectSingleNode("usrpwd/@value"); if (userPwd != null) { userPwdField.setText(userPwd.getText()); } Node ownerPwd = (Node) arg0.selectSingleNode("ownerpwd/@value"); if (ownerPwd != null) { ownerPwdField.setText(ownerPwd.getText()); } Node fileDestination = (Node) arg0.selectSingleNode("destination/@value"); if (fileDestination != null) { destFolderText.setText(fileDestination.getText()); } Node fileOverwrite = (Node) arg0.selectSingleNode("overwrite/@value"); if (fileOverwrite != null) { overwriteCheckbox.setSelected(TRUE.equals(fileOverwrite.getText())); } Node fileCompressed = (Node) arg0.selectSingleNode("compressed/@value"); if (fileCompressed != null && TRUE.equals(fileCompressed.getText())) { outputCompressedCheck.doClick(); } Node filePrefix = (Node) arg0.selectSingleNode("prefix/@value"); if (filePrefix != null) { outPrefixTextField.setText(filePrefix.getText()); } Node pdfVersion = (Node) arg0.selectSingleNode("pdfversion/@value"); if (pdfVersion != null) { for (int i = 0; i < versionCombo.getItemCount(); i++) { if (((StringItem) versionCombo.getItemAt(i)).getId().equals(pdfVersion.getText())) { versionCombo.setSelectedIndex(i); break; } } } log.info(GettextResource.gettext(config.getI18nResourceBundle(), "Encrypt section loaded.")); } catch (Exception ex) { log.error(GettextResource.gettext(config.getI18nResourceBundle(), "Error: "), ex); } }
From source file:org.pdfsam.plugin.merge.GUI.MergeMainGUI.java
License:Open Source License
@SuppressWarnings("unchecked") public void loadJobNode(Node arg0) throws LoadJobException { try {// w w w. ja v a 2 s . com Node fileDestination = (Node) arg0.selectSingleNode("destination/@value"); if (fileDestination != null) { destinationTextField.setText(fileDestination.getText()); } Node fileOverwrite = (Node) arg0.selectSingleNode("overwrite/@value"); if (fileOverwrite != null) { overwriteCheckbox.setSelected(TRUE.equals(fileOverwrite.getText())); } Node mergeType = (Node) arg0.selectSingleNode("merge_type/@value"); if (mergeType != null) { mergeTypeCheck.setSelected(TRUE.equals(mergeType.getText())); } List fileList = arg0.selectNodes("filelist/file"); for (int i = 0; fileList != null && i < fileList.size(); i++) { Node fileNode = (Node) fileList.get(i); if (fileNode != null) { Node fileName = (Node) fileNode.selectSingleNode("@name"); if (fileName != null && fileName.getText().length() > 0) { Node pageSelection = (Node) fileNode.selectSingleNode("@pageselection"); Node filePwd = (Node) fileNode.selectSingleNode("@password"); selectionPanel.getLoader().addFile(new File(fileName.getText()), (filePwd != null) ? filePwd.getText() : null, (pageSelection != null) ? pageSelection.getText() : null); } } } Node fileCompressed = (Node) arg0.selectSingleNode("compressed/@value"); if (fileCompressed != null && TRUE.equals(fileCompressed.getText())) { outputCompressedCheck.doClick(); } Node pdfVersion = (Node) arg0.selectSingleNode("pdfversion/@value"); if (pdfVersion != null) { for (int i = 0; i < versionCombo.getItemCount(); i++) { if (((StringItem) versionCombo.getItemAt(i)).getId().equals(pdfVersion.getText())) { versionCombo.setSelectedIndex(i); break; } } } log.info(GettextResource.gettext(config.getI18nResourceBundle(), "Merge section loaded.")); } catch (Exception ex) { log.error(GettextResource.gettext(config.getI18nResourceBundle(), "Error: "), ex); } }
From source file:org.pdfsam.plugin.mix.GUI.MixMainGUI.java
License:Open Source License
public void loadJobNode(Node arg0) throws LoadJobException { try {//from w ww .ja v a 2s . c o m Node firstNode = (Node) arg0.selectSingleNode("first/@value"); if (firstNode != null && firstNode.getText().length() > 0) { Node firstPwd = (Node) arg0.selectSingleNode("first/@password"); selectionPanel.getLoader().addFile(new File(firstNode.getText()), (firstPwd != null) ? firstPwd.getText() : null); } Node secondNode = (Node) arg0.selectSingleNode("second/@value"); if (secondNode != null && secondNode.getText().length() > 0) { Node secondPwd = (Node) arg0.selectSingleNode("second/@password"); selectionPanel.getLoader().addFile(new File(secondNode.getText()), (secondPwd != null) ? secondPwd.getText() : null); } Node fileDestination = (Node) arg0.selectSingleNode("destination/@value"); if (fileDestination != null) { destinationTextField.setText(fileDestination.getText()); } Node stepDestination = (Node) arg0.selectSingleNode("step/@value"); if (stepDestination != null) { stepTextField.setText(stepDestination.getText()); } Node secondStepDestination = (Node) arg0.selectSingleNode("secondstep/@value"); if (secondStepDestination != null) { secondStepTextField.setText(secondStepDestination.getText()); } Node fileOverwrite = (Node) arg0.selectSingleNode("overwrite/@value"); if (fileOverwrite != null) { overwriteCheckbox.setSelected(TRUE.equals(fileOverwrite.getText())); } Node reverseFirst = (Node) arg0.selectSingleNode("reverse_first/@value"); if (reverseFirst != null) { reverseFirstCheckbox.setSelected(TRUE.equals(reverseFirst.getText())); } Node reverseSecond = (Node) arg0.selectSingleNode("reverse_second/@value"); if (reverseSecond != null) { reverseSecondCheckbox.setSelected(TRUE.equals(reverseSecond.getText())); } Node fileCompressed = (Node) arg0.selectSingleNode("compressed/@value"); if (fileCompressed != null && TRUE.equals(fileCompressed.getText())) { outputCompressedCheck.doClick(); } Node pdfVersion = (Node) arg0.selectSingleNode("pdfversion/@value"); if (pdfVersion != null) { for (int i = 0; i < versionCombo.getItemCount(); i++) { if (((StringItem) versionCombo.getItemAt(i)).getId().equals(pdfVersion.getText())) { versionCombo.setSelectedIndex(i); break; } } } log.info(GettextResource.gettext(config.getI18nResourceBundle(), "AlternateMix section loaded.")); } catch (Exception ex) { log.error(GettextResource.gettext(config.getI18nResourceBundle(), "Error: "), ex); } }
From source file:org.pdfsam.plugin.rotate.GUI.RotateMainGUI.java
License:Open Source License
@SuppressWarnings("unchecked") public void loadJobNode(Node arg0) throws LoadJobException { try {//from ww w. j a va2s.co m List fileList = arg0.selectNodes("filelist/file"); for (int i = 0; fileList != null && i < fileList.size(); i++) { Node fileNode = (Node) fileList.get(i); if (fileNode != null) { Node fileName = (Node) fileNode.selectSingleNode("@name"); if (fileName != null && fileName.getText().length() > 0) { Node filePwd = (Node) fileNode.selectSingleNode("@password"); selectionPanel.getLoader().addFile(new File(fileName.getText()), (filePwd != null) ? filePwd.getText() : null); } } } Node rotationNode = (Node) arg0.selectSingleNode("rotation/@value"); if (rotationNode != null) { rotationBox.setSelectedItem((String) rotationNode.getText()); } Node rotationPageNode = (Node) arg0.selectSingleNode("pages/@value"); if (rotationPageNode != null) { for (int i = 0; i < rotationPagesBox.getItemCount(); i++) { if (((StringItem) rotationPagesBox.getItemAt(i)).getId().equals(rotationPageNode.getText())) { rotationPagesBox.setSelectedIndex(i); break; } } } Node fileDestination = (Node) arg0.selectSingleNode("destination/@value"); if (fileDestination != null) { destinationTextField.setText(fileDestination.getText()); } Node fileOverwrite = (Node) arg0.selectSingleNode("overwrite/@value"); if (fileOverwrite != null) { overwriteCheckbox.setSelected(fileOverwrite.getText().equals("true")); } Node fileCompressed = (Node) arg0.selectSingleNode("compressed/@value"); if (fileCompressed != null && TRUE.equals(fileCompressed.getText())) { outputCompressedCheck.doClick(); } Node filePrefix = (Node) arg0.selectSingleNode("prefix/@value"); if (filePrefix != null) { outPrefixTextField.setText(filePrefix.getText()); } Node pdfVersion = (Node) arg0.selectSingleNode("pdfversion/@value"); if (pdfVersion != null) { for (int i = 0; i < versionCombo.getItemCount(); i++) { if (((StringItem) versionCombo.getItemAt(i)).getId().equals(pdfVersion.getText())) { versionCombo.setSelectedIndex(i); break; } } } log.info(GettextResource.gettext(config.getI18nResourceBundle(), "Rotate section loaded.")); } catch (Exception ex) { log.error(GettextResource.gettext(config.getI18nResourceBundle(), "Error: "), ex); } }
From source file:org.pdfsam.plugin.setviewer.GUI.SetViewerMainGUI.java
License:Open Source License
public void loadJobNode(Node arg0) throws LoadJobException { try {//from ww w. j a v a 2s . c o m Node fileSource = (Node) arg0.selectSingleNode("source/@value"); if (fileSource != null && fileSource.getText().length() > 0) { Node filePwd = (Node) arg0.selectSingleNode("source/@password"); String password = null; if (filePwd != null && filePwd.getText().length() > 0) { password = filePwd.getText(); } selectionPanel.getLoader().addFile(new File(fileSource.getText()), password); } Node viewerLayoutNode = (Node) arg0.selectSingleNode("viewer-layout/@value"); if (viewerLayoutNode != null) { for (int i = 0; i < viewerLayout.getItemCount(); i++) { if (((StringItem) viewerLayout.getItemAt(i)).getId().equals(viewerLayoutNode.getText())) { viewerLayout.setSelectedIndex(i); break; } } } Node viewerOpenModeNode = (Node) arg0.selectSingleNode("viewer-open-mode/@value"); if (viewerOpenModeNode != null) { for (int i = 0; i < viewerOpenMode.getItemCount(); i++) { if (((StringItem) viewerOpenMode.getItemAt(i)).getId().equals(viewerOpenModeNode.getText())) { viewerOpenMode.setSelectedIndex(i); break; } } } Node nonFullScreenModeNode = (Node) arg0.selectSingleNode("non-fullscreen-mode/@value"); if (nonFullScreenModeNode != null) { for (int i = 0; i < nonFullScreenMode.getItemCount(); i++) { if (((StringItem) nonFullScreenMode.getItemAt(i)).getId() .equals(nonFullScreenModeNode.getText())) { nonFullScreenMode.setSelectedIndex(i); break; } } } Node directionComboNode = (Node) arg0.selectSingleNode("direction/@value"); if (directionComboNode != null) { for (int i = 0; i < directionCombo.getItemCount(); i++) { if (((StringItem) directionCombo.getItemAt(i)).getId().equals(directionComboNode.getText())) { directionCombo.setSelectedIndex(i); break; } } } Node hideMenuBarNode = (Node) arg0.selectSingleNode("hide-menu-bar/@value"); if (hideMenuBarNode != null) { hideMenuBar.setSelected(TRUE.equals(hideMenuBarNode.getText())); } Node hideToolBarNode = (Node) arg0.selectSingleNode("hide-tool-bar/@value"); if (hideToolBarNode != null) { hideToolBar.setSelected(TRUE.equals(hideToolBarNode.getText())); } Node hideUIElementsNode = (Node) arg0.selectSingleNode("hide-ui-elements/@value"); if (hideUIElementsNode != null) { hideUIElements.setSelected(TRUE.equals(hideUIElementsNode.getText())); } Node resizeNode = (Node) arg0.selectSingleNode("resize/@value"); if (resizeNode != null) { resizeToFit.setSelected(TRUE.equals(resizeNode.getText())); } Node centerScreenNode = (Node) arg0.selectSingleNode("center-screen/@value"); if (centerScreenNode != null) { centerScreen.setSelected(TRUE.equals(centerScreenNode.getText())); } Node displayTitleNode = (Node) arg0.selectSingleNode("display-title/@value"); if (displayTitleNode != null && TRUE.equals(displayTitleNode.getText())) { displayTitle.doClick(); } Node noPageScalingNode = (Node) arg0.selectSingleNode("no-page-scaling/@value"); if (noPageScalingNode != null && TRUE.equals(noPageScalingNode.getText())) { noPageScaling.doClick(); } Node fileDestination = (Node) arg0.selectSingleNode("destination/@value"); if (fileDestination != null) { destFolderText.setText(fileDestination.getText()); } Node fileOverwrite = (Node) arg0.selectSingleNode("overwrite/@value"); if (fileOverwrite != null) { overwriteCheckbox.setSelected(TRUE.equals(fileOverwrite.getText())); } Node fileCompressed = (Node) arg0.selectSingleNode("compressed/@value"); if (fileCompressed != null && TRUE.equals(fileCompressed.getText())) { outputCompressedCheck.doClick(); } Node filePrefix = (Node) arg0.selectSingleNode("prefix/@value"); if (filePrefix != null) { outPrefixTextField.setText(filePrefix.getText()); } Node pdfVersion = (Node) arg0.selectSingleNode("pdfversion/@value"); if (pdfVersion != null) { for (int i = 0; i < versionCombo.getItemCount(); i++) { if (((StringItem) versionCombo.getItemAt(i)).getId().equals(pdfVersion.getText())) { versionCombo.setSelectedIndex(i); break; } } } log.info(GettextResource.gettext(config.getI18nResourceBundle(), "Viewer options section loaded.")); } catch (Exception ex) { log.error(GettextResource.gettext(config.getI18nResourceBundle(), "Error: "), ex); } }
From source file:org.pdfsam.plugin.split.GUI.SplitMainGUI.java
License:Open Source License
public void loadJobNode(Node arg0) throws LoadJobException { try {// w w w .j a v a 2 s . c o m Node fileSource = (Node) arg0.selectSingleNode("source/@value"); if (fileSource != null && fileSource.getText().length() > 0) { Node filePwd = (Node) arg0.selectSingleNode("source/@password"); String password = null; if (filePwd != null && filePwd.getText().length() > 0) { password = filePwd.getText(); } selectionPanel.getLoader().addFile(new File(fileSource.getText()), password); } Node splitOption = (Node) arg0.selectSingleNode("split_option/@value"); if (splitOption != null) { if (splitOption.getText().equals(burstRadio.getSplitCommand())) burstRadio.doClick(); else if (splitOption.getText().equals(everyNRadio.getSplitCommand())) everyNRadio.doClick(); else if (splitOption.getText().equals(evenRadio.getSplitCommand())) evenRadio.doClick(); else if (splitOption.getText().equals(oddRadio.getSplitCommand())) oddRadio.doClick(); else if (splitOption.getText().equals(thisPageRadio.getSplitCommand())) thisPageRadio.doClick(); else if (splitOption.getText().equals(sizeRadio.getSplitCommand())) sizeRadio.doClick(); else if (splitOption.getText().equals(bookmarksLevel.getSplitCommand())) bookmarksLevel.doClick(); } Node splitNpages = (Node) arg0.selectSingleNode("npages/@value"); if (splitNpages != null) { nPagesTextField.setText(splitNpages.getText()); } Node splitThispage = (Node) arg0.selectSingleNode("thispage/@value"); if (splitThispage != null) { thisPageTextField.setText(splitThispage.getText()); } Node splitSize = (Node) arg0.selectSingleNode("splitsize/@value"); if (splitSize != null) { splitSizeCombo.setSelectedItem(splitSize.getText()); } Node bookLevel = (Node) arg0.selectSingleNode("bookmarkslevel/@value"); if (bookLevel != null) { bLevelCombo.setSelectedItem(bookLevel.getText()); } Node fileDestination = (Node) arg0.selectSingleNode("destination/@value"); if (fileDestination != null && fileDestination.getText().length() > 0) { destinationFolderText.setText(fileDestination.getText()); chooseAFolderRadio.doClick(); } else { sameAsSourceRadio.doClick(); } Node fileOverwrite = (Node) arg0.selectSingleNode("overwrite/@value"); if (fileOverwrite != null) { overwriteCheckbox.setSelected(TRUE.equals(fileOverwrite.getText())); } Node fileCompressed = (Node) arg0.selectSingleNode("compressed/@value"); if (fileCompressed != null && TRUE.equals(fileCompressed.getText())) { outputCompressedCheck.doClick(); } Node filePrefix = (Node) arg0.selectSingleNode("prefix/@value"); if (filePrefix != null) { outPrefixText.setText(filePrefix.getText()); } Node pdfVersion = (Node) arg0.selectSingleNode("pdfversion/@value"); if (pdfVersion != null) { for (int i = 0; i < versionCombo.getItemCount(); i++) { if (((StringItem) versionCombo.getItemAt(i)).getId().equals(pdfVersion.getText())) { versionCombo.setSelectedIndex(i); break; } } } log.info(GettextResource.gettext(config.getI18nResourceBundle(), "Split section loaded.")); } catch (Exception ex) { log.error(GettextResource.gettext(config.getI18nResourceBundle(), "Error: "), ex); } }
From source file:org.pdfsam.plugin.unpack.GUI.UnpackMainGUI.java
License:Open Source License
@SuppressWarnings("unchecked") public void loadJobNode(Node arg0) throws LoadJobException { try {/*from ww w . ja v a 2s . c o m*/ List fileList = arg0.selectNodes("filelist/file"); for (int i = 0; fileList != null && i < fileList.size(); i++) { Node fileNode = (Node) fileList.get(i); if (fileNode != null) { Node fileName = (Node) fileNode.selectSingleNode("@name"); if (fileName != null && fileName.getText().length() > 0) { Node filePwd = (Node) fileNode.selectSingleNode("@password"); selectionPanel.getLoader().addFile(new File(fileName.getText()), (filePwd != null) ? filePwd.getText() : null); } } } Node fileDestination = (Node) arg0.selectSingleNode("destination/@value"); if (fileDestination != null) { destinationTextField.setText(fileDestination.getText()); } Node fileOverwrite = (Node) arg0.selectSingleNode("overwrite/@value"); if (fileOverwrite != null) { overwriteCheckbox.setSelected(fileOverwrite.getText().equals("true")); } log.info(GettextResource.gettext(config.getI18nResourceBundle(), "Unpack section loaded.")); } catch (Exception ex) { log.error(GettextResource.gettext(config.getI18nResourceBundle(), "Error: "), ex); } }
From source file:org.pdfsam.plugin.vcomposer.GUI.VComposerMainGUI.java
License:Open Source License
public void loadJobNode(Node arg0) throws LoadJobException { if (arg0 != null) { try {/* ww w . j a va2 s.co m*/ resetPanel(); Node fileSource = (Node) arg0.selectSingleNode("source/@value"); if (fileSource != null && fileSource.getText().length() > 0) { Node filePwd = (Node) arg0.selectSingleNode("source/@password"); String password = null; if (filePwd != null && filePwd.getText().length() > 0) { password = filePwd.getText(); } composerPanel.getPdfLoader().addFile(new File(fileSource.getText()), password); } Node fileDestination = (Node) arg0.selectSingleNode("destination/@value"); if (fileDestination != null && fileDestination.getText().length() > 0) { destinationFileText.setText(fileDestination.getText()); } Node fileOverwrite = (Node) arg0.selectSingleNode("overwrite/@value"); if (fileOverwrite != null) { overwriteCheckbox.setSelected(TRUE.equals(fileOverwrite.getText())); } Node fileCompressed = (Node) arg0.selectSingleNode("compressed/@value"); if (fileCompressed != null && TRUE.equals(fileCompressed.getText())) { outputCompressedCheck.doClick(); } Node pdfVersion = (Node) arg0.selectSingleNode("pdfversion/@value"); if (pdfVersion != null) { for (int i = 0; i < versionCombo.getItemCount(); i++) { if (((StringItem) versionCombo.getItemAt(i)).getId().equals(pdfVersion.getText())) { versionCombo.setSelectedIndex(i); break; } } } log.info(GettextResource.gettext(config.getI18nResourceBundle(), "Split section loaded.")); } catch (Exception ex) { log.error(GettextResource.gettext(config.getI18nResourceBundle(), "Error: "), ex); } } }
From source file:org.pdfsam.plugin.vpagereorder.GUI.VPageReorderMainGUI.java
License:Open Source License
@SuppressWarnings("unchecked") public void loadJobNode(Node arg0) throws LoadJobException { try {//from w ww . j a va2 s. co m Node fileSource = (Node) arg0.selectSingleNode("source/@value"); if (fileSource != null && fileSource.getText().length() > 0) { Node filePwd = (Node) arg0.selectSingleNode("source/@password"); String password = null; if (filePwd != null && filePwd.getText().length() > 0) { password = filePwd.getText(); } List<DocumentPage> template = null; List<Node> pages = arg0.selectNodes("source/page"); if (pages != null && pages.size() > 0) { for (Node pageNode : pages) { DocumentPage currentPage = XmlUtility.getDocumentPage(pageNode); if (currentPage != null) { if (template == null) { template = new ArrayList<DocumentPage>(); } template.add(currentPage); } } } selectionPanel.getPdfLoader().addFile(new File(fileSource.getText()), password, template); } Node fileDestination = (Node) arg0.selectSingleNode("destination/@value"); if (fileDestination != null && fileDestination.getText().length() > 0) { destinationFileText.setText(fileDestination.getText()); chooseAFileRadio.doClick(); } else { sameAsSourceRadio.doClick(); } Node fileOverwrite = (Node) arg0.selectSingleNode("overwrite/@value"); if (fileOverwrite != null) { overwriteCheckbox.setSelected(TRUE.equals(fileOverwrite.getText())); } Node fileCompressed = (Node) arg0.selectSingleNode("compressed/@value"); if (fileCompressed != null && TRUE.equals(fileCompressed.getText())) { outputCompressedCheck.doClick(); } Node pdfVersion = (Node) arg0.selectSingleNode("pdfversion/@value"); if (pdfVersion != null) { for (int i = 0; i < versionCombo.getItemCount(); i++) { if (((StringItem) versionCombo.getItemAt(i)).getId().equals(pdfVersion.getText())) { versionCombo.setSelectedIndex(i); break; } } } log.info(GettextResource.gettext(config.getI18nResourceBundle(), "Visual Reorder section loaded.")); } catch (Exception ex) { log.error(GettextResource.gettext(config.getI18nResourceBundle(), "Error: "), ex); } }
From source file:org.pentaho.actionsequence.dom.actions.JFreeReportGenAction.java
License:Open Source License
private IActionInput getComponentValue(String elementName) { IActionInput value = getInput(elementName); try {//from w ww . j av a 2s . c o m if (value == ActionInputConstant.NULL_INPUT) { value = getInput(COMPONENT_SETTINGS_ELEMENT); Document doc = DocumentHelper.parseText(value.getStringValue()); Node componentNode = doc.getRootElement(); value = new ActionInputConstant(componentNode.selectSingleNode(elementName).getText(), this.actionParameterMgr); } } catch (Exception e) { value = ActionInputConstant.NULL_INPUT; } return value; }