private void displayFilteredDialog() { try { log.debug("displayFilteredDialog: subAction name = " + this.m_subAction.sub_action_name()); // toolbarAction parentAction = getParentAction(); JDialog initDebaterecord; initDebaterecord = new JDialog(); initDebaterecord.setTitle("Enter Settings for Document"); initDebaterecord.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); // initDebaterecord.setPreferredSize(new Dimension(420, 300)); InitDebateRecord panel = new InitDebateRecord(ooDocument, initDebaterecord, m_parentAction, m_subAction); // panel.setDialogMode(SelectorDialogModes.TEXT_INSERTION); // panel.setBackground(new Color(255, 255, 153)); // initDebaterecord.setTitle("Selection Mode"); initDebaterecord.getContentPane().add(panel); initDebaterecord.pack(); initDebaterecord.setLocationRelativeTo(null); initDebaterecord.setVisible(true); initDebaterecord.setAlwaysOnTop(true); } catch (Exception ex) { log.error("displayFilteredDialog : " + ex.getMessage()); log.error( "displayFilteredDialog: stack trace : \n" + org.bungeni.ooo.utils.CommonExceptionUtils.getStackTrace(ex)); } }
private boolean action_createRootSection(OOComponentHelper ooDoc, String sectionName) { boolean bResult = false; try { XText docText = ooDocument.getTextDocument().getText(); XTextCursor docCursor = docText.createTextCursor(); docCursor.gotoStart(false); docCursor.gotoEnd(true); XTextContent theContent = ooDocument.createTextSection(sectionName, (short) 1); docText.insertTextContent(docCursor, theContent, true); bResult = true; } catch (IllegalArgumentException ex) { log.error("in action_createRootSection :" + ex.getMessage()); log.error("in action_createRootSection :" + CommonExceptionUtils.getStackTrace(ex)); } finally { return bResult; } }
private int check_containment_Section(String currentContainerSection) { int error = BungeniError.GENERAL_ERROR; try { // get valid parent actions String strActionName = m_parentAction.action_name(); dbSettings.Connect(); String fetchParentQuery = SettingsQueryFactory.Q_FETCH_PARENT_ACTIONS(strActionName); log.debug("checkContainmentSection = " + fetchParentQuery); QueryResults qr = dbSettings.QueryResults(fetchParentQuery); dbSettings.EndConnect(); String[] actionSectionTypes = qr.getSingleColumnResult("ACTION_SECTION_TYPE"); // there can be multiple parents... so we iterate through the array if one of them is a valid // parent HashMap<String, String> sectionMetadata = ooDocument.getSectionMetadataAttributes(currentContainerSection); // if (sectionMetadata.get) String strDocSectionType = ""; if (sectionMetadata.containsKey("BungeniSectionType")) { strDocSectionType = sectionMetadata.get("BungeniSectionType").trim(); // check the doc section type against the array of valid action section types for (String sectionType : actionSectionTypes) { if (strDocSectionType.equals(sectionType.trim())) { error = BungeniError.VALID_SECTION_CONTAINER; break; } else { error = BungeniError.INVALID_SECTION_CONTAINER; } } } else { error = BungeniError.INVALID_SECTION_CONTAINER; } } catch (Exception ex) { log.error("check_containmentSection : " + ex.getMessage()); log.error("check_containmentSection : " + CommonExceptionUtils.getStackTrace(ex)); } finally { return error; } }