cancel
Showing results for 
Search instead for 
Did you mean: 

Plugging in new In Line editors

rdanner
Champ in-the-making
Champ in-the-making

    public void editFile(ActionEvent event)
    {
        UIActionLink link = (UIActionLink)event.getComponent();
        Map params = link.getParameterMap();
        String id = (String)params.get("id");
        if(id != null && id.length() != 0)
        {
            boolean editingInline = false;
            Node node = setupContentDocument(id);
            if(node.hasAspect(ApplicationModel.ASPECT_INLINEEDITABLE) && node.getProperties().get(ApplicationModel.PROP_EDITINLINE) != null && ((Boolean)node.getProperties().get(ApplicationModel.PROP_EDITINLINE)).booleanValue())
            {
                ContentReader reader = getContentService().getReader(node.getNodeRef(), ContentModel.PROP_CONTENT);
                if(reader != null)
                {
                    editingInline = true;
                    String mimetype = reader.getMimetype();
                    if("text/plain".equals(mimetype) || "text/xml".equals(mimetype) || "text/css".equals(mimetype) || "application/x-javascript".equals(mimetype))
                    {
                        setEditorOutput(reader.getContentString());
                        FacesContext fc = FacesContext.getCurrentInstance();
                        navigator.setupDispatchContext(node);
                        fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "dialog:editTextInline");
                    } else
                    {
                        setDocumentContent(reader.getContentString());
                        setEditorOutput(null);
                        FacesContext fc = FacesContext.getCurrentInstance();
                        navigator.setupDispatchContext(node);
                        fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "dialog:editHtmlInline");
                    }
                }
            }
            if(!editingInline)
            {
                FacesContext fc = FacesContext.getCurrentInstance();
                navigator.setupDispatchContext(node);
                fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "dialog:editFile");
            }
        }
    }

I'd like to think out loud here in the forums about the checkin-checkout bean.  This is the edit content function in the CheckinCheckoutBean of the Webclient. It has served many of us well and for that I am thankful, but it doesn't really provide a mechanism for plugging in new editors.  I think it's really important that we address the extensibility issue here because these  editors are first very basic and second I think developing new in line editors is something the community could really help out with.

The hard coding is the obvious issue and I think that is easily resolved.  The harder questions are things like:  Is mimetype the only selector?  I content no.  So we'll want to find a general way to solve that issue as well.

Please contribute your thoughts.

-R
1 REPLY 1

rdanner
Champ in-the-making
Champ in-the-making
2.1 has changed how this works.  I'm still learning about it –  but the code I posted above is no longer relevant.  The issue still persists but the code bas been moved to a new class CheckInCheckoutDialog:

               
               // calculate which editor screen to display
               if (MimetypeMap.MIMETYPE_TEXT_PLAIN.equals(mimetype) ||
                   MimetypeMap.MIMETYPE_XML.equals(mimetype) ||
                   MimetypeMap.MIMETYPE_TEXT_CSS.equals(mimetype) ||
                   MimetypeMap.MIMETYPE_JAVASCRIPT.equals(mimetype))
               {
                  // make content available to the text editing screen
                  property.setEditorOutput(reader.getContentString());
                 
                  // navigate to appropriate screen
                  FacesContext fc = FacesContext.getCurrentInstance();
                  this.navigator.setupDispatchContext(node);
                  fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "dialog:editTextInline");
               }
               else
               {
                  // make content available to the html editing screen
                  property.setDocumentContent(reader.getContentString());
                  property.setEditorOutput(null);
                 
                  // navigate to appropriate screen
                  FacesContext fc = FacesContext.getCurrentInstance();
                  this.navigator.setupDispatchContext(node);
                  fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "dialog:editHtmlInline");
               }
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.