コード例 #1
0
  public boolean preFullInsert() {
    HashMap<String, ArrayList<String>> tblData = getTableSelection();
    thePreInsertMap.put(
        "tabled_document_titles",
        tblData
            .get("tabled_document_titles")
            .toArray(new String[tblData.get("tabled_document_titles").size()]));
    thePreInsertMap.put(
        "tabled_document_uris",
        tblData
            .get("tabled_document_uris")
            .toArray(new String[tblData.get("tabled_document_uris").size()]));

    /* the above adds :
     *         thePreInsertMap.put("tabled_document_titles", arrDocTitles);
     *         thePreInsertMap.put("tabled_document_urs", arrDocURI);
     */

    thePreInsertMap.put("current_section", theAction.action_naming_convention());
    thePreInsertMap.put("target_section", getParentSection());
    thePreInsertMap.put("container_section", thePreInsertMap.get("target_section"));
    thePreInsertMap.put("document_fragment", FragmentsFactory.getFragment("hansard_papers"));
    thePreInsertMap.put("search_for", "[[PAPER_TITLE]]");
    thePreInsertMap.put("replacement_text", txt_title.getText());
    thePreInsertMap.put("bullet_list_begin_bookmark", new String("begin_tabled_documents_list"));
    // in insert mode this is always INSIDE_SECTION
    thePreInsertMap.put("selected_section_action_command", "INSIDE_SECTION");
    return true;
  }
コード例 #2
0
  private boolean sectionInsertionAction() {
    String strDebateDate = "", strTimeOfHansard = "", strLogoPath = "";
    Date dtDebate = dt_initdebate_hansarddate.getDate();
    SimpleDateFormat df = new SimpleDateFormat("HH:mm");
    strTimeOfHansard = df.format((Date) dt_initdebate_timeofhansard.getValue());
    SimpleDateFormat formatter = new SimpleDateFormat("MMMM dd yyyy");
    strDebateDate = formatter.format(dtDebate);
    strLogoPath = m_strLogoPath;

    long sectionBackColor = 0xffffff;
    float sectionLeftMargin = (float) .2;
    log.debug("section left margin : " + sectionLeftMargin);
    // get the parent section name of this action
    // query action parents to find the parent of this action

    // String parentSectionName =

    ExternalMacro AddSectionInsideSection =
        ExternalMacroFactory.getMacroDefinition("AddSectionInsideSectionWithStyle");
    AddSectionInsideSection.addParameter(ooDocument.getComponent());
    AddSectionInsideSection.addParameter(BungeniEditorPropertiesHelper.getDocumentRoot());
    AddSectionInsideSection.addParameter(theAction.action_naming_convention());
    AddSectionInsideSection.addParameter(sectionBackColor);
    AddSectionInsideSection.addParameter(sectionLeftMargin);

    ooDocument.executeMacro(
        AddSectionInsideSection.toString(), AddSectionInsideSection.getParams());

    this.setSectionMetadataForAction(theAction.action_naming_convention(), theAction);
    // embed logo image
    ExternalMacro addImageIntoSection =
        ExternalMacroFactory.getMacroDefinition("AddImageIntoSection");
    addImageIntoSection.addParameter(theAction.action_naming_convention());
    addImageIntoSection.addParameter(m_strLogoPath);
    ooDocument.executeMacro(addImageIntoSection.toString(), addImageIntoSection.getParams());

    // loading the related document
    ExternalMacro insertDocIntoSection =
        ExternalMacroFactory.getMacroDefinition("InsertDocumentIntoSection");
    insertDocIntoSection.addParameter(ooDocument.getComponent());
    insertDocIntoSection.addParameter(theAction.action_naming_convention());
    insertDocIntoSection.addParameter(FragmentsFactory.getFragment("hansard_masthead"));
    ooDocument.executeMacro(insertDocIntoSection.toString(), insertDocIntoSection.getParams());

    ExternalMacro setFieldValue =
        ExternalMacroFactory.getMacroDefinition("SetReferenceInputFieldValue");
    setFieldValue.addParameter(new String("debaterecord_official_date"));
    setFieldValue.addParameter(strDebateDate);
    setFieldValue.addParameter(new String("int:masthead_datetime"));
    ooDocument.executeMacro(setFieldValue.toString(), setFieldValue.getParams());

    setFieldValue.clearParams();
    setFieldValue.addParameter(new String("debaterecord_official_time"));
    setFieldValue.addParameter(strTimeOfHansard);
    setFieldValue.addParameter(new String("int:masthead_datetime"));
    ooDocument.executeMacro(setFieldValue.toString(), setFieldValue.getParams());

    ooDocMetadata meta = new ooDocMetadata(ooDocument);
    meta.AddProperty("Bungeni_DebateOfficialDate", strDebateDate);
    meta.AddProperty("Bungeni_DebateOfficialTime", strTimeOfHansard);

    enableButtons(true);
    // MessageBox.OK(parent, "Prayers section was successfully added");
    return true;
  }
