Exemple #1
0
 /**
  * Sets space for this ui component to work with.
  *
  * @param space
  * @throws Exception
  */
 public void setValue(Space space) throws Exception {
   invokeGetBindingBean(space);
   UIFormTextAreaInput description = getUIFormTextAreaInput(SPACE_DESCRIPTION);
   description.setValue(StringEscapeUtils.unescapeHtml(description.getValue()));
   // TODO: have to find the way to don't need the line code below.
   getUIStringInput(SPACE_TAG).setValue(space.getTag());
 }
 @Override
 protected void processEvent(Event<PreviewPageActionComponent> event) throws Exception {
   UIWikiPortlet wikiPortlet = event.getSource().getAncestorOfType(UIWikiPortlet.class);
   WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
   ResourceBundle res = context.getApplicationResourceBundle();
   UIWikiMaskWorkspace uiMaskWS = wikiPortlet.getChild(UIWikiMaskWorkspace.class);
   UIWikiPageEditForm wikiPageEditForm =
       event.getSource().getAncestorOfType(UIWikiPageEditForm.class);
   UIWikiPagePreview wikiPagePreview =
       uiMaskWS.createUIComponent(UIWikiPagePreview.class, null, null);
   UIWikiRichTextArea wikiRichTextArea = wikiPageEditForm.getChild(UIWikiRichTextArea.class);
   UIWikiPageTitleControlArea wikiPageTitleArea =
       wikiPageEditForm.getChild(UIWikiPageTitleControlArea.class);
   String markupSyntax = Utils.getDefaultSyntax();
   boolean isRichTextRendered = wikiRichTextArea.isRendered();
   RenderingService renderingService =
       (RenderingService) PortalContainer.getComponent(RenderingService.class);
   String markup;
   if (isRichTextRendered) {
     String htmlContent = wikiRichTextArea.getUIFormTextAreaInput().getValue();
     markup =
         renderingService.render(
             htmlContent, Syntax.XHTML_1_0.toIdString(), markupSyntax, false);
     Utils.feedDataForWYSIWYGEditor(wikiPageEditForm, markup);
   } else {
     UIFormTextAreaInput markupInput =
         wikiPageEditForm.findComponentById(UIWikiPageEditForm.FIELD_CONTENT);
     markup = (markupInput.getValue() == null) ? "" : markupInput.getValue();
   }
   wikiPagePreview.renderWikiMarkup(markup, markupSyntax);
   String pageTitle = wikiPageTitleArea.getTitle();
   if (pageTitle != null) wikiPagePreview.setPageTitle(wikiPageTitleArea.getTitle());
   else {
     wikiPagePreview.setPageTitle(res.getString("UIWikiPageTitleControlArea.label.Untitled"));
   }
   uiMaskWS.setUIComponent(wikiPagePreview);
   uiMaskWS.setShow(true);
   uiMaskWS.setPopupTitle(res.getString("UIEditorTabs.action.PreviewPage"));
   event.getRequestContext().addUIComponentToUpdateByAjax(uiMaskWS);
   super.processEvent(event);
 }
Exemple #3
0
 private void setValueField(UIFormInputWithActions withActions, String field, String values)
     throws Exception {
   try {
     UIFormTextAreaInput textArea = withActions.getUIFormTextAreaInput(field);
     String vls = textArea.getValue();
     if (!ForumUtils.isEmpty(vls)) {
       values = values + ForumUtils.COMMA + vls;
       values = ForumUtils.removeStringResemble(values.replaceAll(",,", ForumUtils.COMMA));
     }
     textArea.setValue(values);
   } catch (Exception e) {
     log.debug("Set Value into field " + field + " is fall.", e);
   }
 }
Exemple #4
0
 public void updateSelect(String selectField, String value) throws Exception {
   UIFormTextAreaInput fieldInput = getUIFormTextAreaInput(selectField);
   String values = fieldInput.getValue();
   fieldInput.setValue(ForumUtils.updateMultiValues(value, values));
 }