RE: inlineType with no dialog

3 views
Skip to first unread message

Ashok Hariharan

unread,
Dec 19, 2012, 4:22:48 AM12/19/12
to say...@birzeit.edu, bungeni...@googlegroups.com, Ahmad Hammo


On 19 December 2012 10:36, <say...@birzeit.edu> wrote:

but what about inlineTypes with no dialog .. how can implement it?

Thats pretty straightforward .

You define the inlinetype as before .. in the configuration.

But in the action configuration, you specify a customer router and dont indicate a dialog  e.g. :

    <action name="make_simple_inline" source="inlineType" metadata="SimpleInline" >
        <router class="org.bungeni.editor.actions.routers.routerCreateSimpleInline" />
    </action>

THen you just create a router implementation class :


org.bungeni.editor.actions.routers.routerCreateSimpleInline

and override the route_TextSelectedInsert() API --

where you will have to do something like :

//build the map of properties to set on the inline
HashMap<String,String> inlinePropsMap = new HashMap<String,String>();
//this is mandatory to identify the inline type
inlinePropsMap.put("BungeniInlineType", subAction.getInlineType());
//these are optional custom properties like the refURI ..
inlinePropsMap.put("BungeniSimpleInlineMeta", "Something");
//set the metadata on the selected text
ooDocument.setSelectedTextAttributes(inlinePropsMap);






Ashok Hariharan

unread,
Dec 19, 2012, 4:39:55 AM12/19/12
to say...@birzeit.edu, bungeni...@googlegroups.com, Ahmad Hammo
I just wrote an inline creation router , you can use it as an action router for any inline type  :


package org.bungeni.editor.actions.routers;



import java.util.HashMap;
import org.bungeni.editor.actions.toolbarAction;
import org.bungeni.editor.actions.toolbarAction.actionSourceOrigin;
import org.bungeni.error.BungeniMsg;
import org.bungeni.error.BungeniValidatorState;
import org.bungeni.ooo.OOComponentHelper;

/**
 * Creates an Inline
 * @author Ashok Hariharan
 */
public class routerInitInline extends defaultRouter {
   private static org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(routerInitInline.class.getName());
 

    /** Creates a new instance of routerCreateSection */
    public routerInitInline() {
        super();
       
    }

    @Override
    public BungeniValidatorState route_TextSelectedInsert( toolbarAction subAction, javax.swing.JFrame pFrame,OOComponentHelper ooDocument) {
        // check if the action supports an inline Type markup
        boolean bState = false ;
        if (subAction.getActionSource().equals(actionSourceOrigin.inlineType)) {
          String inlineTypeName = subAction.getInlineType();
          HashMap<String,String> inlineTypeMap = new HashMap<String,String>();
          inlineTypeMap.put("BungeniInlineType", inlineTypeName);
          ooDocument.setSelectedTextAttributes(inlineTypeMap);
          bState = true;
        }
      if (bState) {
            return new BungeniValidatorState(true, new BungeniMsg("SUCCESS"));
        }
      else {
            return new BungeniValidatorState(true, new BungeniMsg("FAILURE"));

Ashok Hariharan

unread,
Dec 19, 2012, 6:01:31 AM12/19/12
to say...@birzeit.edu, bungeni...@googlegroups.com, Ahmad Hammo
For longTitle in preface use something like this :

<action .... source="inlineType" metadata="LongTitle">
    <router class="org.bungeni.editor.actions.routers.routerCreateInline" />
</action>

leave the dialog attribute out.

I just commited the below router implementation as routerCreateInline :

http://code.google.com/p/bungeni-editor/source/detail?r=2834

So if you update to that revision you will get that router action to use ...

Samar Ayesh

unread,
Dec 20, 2012, 3:17:27 AM12/20/12
to bungeni...@googlegroups.com, say...@birzeit.edu, Ahmad Hammo
I saw that value of the id attribute is auto-generated .. how can I control it?

Ashok Hariharan

unread,
Jan 7, 2013, 2:55:40 AM1/7/13
to bungeni...@googlegroups.com, say...@birzeit.edu, Ahmad Hammo
On 20 December 2012 11:17, Samar Ayesh <smr....@gmail.com> wrote:
I saw that value of the id attribute is auto-generated .. how can I control it?


At the moment you cannot control it ... but I can make it support it that quite easily ... do you have a specific requirement ?

Ashok
 

--
You received this message because you are subscribed to the Google Groups "bungeni-editor" group.
To view this discussion on the web visit https://groups.google.com/d/msg/bungeni-editor/-/kJQmeDlnVMMJ.
To post to this group, send email to bungeni...@googlegroups.com.
To unsubscribe from this group, send email to bungeni-edito...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/bungeni-editor?hl=en.

Samar Ayesh

unread,
Jan 7, 2013, 4:37:31 PM1/7/13
to bungeni...@googlegroups.com
Ok , I will leave it auto-generated now .. but the lawyers may need specific requirements later
--
 ___________________________
 Samar Ayesh
Reply all
Reply to author
Forward
0 new messages