コード例 #3
0
  /*
   *
   *
   *Insert mode processing
   *
   *
   */
  public boolean preFullInsert() {
    log.debug("in preFullInsert...");

    /** gathering values ** */
    long sectionBackColor = 0xffffff;
    float sectionLeftMargin = (float) .2;

    String parentSection = getParentSection();
    log.debug("preFullInsert() : getParentSection()" + parentSection);
    String newSectionName = getNewSectionName();
    log.debug("preFullInsert() : getNewSectionName()" + newSectionName);

    /** seeding pre insert map that will be used by the commands chain * */
    formContext.addFieldSet("section_back_color");
    formContext.addFieldSet("section_left_margin");
    formContext.addFieldSet("container_section");
    formContext.addFieldSet("current_section");
    formContext.addFieldSet("new_section");
    formContext.addFieldSet("selected_logo");
    formContext.addFieldSet("document_fragment");
    formContext.addFieldSet("image_import_section");
    formContext.addFieldSet("document_import_section");

    formContext.getFieldSets("section_back_color").add(Long.toHexString(sectionBackColor));
    // thePreInsertMap.put("section_back_color", Long.toHexString(sectionBackColor));
    formContext.getFieldSets("section_left_margin").add(Float.toString(sectionLeftMargin));
    // thePreInsertMap.put("section_left_margin", Float.toString(sectionLeftMargin));
    formContext.getFieldSets("container_section").add(parentSection);
    // thePreInsertMap.put("container_section", parentSection);
    formContext.getFieldSets("current_section").add(newSectionName);
    formContext.getFieldSets("document_import_section").add(newSectionName);
    // thePreInsertMap.put("current_section", newSectionName);
    formContext.getFieldSets("new_section").add(newSectionName);
    // thePreInsertMap.put("new_section", newSectionName);
    formContext
        .getFieldSets("selected_logo")
        .add((String) theControlDataMap.get("txt_initdebate_selectlogo"));
    // thePreInsertMap.put("selected_logo", (String)
    // theControlDataMap.get("txt_initdebate_selectlogo"));
    formContext
        .getFieldSets("document_fragment")
        .add((String) FragmentsFactory.getFragment("hansard_masthead"));
    // thePreInsertMap.put("document_fragment", (String)
    // FragmentsFactory.getFragment("hansard_masthead"));
    formContext.getFieldSets("image_import_section").add(newSectionName);

    formContext.addFieldSet("document_field_set");
    formContext
        .getFieldSets("document_field_set")
        .add(
            new ooDocFieldSet(
                new String("debaterecord_official_date"),
                (String) theControlDataMap.get("dt_initdebate_hansarddate"),
                new String("int:masthead_datetime")));
    formContext
        .getFieldSets("document_field_set")
        .add(
            new ooDocFieldSet(
                new String("debaterecord_official_time"),
                (String) theControlDataMap.get("dt_initdebate_timeofhansard"),
                new String("int:masthead_datetime")));

    formContext
        .getMetadataFieldSets()
        .add(
            new ooDocMetadataFieldSet(
                "BungeniDebateOfficialDate",
                (String) theControlDataMap.get("dt_initdebate_hansarddate")));
    formContext
        .getMetadataFieldSets()
        .add(
            new ooDocMetadataFieldSet(
                "BungeniDebateOfficialTime",
                (String) theControlDataMap.get("dt_initdebate_timeofhansard")));

    return true;
  }