Skip to Content
author's profile photo Former Member
Former Member

How to implement HtmlEdit onInsertLink() and onInsertImage() in UICommand?

Im using EP 6 SP2 and Im trying to read an XML file and allow the user to edit HTML within one of the elements using the HtmlEdit control.

I want the user to be able to insert links to KM docs and to insert images, but I cant find any examples or seem to get any default handling to work?

Can anyone give me an example of how to implement the event handlers for these?

Im building the editor page as a ConfirmComponent within a class that extends AbstractCommand and implements the ISimpleExecution interface to implement a simple on step screenflow (https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/kmc/implementing flexible ui one-step-screenflow.article) rather than an a DynPage or JSpDynPage.

Im not even sure implementing event handlers is possible in a one step screenflow? Any ideas?

If not can I invoke a JspDynPage/PageProcessorComponent project from my AbstractCommand instead?

Help 😉

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jul 25, 2005 at 01:16 PM

    Hi Steve,

    I am not sure this is relevant for you, but maybe it could be helpful:

    java.util.ArrayList values = new ArrayList();
    Button b = new Button(proxy.createDispatchableID("onExecute", values));
    b.setOnClick("onWdfEvent");
    b.setJsObjectNeeded(true);
    b.setText("Edit");
    gl.addComponent(1, 2, b);
    

    this is used in e.g. HTMLCollectionRenderer to render the UI command:

    IUIBaseCommand baseCommand = UICommandFactory.getInstance().getCommandByAlias(uiname, getResourceContext());
    IUICommand command = (IUICommand)baseCommand;
    command.setProxy((AbstractProxyControl) proxy);
    command.setResource(res);
    command.setResourceContext(resCtx);
    java.util.ArrayList values = UICommandFactory.getInstance().createTargetValues(command);
    

    regards,

    dimitry

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Steve,

      This was only as a potential help, I don't know what exactly you want to achieve, however if you take a UI simple command and deploy it as well, e.g.

      import com.sapportals.portal.prt.component.IPortalComponentRequest;
      import com.sapportals.wcm.WcmException;
      import com.sapportals.wcm.rendering.uicommand.AbstractUICommand;
      import com.sapportals.wcm.rendering.uicommand.IUICommand;
      import com.sapportals.wcm.rendering.uicommand.LinkAttributes;
      import com.sapportals.wcm.repository.IResourceContext;
      import com.sapportals.wdf.ControllerDynPage;
      import com.sapportals.wdf.WdfEventDispatcher;
      import com.sapportals.wdf.WdfException;
      import com.sapportals.wdf.event.WdfEvent;
      import java.util.List;
      
      public class OpenEditor extends AbstractUICommand
      
      {
      
      	private List values;
      
      	public OpenEditor1()
      	{
      		values = null;
      	}
      
      	public String[] getTargetParameters()
      		throws WcmException
      	{
      		String result[] = new String[1];
      		result[0] = super.resource.getRID().getPath();
      		return result;
      	}
      
      	public String getLabel()
      	{
      		return "Open Editor";
      	}
      
      	public LinkAttributes getLinkAttributes()
      	{
      		String reference = "http://www.google.de";
      		return new LinkAttributes(reference, "_blank");
      	}
      
      
      	public String getTooltip()
      	{
      		return "";
      	}
      
      	public boolean isExecutable()
      	{
      		return true;
      	}
      
      	public WdfEvent execute()
      	{
      		return null;
      	}
      
      	public WdfEvent execute(ControllerDynPage dynpage, boolean pushStack)
      		throws WdfException
      	{
      		return null;
      	}
      
      
      	public IUICommand getNewInstance()
      	{
      		return initNewInstance(new OpenEditor1());
      	}
      
      	public void setTargetParameters(List values, IResourceContext context)
      		throws WcmException
      	{
      		this.values = values;
      		super.context = context;
      		super.resource = createResource((String)values.get(0));
      	}
      }
      

      then you can do something in

      public WdfEvent execute()
      

      method.

      regards,

      dimitry

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.