Custom component problem

I wrote a custom component:
Here is the code for the UIComponent:
package customcomponents;
import javax.faces.component.*;
import javax.faces.context.*;
import java.util.Vector;
import jsf.*;
public class UIEventsTable extends UIComponentBase {
     public String getFamily() {
          return "EventsTable";
     public void encodeEnd( FacesContext context ) throws java.io.IOException {
          Vector<Event> events = (Vector<Event>) this.getAttributes().get("events");
          ResponseWriter writer = context.getResponseWriter();
          writer.startElement("table" , this );
          for( int i = 0 ; i < events.size() ; ++i ) {
               writer.startElement("tr",this);
                    writer.startElement("td",this);
                         writer.write( events.elementAt(i).getEvent_description() );
                    writer.endElement("td");
               writer.endElement("tr");
          writer.endElement("table");
}This is the tag class
package customcomponents;
import javax.faces.webapp.*;
import javax.faces.component.*;
import java.util.*;
import jsf.*;
public class EventsTableTag extends UIComponentTag {
     Vector<Event> events = null;
     public String getRendererType() {
          return null;
     public String getComponentType() {
          return "EventsTable";
     public void release() {
          super.release();
          events = null;
     protected void setProperties( UIComponent component ){
          super.setProperties( component );
          if( events != null )
               component.getAttributes().put( "events" , events );
     public Vector<Event> getEvents() {
          return events;
     public void setEvents(Vector<Event> events) {
          this.events = events;
}Taglib descriptor:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
     <tlib-version>1.0</tlib-version>
    <jsp-version>1.2</jsp-version>
    <short-name>d</short-name>
     <uri>http://eventsTable.com/</uri>
    <tag>
         <name>EventsTable</name>
           <tag-class>customcomponents.EventsTableTag</tag-class>
           <body-content>JSP</body-content>
         <attribute>
              <name>events</name>
         </attribute>
         <attribute>
              <name>id</name>
         </attribute>
         <attribute>
               <name>rendered</name>
          </attribute>
          <attribute>
               <name>binding</name>
          </attribute>
    </tag>
</taglib>And finally how I invoke the tag
<d:EventsTable events="#{location.events}" />
...Now location.events is a java.util.Vector with the events. But when I use this tag I get following error message:
Servlet.service() for servlet Faces Servlet threw exception
org.apache.jasper.JasperException: Unable to convert string "#{location.events}" to class "java.util.Vector" for attribute "events": Property Editor not registered with the PropertyEditorManagerI do not understand why this doesn't work. Because in a "h:dataTable" I can tell the component to use an array as an input. Even more I don't know what a PropertyEditorManager is.
So how can I pass the vector object to this custom component?

I have tried with tomcat-6.0.14 and RI 1.2_06-b02-FCS
<?xml version="1.0" encoding="UTF-8"?>
<taglib xmlns="http://java.sun.com/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
   http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
   version="2.1">
   <tlib-version>1.1</tlib-version>
    <short-name>d</short-name>
     <uri>http://eventsTable.com/</uri>
    <tag>
         <name>EventsTable</name>
           <tag-class>customcomponents.EventsTableTag</tag-class>
       <attribute>
           <name>events</name>
         <deferred-value>
            <type>java.util.Vector</type>
         </deferred-value>        
      </attribute>
    </tag>
</taglib>
package customcomponents;
import javax.el.ValueExpression;
import javax.faces.webapp.*;
import javax.faces.component.*;
public class EventsTableTag extends UIComponentELTag {
     private ValueExpression events = null;
     public String getRendererType() {
          return null;
     public String getComponentType() {
          return "EventsTable";
     public void release() {
          super.release();
          events = null;
     protected void setProperties( UIComponent component ){
          super.setProperties( component );
          component.setValueExpression("events", events);
     public void setEvents(ValueExpression events){
          this.events = events;
}

Similar Messages

  • Custom Tag -- Custom Component problems with iframes

    I have a "project" component that originally iterated over a list of models and created/renderered the corresponding (and fairly complex) interactive UI components for those models. On the client-side, the output from these were then organized neatly into "tabs" via CSS ... all on one page. Since these UI Components are so hefty, when any iteraction was done on one of them, the whole page had to re-render and things got just plain slow. To get around this limitation, I decided to have my "project" component no longer create the UI components himself, but instead generate an IFRAME that points to a page that will generate a single component. This way, any iteraction will just cause that single IFRAME to refresh.
    Due to the fact that an IFRAME can only be populated by using the src attribute, I have created a page that contains a JSF View (<faces:view>) and inside is a single custom tag of mine (<mine:displayView>). Let's call this page singleDisplayView.jsf. I create iframes that point to singleDisplayView.jsf with different request params for each (singleDisplayView.jsf?modelName=Foo, singleDisplayView.jsf?modelName=Bar, etc.)
    The displayView tag has one attribute called requestQueryString and I use the tag like so:
    <t:displayView requestQueryString="<%=request.getQueryString()%>" />The displayView tag's class is DisplayViewTag. In DisplayViewTag::setProperties(UIComponent uiComponent) method, I get the model name out of the request map and set this property on the UIComponent.
    The problem is that I'm noticing that as the main page (that contains these frames) loads, setProperties() is only being called twice. After that, the components created by subsequent iframes just seem to be using the modelName from the second frame.
    Is there a syncronization issue I don't understand?
    Any ideas?
    Any help would be much appreciated.
    Thanks in advance,
    Mark

    On a possibly related note, I read this in an article of the JSF application lifecycle:
    In the first phase of the JSF lifecycle -- restore view -- a request comes
    through the FacesServlet controller. The controller examines the request and
    extracts the view ID, which is determined by the name of the JSP page.Could it be that the lifecycle is trying to reuse components from a single view, since all these iframes are pointing to the same page?

  • Problem with inputText in my custom component

    Hi, I have a custom dataTable component that I'm trying to get to work. It has to be a custom component because dataTable doesn't support rowspan, colspan, multi line headers, and a rendered attribute for rows. The problem is, that when I wrap the column tag inside my row tag then the method for the inputText tag never gets called in the UPDATE_MODEL_VALUES phase.
    I'm starting to think that JSF doesn't support 2 levels of tags between the inputText and dataTable. I'm hoping that someone can tell me what I have wrong with my components.
    Here is the JSP snippet.
    <cjsf:rptTable>
         <cjsf:data id="dataTable1" value="#{allAuthUser.tableRows}" var="myTableRow1">
              <cjsf:row>
                   <cjsf:col>
                        <h:inputText id="tableTestFld" value="#{myTableRow1.testFld}" size="5" maxlength="5"/>
                   </cjsf:col>
              </cjsf:row>
         </cjsf:data>
    </cjsf:rptTable>Here is what it renders. It looks to me like everything renders fine. So I'm guessing that there is something in a component that is causing JSF during the life cycle to not be able to process correctly.
    <table>
         <tbody>
              <tr>
                   <td><input id="tblmaintForm:body:dataTable1_0:tableTestFld" name="tblmaintForm:body:dataTable1_0:tableTestFld" type="text" value="" maxlength="5" size="5"/></td>
              </tr>
              <tr>
                   <td><input id="tblmaintForm:body:dataTable1_1:tableTestFld" name="tblmaintForm:body:dataTable1_1:tableTestFld" type="text" value="" maxlength="5" size="5"/></td>
              </tr>
              <tr>
                   <td><input id="tblmaintForm:body:dataTable1_2:tableTestFld" name="tblmaintForm:body:dataTable1_2:tableTestFld" type="text" value="" maxlength="5" size="5"/></td>
              </tr>
         </tbody>
    </table>Note: If I leave off the row tag it renders the same way except of course the <tr> and </tr> tags are missing. If I do this, then the backing method for the inputText tag is called and everything works fine. Why doesn't it work with the row tag in place?
    Here are the components:
    public class UIRptTable extends UIComponentBase {
         public UIRptTable() {
              setRendererType("tblmaint.rptTableRenderer");
         public String getFamily() {
              return "javax.faces.Output";
    public class UIRptTableData extends HtmlDataTable {
         public UIRptTableData() {
              setRendererType("tblmaint.rptTableDataRenderer");
         public String getFamily() {
              return "javax.faces.Data";
    public class UIRptTableRow extends UIOutput {
         public UIRptTableRow() {
              setRendererType("tblmaint.rptTableRowRenderer");
         public String getFamily() {
              return "javax.faces.Output";
    public class UIRptTableCol extends UIColumn {
         public UIRptTableCol() {
              setRendererType("tblmaint.rptTableColRenderer");
         public String getFamily() {
              return "javax.faces.Column";
    }Here is part of the faces-config file in case you need it.
    <!-- Components -->
    <component>
         <component-type>tblmaint.rptTable</component-type>
         <component-class>com.monsanto.ag_it.fieldops.aim.tblmaint.component.UIRptTable</component-class>
    </component>
    <component>
         <component-type>tblmaint.rptTableData</component-type>
         <component-class>com.monsanto.ag_it.fieldops.aim.tblmaint.component.UIRptTableData</component-class>
    </component>
    <component>
         <component-type>tblmaint.rptTableRow</component-type>
         <component-class>com.monsanto.ag_it.fieldops.aim.tblmaint.component.UIRptTableRow</component-class>
    </component>
    <component>
         <component-type>tblmaint.rptTableCol</component-type>
         <component-class>com.monsanto.ag_it.fieldops.aim.tblmaint.component.UIRptTableCol</component-class>
    </component>
    <!-- Render Kits -->
    <render-kit>
         <renderer>
              <component-family>javax.faces.Output</component-family>
              <renderer-type>tblmaint.rptTableRenderer</renderer-type>
              <renderer-class>com.monsanto.ag_it.fieldops.aim.tblmaint.renderer.RptTableRenderer</renderer-class>
         </renderer>
    </render-kit>
    <render-kit>
         <renderer>
              <component-family>javax.faces.Data</component-family>
              <renderer-type>tblmaint.rptTableDataRenderer</renderer-type>
              <renderer-class>com.monsanto.ag_it.fieldops.aim.tblmaint.renderer.RptTableDataRenderer</renderer-class>
         </renderer>
    </render-kit>
    <render-kit>
         <renderer>
              <component-family>javax.faces.Output</component-family>
              <renderer-type>tblmaint.rptTableRowRenderer</renderer-type>
              <renderer-class>com.monsanto.ag_it.fieldops.aim.tblmaint.renderer.RptTableRowRenderer</renderer-class>
         </renderer>
    </render-kit>
    <render-kit>
         <renderer>
              <component-family>javax.faces.Column</component-family>
              <renderer-type>tblmaint.rptTableColRenderer</renderer-type>
              <renderer-class>com.monsanto.ag_it.fieldops.aim.tblmaint.renderer.RptTableColRenderer</renderer-class>
         </renderer>
    </render-kit>I sure hope that someone can help me out. Please let me know if you need any additional information.
    Thanks,
    Ray

    Hi, Ray!
    1) I was trying to put a button in the column header (for sorting) and I couldn't get that to work. That involved the >colhdr tag. I got that to work but I don't remember the fix. I'll look it up and reply back with that when I can.Dealing the first part of your trouble, you need NOT a custom component.
    I have looked through the implementation of RepeaterRenderer, as you advised me, and found that the multi-header possibility is included in the implementation of dataTable control.
    The code below is the part of source of repeater.jsp with only change:
    <d:data_repeater> &#61664; <h:dataTable>
    And it works fine.
    <h:dataTable id="table"
    binding="#{RepeaterBean.data}"
         rows="5"
    value="#{RepeaterBean.customers}"
    var="customer">
    <f:facet name="header">
    <h:outputText value="Customer List"/>               <!� First Header row -- >
    </f:facet>
    <h:column>
    <%-- Visible checkbox for selection --%>
    <h:selectBooleanCheckbox
    id="checked"
    binding="#{RepeaterBean.checked}"/>
    <%-- Invisible checkbox for "created" flag --%>
    <h:selectBooleanCheckbox
    id="created"
    binding="#{RepeaterBean.created}"
    rendered="false"/>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="Account Id"/>               <!�Second Header row -- >
    </f:facet>
    <h:inputText id="accountId"
    binding="#{RepeaterBean.accountId}"
    required="true"
    size="6"
    value="#{customer.accountId}">
    </h:inputText>
    <h:message for="accountId"/>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="Customer Name"/>               <!�Second Header row -- >
    </f:facet>
    <h:inputText id="name"
    required="true"
    size="50"
    value="#{customer.name}">
    </h:inputText>
    <h:message for="name"/>
    </h:column>
    <h:column>
    <f:facet name="header">                    <!�Second Header row -- >
    <h:outputText value="Symbol"/>
    </f:facet>
    <h:inputText id="symbol"
    required="true"
    size="6"
    value="#{customer.symbol}">
    <f:validateLength
    maximum="6"
    minimum="2"/>
    </h:inputText>
    <h:message for="symbol"/>
    </h:column>
    <h:column>
    <f:facet name="header">                    <!�Second Header row -- >
    <h:outputText value="Total Sales"/>
    </f:facet>
    <h:outputText id="totalSales"
    value="#{customer.totalSales}">
    <f:convertNumber
    type="currency"/>
    </h:outputText>
    </h:column>
    <h:column>
    <f:facet name="header">                    <!�Second Header row -- >
    <h:outputText value="Commands"/>
    </f:facet>
    <h:commandButton id="press"
    action="#{RepeaterBean.press}"
    immediate="true"
    value="#{RepeaterBean.pressLabel}"
    type="SUBMIT"/>
    <h:commandLink id="click"
    action="#{RepeaterBean.click}"
    immediate="true">
    <h:outputText
    value="Click"/>
    </h:commandLink>
    </h:column>
    </h:dataTable>
    You may have a look at HTML source to prove that dataTable is already what you need:
    <table id="myform:table">
    <thead>
    <tr><th colspan="6" scope="colgroup">Customer List</th></tr>
    <tr>
    <th scope="col"></th>
    <th scope="col">Account Id</th>
    <th scope="col">Customer Name</th>
    <th scope="col">Symbol</th>
    <th scope="col">Total Sales</th>
    <th scope="col">Commands</th>
    </tr>
    </thead>
    <tbody>
    2.) The second trouble is still unsettled as previously. Right now I have different task at my job, and I can�t continue investigation of this problem.
    But when you find smth., please let me know. I�ll be very grateful.
    Regards,
    Oleksa Stelmakh

  • Custom component and custom event problem

    hello , i have a strange problem since one week , is that i can't handle the events becoming from my custom component , here is my code :
    Event Class :
    package events
         import flash.events.Event;
         public class Ev extends Event
              public static const UPDATE:String="update";
              public var data:String;
              public function Ev(type:String,data:String)
                   super(type);
                   this.data=data;
              override public function clone():Event
                   return new Ev(type,data);
    MXML component :
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx">
         <fx:Metadata>
              [Event(name="onMenuChange",type="events.Ev")]
         </fx:Metadata>
         <fx:Script>
              <![CDATA[
                   import events.Ev;
                   import mx.events.IndexChangedEvent;
                   protected function accordion1_changeHandler(event:IndexChangedEvent):void
                        dispatchEvent(new Ev(Ev.UPDATE,event.newIndex.toString()));
              ]]>
         </fx:Script>
         <fx:Declarations>
              <!-- Placer ici les éléments non visuels (services et objets de valeur, par exemple). -->
         </fx:Declarations>
         <mx:Accordion width="200" height="200" change="accordion1_changeHandler(event)">
              <s:NavigatorContent label="Menu 1" width="100%" height="100%">
              </s:NavigatorContent>
              <s:NavigatorContent label="Menu 2" width="100%" height="100%">
              </s:NavigatorContent>
              <s:NavigatorContent label="Menu 3" width="100%" height="100%">
              </s:NavigatorContent>
         </mx:Accordion>
    </mx:VBox>
    the main container :
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:s="library://ns.adobe.com/flex/spark"
                      xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:local="*">
         <fx:Script>
              <![CDATA[
                   import events.Ev;
                   import mx.controls.Alert;
                   protected function comp1_onMenuChangeHandler(event:Ev):void
                        Alert.show(event.data,"notice");
              ]]>
         </fx:Script>
         <local:Comp onMenuChange="comp1_onMenuChangeHandler(event)"/>
    </s:Application>
    any help will be welcome !

    hi,
    Not sure why your custom event is not working, I tend not to worry about 'custom' events unless I need to transfer a lot of information.
    Here is a way to 'simplify' event management.
    I just declare a new event in the meta data and then send it to notify that a change has been made. Although the parent can find the index value easily enough I also use two-way bind the navigators index so that it is directly available for the application to manipulate/read .
    http://gumbo.flashhub.net/events/  source included
    David.

  • Problem custom component with children in RestoreView phase

    Hi there!
    I've got a problem with a custom component that I am writing. It consists of several UISelectOne and UIInputText components. Depending on the value selected in the UISelectOne components, the UISelectOne and UIInputText components may change. Therefore I attached a ValueChangeListener to the UISelectOne components. So far, so good.
    The problem is, when the event is triggered, I get an ArrayIndexOutOfBoundsException. It took me a while to track it down. The problem seems to be, that during the Restore View phase, the StateManager's restoreComponentTreeStructure method first creates the component again and later restores its tree structure.
    During creation of the component, its constructor is called in which I add the children to the component. While restoring the tree structure, the StateManager again adds the children to the component. So the list of my component's children contains each child twice.
    The exception is due to the fact that in the saved state array only the original component's states are saved (which is perfectly right). So while restoring state and iterating through the component's children, the exception is thrown for the first child which is twice in the list (which is also perfectly right).
    I hope this description is not too confusing. My question is, if anyone can give me a hint what I am doing wrong here? How can I avoid the component being initialized again? Or where should I add the children to the component?
    Thanks for any advices!

    Hi again,
    I've perpared a minimal example (which in fact is quite big, but considering it's a custom tag it's probably not possible to make it smaller):
    The UITest class (as you can see I add the child component in the constructor):
    package test;
    import java.io.IOException;
    import java.util.*;
    import java.util.ArrayList;
    import java.util.List;
    import javax.faces.application.Application;
    import javax.faces.component.*;
    import javax.faces.context.FacesContext;
    import javax.faces.context.ResponseWriter;
    import javax.faces.event.ValueChangeEvent;
    import javax.faces.model.SelectItem;
    public class UITest extends UIInput {
      public static final String COMPONENT_TYPE = "Test";
      public static final String COMPONENT_FAMILY = "Test";
      private UISelectOne selectOne;
      private UISelectItems selectItems;
      public UITest(){
        Application application = FacesContext.getCurrentInstance().getApplication();
        selectItems = (UISelectItems)application.createComponent(UISelectItems.COMPONENT_TYPE);
        List items = new ArrayList();
        items.add(new SelectItem("One", "one"));
        items.add(new SelectItem("Two", "two"));
        selectItems.setValue(items);
        selectOne = (UISelectOne)application.createComponent(UISelectOne.COMPONENT_TYPE);
        selectOne.getAttributes().put("onchange", "submit()");
        Class[] params = {ValueChangeEvent.class};
        selectOne.setValueChangeListener(application.createMethodBinding("#{TestBean.valueChange}", params));
        selectOne.getChildren().add(selectItems);
        this.getChildren().add(selectOne);
      public void encodeChildren(FacesContext context) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        Iterator children = getChildren().iterator();
        while(children.hasNext()){
          UIComponent child = (UIComponent)children.next();
          if(child.isRendered()){
            child.encodeBegin(context);
            if(child.getRendersChildren()){
              child.encodeChildren(context);
            child.encodeEnd(context);
      public boolean getRendersChildren(){
        return true;
    }The component tag class:
    package test;
    import javax.faces.webapp.UIComponentTag;
    public class TestTag extends UIComponentTag {
      public String getComponentType() {    return "Test";  }
      public String getRendererType() {    return null;  }
    }Tag registration:
      <tag>
        <name>test</name>
        <tag-class>test.TestTag</tag-class>
      </tag>The backing bean:
    package test;
    import javax.faces.event.ValueChangeEvent;
    public class TestBean {
      private String currentValue;
      public void valueChange(ValueChangeEvent event) {
        System.err.println(event.getNewValue());
      public String getCurrentValue() {
        return currentValue;
      public void setCurrentValue(String currentValue) {
        this.currentValue = currentValue;
    }And finally the definition in the faces-config:
       <component>
          <component-type>Test</component-type>
          <component-class>test.UITest</component-class>
       </component>
       <managed-bean>
        <managed-bean-name>TestBean</managed-bean-name>
        <managed-bean-class>test.TestBean</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
       </managed-bean>When included in the JSP and then clicked on the combobox, I get an ArrayIndexOutOfBoundsException.
    Can anyone give me a hint what the problem might be?
    Thanks in advance!

  • Problem with attributes in custom component

    Hi All,
    I am creating a simple jsf PanelGrid custom component....in that component I am adding two new attributes....
    when I use that tag in my jsf application it is rendering fine in the client side....but the parent class that is PanelGrid component's attributes are not inheriting to my custom panelgrid....
    can any one tell me how can I use the attributes of the super class PanelGrid??
    Thanks...

    Have you configured the attributes in the tag library descriptor?

  • Custom Component or Other solution to this problem...

    Hello,
    In my pages I have a wizard type menu consisting of:
    [ prev   curr-title    next ]
    The code to build this menu looks like so:
    <h:panelGrid
         id="top_flow_navigation"
         columns="3"
         styleClass="wizardNavTable"
         columnClasses="wizardNavColumn_Prev,wizardNavColumn_Curr,wizardNavColumn_Next">
         <h:commandLink
              action="back"
              accesskey="n">
              <h:outputText value="#{messages['flow.user.other.main.heading']}"/>
         </h:commandLink>               
         <h:outputText value="#{messages['flow.user.personal.main.heading']}"/>
         <h:commandLink
              action="submit"
              accesskey="n">
              <h:outputText value="#{messages['flow.user.security.main.heading']}"/>
         </h:commandLink>     
         <h:outputText value="#{messages['global.button.prev']}"/>                    
         <h:outputText/>                                             
         <h:outputText value="#{messages['global.button.next']}"/>
    </h:panelGrid>This code is currently repeated at the top and bottom of each page, and also on all the pages involved in the wizard.
    The only difference in the code on each page is the messages string.
    What I would like to know is ...:
    (1) how best to solve not repeating myself at the top and bottom of each page.
    JSP include would solve this, is there a JSF way?
    (2) ...it possible to wrap this code in a jsp tag and pass in the messages binding string as a parameter...I have tried this before but sadly passing #{...} into a tag throws up errors.
    Is wrapping this all in a custom JSF component the solution?
    Thanks.
    JC.

    Create a custom component. You may define your own attributes to pass the parameters.
    For example:<custom:component messages="blah" />

  • Unable to Edit the View in Custom Component

    Hi Experts,
    Please help me to resolve this issue !
    I am unable to lock the BOL Entity in my custom component using BTAdminH. I have written the below code in the Edit event Handler for Edit Button. The lr_entity->lock( ) condition statement is getting false and it is skipping the "set_view_editable( me )." code statement. Why??
    This is code excerpt that I have taken from edit button of the BP_HEAD/AccountViewSet and altered to my component/View
    DATA: lr_entity     TYPE REF TO cl_crm_bol_entity,
            lr_controller TYPE REF TO cl_ZVKH8_bspwdcomponent_impl.
      TRY.
          lr_controller ?= me->comp_controller.
          lr_entity ?= lr_controller->typed_context->btadminh->collection_wrapper->get_current( ).
    IF lr_entity IS BOUND.
      IF lr_entity->IS_LOCKED EQ abap_false.
        IF le_entity->IS_CHANGEABLE EQ abap_true.
           IF lr_entity->lock( ) EQ abap_true.
            me->view_group_context->set_view_editable( me ).
           ENDIF.
        ENDIF.
      ENDIF.
    ENDIF.
    and when I directly executed the below code in the Edit event Handler for Edit Button I am receiving the dereferencing NULL value exception. Why in my custom component in many places this happening??
      me->view_group_context->set_view_editable( me ).
    Exception Details
    CX_SY_REF_IS_INITIAL - Dereferencing of the NULL reference
    Method: ZL_ZVKH8_DETAILSEF_IMPL=>EH_ONBACK
    Thanks,
    Bujji

    Hi Summit & NishaNC,
    Thanks for your responses !
    As suggested, I have debugged the code for ->lock( ) method and there are exceptions raised from some methods.
    Method GET_LOCK () -> Method GET_ROOT () ->Method GET_PARENT ()
    At GET_ROOT( ) method i have received an exception
    "Root entity BTAdminH could not be determined" and one more "Entity BTAdminH could not be locked"
    Later when I have checked in MODEL Browser, I found that the BOL object "BTAdminH" for my view is an Access object and not the Root Object.
    Hence, I have a question? Does the locking can be done only for ROOT Objects?
    If this is TRUE then I think this is the major problem with my custom component where even the cross component navigation is also not happening and in many places I am receiving "Dereferencing NULL Value" information.
    Also I have gone through some of the Threads and one information that I found from Sumit Mittal
    1. An access object is an independent entity, has primary keys of its own.
    2. A root object is a special access object that is at the top of the hierarchy based on business rules.
    3. A dependent object's primary keys are supplied by access objects and it's lifetime is bound to them. If the parent object is destroyed, the dependent object is also destroyed.
    4. Search objects are query objects useful for querying root objects
    5. Search result objects - Search objects return the results in the form of a result object together with a relation pointing to the root object.
    6. View objects - ?
    7. Dynamic search objects - Used in advanced search, supports ranges and operators
    Could you please specify in which scenarios we have to go for Access Objects and Root Objects
    Thanks,
    Bujji

  • How do you reference a valueObject located in main to a custom component created in Catalyst?

    Hello,
    I have been working with the Catalyst Beta 2 / Flash Builder beta trying to create a photogallery and have hit a little bit of a snag, try as I might I can't seem to find the answer anywhere. I am still new to Flex so please excuse me if this is a basic question, I have been trying to understand more about Flex to make my designs in Catalyst better.
    I found this video on Adobe TV: http://tv.adobe.com/watch/rich-internet-applications-101/ria-stepbystep-16-binding-a-data- service-to-flash-builder-components/
    It's wonderful and I have the datalist I created in Catalyst working with the XML file I generated but I designed my little photogallery a bit diffrent, I created a Custom Component in Catalyst so that when you click an item on the DataList it pop's up a little screen with a larger photo in on it, rather then having an image in the main application. Now my problem seems to be that I can't refrence the valueObject I created with the wizard as it's in my Main.mxml file, is there a way to refrence it from my Custom Component so the larger image will display? Is there a way to let the component know which item on the dataList in the main application is selected and display the correct image?
    I should also say I really enjoy working with the Beta for both Flash Builder / Catalyst, thanks for the hard work!
    Thanks for the help,
    Chris

    I am afraid you cannot bind to static properties in Windows Store Apps. It is simply not supported.
    You could create a proxy class that exposes the static command property and bind to this property of an instance of the proxy object:
    http://stackoverflow.com/questions/14186175/bind-to-a-static-field-in-windows-8-xaml
    http://stackoverflow.com/questions/4708711/how-can-i-use-the-xstatic-extension-for-phone7-silverlight-apps
    You will of course have to create an instance of the proxy object. There is no way around this.
    Please remember to mark helpful posts as answer to close your threads and then start a new thread if you have a new question.

  • Advice on creating a tricky custom component

    Hi,
    I'm working on creating a custom component which displays a image at the top of the canvas, and loops through a passed array collection, displaying each row of the array collection in a item renderer. So the component should look like this (see attached image).
    As you can see from this image the header is a image itself, this will differ every instance of the panel, there should be 3 of these panels on the page. Then each row of data is a item renderer displaying the data provided from a array collection of value object. If there are 4 items in this array collection then the panel should show 4 rows, if there are 2 row in the array then the panel will display 2 rows. Also the height of the panel will dynamically change depending on the number of rows to show.
    I was thinking of extending a Canvas component, and then passing in the image URL and trying to load and draw the image dynamically, then I was thinking of using the Drawing API to create the rectangle shape using the drawRoundRectComplex() of the graphics class.
    The problems I see with this is that I don't think the drawn rectangle shape can re-draw itself to show the change in height when more or less row of data need to be be displayed.
    Another option I have been thinking about is extending the Panel class to create my component, this may be better for handling the height resizing, but I'm not sure it can support the look of this component (the header image and the three rounded corners).
    Could anyone give me some advice on what would be the better option for creating this component.
    Thanks
    Stephen

  • 11.1.2: Declarative-component problem!

    Hi!
    We're just evaluating 11.1.2. I converted some declarative components to 11.1.2/Facelets style, but I am running into problems.
    As a test, I created some new components from scratch, confirming the issue.
    I create a declarative component and choose "Facelets" and choose "Use custom component class".
    JDeveloper then creates an entry in the jsf:
            <afc:component>
                <afc:display-name>testComponent</afc:display-name>
                <afc:component-class>component.TestComponent</afc:component-class>
                <afc:facet>
    ....After deployment, I just get an error. Facelets is reporting that there is no tag for "component-class", and examining component.taglib.xml in adf-richclient-impl-11.jar shows: Facelets is right! There is none!
    Now, I cannot just remove the component-class entry. If I do that, then deployment works, but then JDeveloper creates during compilation a wrong "TestComponentComponent" class (which should extend TestComponent but doesn't!).
    It just extends RichDeclarativeComponent, just like my original TestComponent class. All code in TestComponent is not available at runtime.
    RichDeclarativeComponent
       |
       |
    TestComponent    <---- This class is now for the birdsand
    RichDeclarativeComponent
       |
       |
    TestComponentComponent      <----- That class is used by the handlerIf I leave the component-class entry in, then - as expected - I get the correct hierarchy:
    RichDeclarativeComponent
       |
       |
    TestComponent
       |
       |
    TestComponentComponentbut the component doesn't run.
    So, now what? This cannot be the way it's supposed to work, can it. Manually edit the "component-class" stuff out of the jsf in the jar after deployment!?
    Edit: Created SR 3-3856944401: Facelets-based declarative component with custom component class not working
    Sascha
    Edited by: Sascha Herrmann on Jun 17, 2011 6:41 PM

    This is bug 12717940.
    Sascha

  • I am not able to create a JMS connection from a custom component in UCM

    I am trying to create a custom component which makes a JMS connection and inserts messages in JMS Queue.
    THe JMS server is hosted on Weblogic Application Server.
    When the code runs I am getting the factory object and the queue object.
    But when I try to get a connection it throws an error as pasted below.
    WHen I googled the same error It has shown a simliar problem in TOmcat in sun thread
    It said two jar files xerces.jar and xml-apis.jar are obsolete.
    I replaced with the new version.
    still the same problem occurred
    Please help
    Pasting the code and exception here
    Code __________________________________________
    import java.util.Date;
    import java.util.Hashtable;
    import javax.jms.*;
    import javax.naming.*;
    import weblogic.jms.client.WLConnectionImpl;
    import weblogic.jms.extensions.*;
    import javax.rmi.PortableRemoteObject;
    public class SimpleProducer {
    public static void drive() {
    final int NUM_MSGS;
         NUM_MSGS = 93;
    Context jndiContext = null;
    Hashtable<String, String> ht;
              ht = new Hashtable<String, String>();
              ht.put(Context.INITIAL_CONTEXT_FACTORY,
                        "weblogic.jndi.WLInitialContextFactory");
              ht.put(Context.PROVIDER_URL, "t3://punitp52975d:7001");
    try {
         jndiContext = new InitialContext(ht);
    } catch (NamingException e) {
    System.out.println("Could not create JNDI API context: " +
    e.toString());
    System.exit(1);
    ConnectionFactory connectionFactory = null;
    Destination dest = null;
    try {
                   Object home = jndiContext.lookup("CNFT"); // where iiopTestDS is jndi name for my DataSource.
    connectionFactory =(ConnectionFactory)PortableRemoteObject.narrow(home , ConnectionFactory.class);
         Object home1 = jndiContext.lookup("QUEUE2"); // where iiopTestDS is jndi name for my DataSource.
    dest =(Destination)PortableRemoteObject.narrow(home1 , Destination.class);
         /*connectionFactory = (ConnectionFactory) jndiContext.lookup(
    "CNFT");
    dest = (Destination) jndiContext.lookup("QUEUE2");
    System.out.println("connectionFactory,dest "+connectionFactory+dest);*/
    } catch (Exception e) {
    System.out.println("JNDI API lookup failed: " + e.toString());
    e.printStackTrace();
    System.exit(1);
    //WLConnectionImpl connection = null;
    WLConnection connection = null;
    WLMessageProducer producer = null;
    try {
                   System.out.println("Getting Connection "+(WLConnection) connectionFactory.createConnection());
    //connection = (WLConnection) connectionFactory.createConnection();
                   System.out.println("Connection created");
    WLSession session =
    (WLSession) connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
    producer = (WLMessageProducer) session.createProducer(dest);
    WLMessage message = (WLMessage) session.createTextMessage();
    //TextMessage message = session.createTextMessage();
    for (int i = 91; i < NUM_MSGS; i++) {
    ((TextMessage) message).setText("This is message " + (i + 1));
    Long l = new Date().getTime();
    message.setLongProperty("ReleasedDate",l );
    System.out.println("Sending message: " + ((TextMessage) message).getText());
    producer.send(message);
    producer.send(session.createMessage());
    } catch (Exception e) {
    System.out.println("Exception occurred: " + e.toString());
    } catch (Throwable et) {
    System.out.println("Exception occurred: " + et.toString());
    et.printStackTrace();
    finally {
    if (connection != null) {
    try {
    connection.close();
    } catch (Exception e) {
                             System.out.println("*************Instantiating Producer***************");
    Exception_________________________________________________________________
    Exception occurred: java.lang.NoSuchMethodError: javax.xml.parsers.SAXParserFactory.getSchema()Ljavax/xml/validation/Schema;
    java.lang.NoSuchMethodError: javax.xml.parsers.SAXParserFactory.getSchema()Ljavax/xml/validation/Schema;
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.<init>(SAXParserImpl.java:124)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl.newSAXParserImpl(SAXParserFactoryImpl.java:115)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl.setFeature(SAXParserFactoryImpl.java:143)
    at weblogic.xml.jaxp.WebLogicSAXParserFactory.<init>(WebLogicSAXParserFactory.java:62)
    at weblogic.rmi.internal.wls.WLSRMIEnvironment.getSAXParser(WLSRMIEnvironment.java:136)
    at weblogic.rmi.internal.DescriptorManager.getDescriptorAsMap(DescriptorManager.java:170)
    at weblogic.rmi.internal.DescriptorManager.getDescriptorAsMap(DescriptorManager.java:159)
    at weblogic.rmi.internal.DescriptorManager.createRuntimeDescriptor(DescriptorManager.java:104)
    at weblogic.rmi.internal.DescriptorManager.getBasicRuntimeDescriptor(DescriptorManager.java:85)
    at weblogic.rmi.internal.DescriptorManager.getDescriptor(DescriptorManager.java:51)
    at weblogic.rmi.internal.DescriptorManager.getDescriptor(DescriptorManager.java:37)
    at weblogic.rmi.internal.OIDManager.makeServerReference(OIDManager.java:194)
    at weblogic.rmi.internal.OIDManager.getReplacement(OIDManager.java:175)
    at weblogic.rmi.utils.io.RemoteObjectReplacer.replaceRemote(RemoteObjectReplacer.java:120)
    at weblogic.rmi.utils.io.RemoteObjectReplacer.replaceObject(RemoteObjectReplacer.java:103)
    at weblogic.rmi.extensions.server.ServerHelper.exportObject(ServerHelper.java:223)
    at weblogic.rmi.internal.OIDManager.initializeDGCServer(OIDManager.java:231)
    at weblogic.rmi.internal.OIDManager.getReplacement(OIDManager.java:144)
    at weblogic.rmi.utils.io.RemoteObjectReplacer.replaceRemote(RemoteObjectReplacer.java:120)
    at weblogic.rmi.utils.io.RemoteObjectReplacer.replaceObject(RemoteObjectReplacer.java:103)
    at weblogic.rmi.extensions.server.ServerHelper.exportObject(ServerHelper.java:223)
    at weblogic.corba.server.naming.ReferenceHelperImpl.exportObject(ReferenceHelperImpl.java:233)
    at weblogic.rmi.extensions.PortableRemoteObject.exportObject(PortableRemoteObject.java:34)
    at weblogic.messaging.dispatcher.DispatcherImpl.export(DispatcherImpl.java:85)

    This is probably related to this other issue http://www.adobeforums.com/webx/.59b7fbab/0.
    Jasmin

  • Custom component not working properly

    Hi all - I am trying to create a custom component. I have followed the suggested MVC architecture, and created the following classes:
    1. SuperLineModel (the MODEL)
    2. SuperLine (the actual component,e.g. the CONTROLLER)
    3. BasicSuperLineUI (the UI Delegate class, e.g. the VIEW)
    4. SuperLineUI (an abstract type class for my UI Delegate)
    I also have a fifth class that draws a frame and panel, and then adds the custom component to the panel. In the main method of this class, I
    register the UI delegate like this:
    UIManager.put(BasicSuperLineUI.UI_CLASS_ID, "com.volant.mapit.view.BasicSuperLineUI");Everything compiles without any problems, but the custom component is never painted for some reason. In fact, I added a print line to the UI delegates paint method just to see if it was ever called, and it wasn't. I know I'm missing something here, and it's probably something small. I'm hoping some of you Swing gurus can take a look at my code below and point out the problem for me.
    I really appreciate any help you can give me. Thanks.
    The classes are listed below:
    // SuperLineModel
    import javax.swing.*;
    import javax.swing.event.*;
    public class SuperLineModel
      private double sourceXCoord = 0;
      private double sourceYCoord = 0;
      private double targetXCoord = 0;
      private double targetYCoord = 0;
      private EventListenerList listenerList = new EventListenerList();
      public SuperLineModel()
      public SuperLineModel(double sourceXCoord, double sourceYCoord,
                           double targetXCoord, double targetYCoord)
        this.sourceXCoord = sourceXCoord;
        this.sourceYCoord = sourceYCoord;
        this.targetXCoord = targetXCoord;
        this.targetYCoord = targetYCoord;
      public void setSourceXCoord(double x)
        this.sourceXCoord = x;
        return;
      public void setSourceYCoord(double y)
        this.sourceYCoord = y;
        return;
      public void setTargetXCoord(double x)
        this.targetXCoord = x;
        return;
      public void setTargetYCoord(double y)
        this.targetYCoord = y;
        return;
      public double getSourceXCoord()
        return this.sourceXCoord;
      public double getSourceYCoord()
        return this.sourceYCoord;
      public double getTargetXCoord()
        return this.targetXCoord;
      public double getTargetYCoord()
        return this.targetYCoord;
      public void addChangeListener(ChangeListener cl)
        listenerList.add(ChangeListener.class, cl);
      public void removeChangeListener(ChangeListener cl)
        listenerList.remove(ChangeListener.class, cl);
    // SuperLine
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import com.volant.mapit.view.*;
    import com.volant.mapit.model.*;
    public class SuperLine extends JComponent implements ChangeListener
      private SuperLineModel model;
      public SuperLine()
        init(new SuperLineModel());
      public SuperLine(SuperLineModel model)
        init(model);
      public void init(SuperLineModel model)
        setModel(model);
        setMinimumSize(new Dimension(50, 50));
        setPreferredSize(new Dimension(50,50));
        updateUI();
      public void setUI(BasicSuperLineUI ui)
        super.setUI(ui);
      public BasicSuperLineUI getUI()
        return (BasicSuperLineUI)ui;
      public void updateUI()
        setUI((BasicSuperLineUI)UIManager.getUI(this));
        invalidate();
      public String getUIClassID()
        return SuperLineUI.UI_CLASS_ID;
      public SuperLineModel getModel()
        return model;
      public void setModel(SuperLineModel model)
        SuperLineModel oldModel = model;
        if(oldModel != null)
          oldModel.removeChangeListener(this);
        if(model == null)
          model = new SuperLineModel();
        else
          model.addChangeListener(this);
        firePropertyChange("model", oldModel, model);
      public void stateChanged(ChangeEvent evt)
        repaint();
    // BasicSuperLineUI
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.plaf.*;
    import com.volant.mapit.control.*;
    public class BasicSuperLineUI extends SuperLineUI
      public static ComponentUI createUI(JComponent c)
        return new BasicSuperLineUI();
      public void installUI(JComponent c)
        SuperLine sl = (SuperLine)c;
      public void uninstallUI(JComponent c)
        SuperLine sl = (SuperLine)c;
      // This method is never called and I don't know why!!!
      public void paint(Graphics g, JComponent c)
        super.paint(g, c);
        System.out.println("test2");
        g.fillRect(0, 0, 200, 400);
    // SuperLineUI
    import javax.swing.plaf.*;
    import com.volant.mapit.control.*;
    public abstract class SuperLineUI extends ComponentUI
      public static final String UI_CLASS_ID = "SuperLineUI";

    A quick glance at the code and it looks ok with the exception of the following which I don't understand what you're trying to do:
      public void installUI(JComponent c)  {
        SuperLine sl = (SuperLine)c;
      public void uninstallUI(JComponent c)  {
        SuperLine sl = (SuperLine)c;
      }Here are my comments:
    1) I expect Superline sl to be a global variable for use elsewhere in your program.
    2) I have no idea what your uninstallUI does.
    This is what I would do:
      SuperLine sl;
      public void installUI(JComponent c)  {
        sl = (SuperLine)c;
      public void uninstallUI(JComponent c)  {
      }Finally, I am assuming that the changelistener will trigger a repaint which in turn will call your paint method, right?
    ;o)
    V.V.

  • How can I make a custom component focusable?

    Hi all,
    I'm using a custom made component that consists of a JLabel
    and a JTextField. I want to make this component focusable,
    and when it's in focus I want the JTextField to have the
    focus so that the user can start typing immediately.
    I've looked at the java tutorial
    (http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html#focusable).
    When my component gets the focus I request the focus to the
    JTextField. The problem is: whenever i check if my custom
    component has the focus, it hasn't because JTextField has it
    (the focus, i mean :-) ) Which isn't strange i think, but
    how can i solve this problem?

    I want to make this component focusable, and when it's in focus I want the JTextField to have the focus
    The problem is: whenever i check if my custom component has the focus, it hasn't because JTextField has it (the focus, i mean :-) So whats the problem the textField has focus as desired.
    You don't need to make the containing panel focusable in order for the text field to receive focus. The FocusManager is smart enough to place focus on the first focusable component contained in the panel. If you make the panel focusable then you will need to use the tab key twice, once to move focus to the panel and a second time to move focus to the text field.

  • Error when installing a Custom Component

    Hi there,
    I wrote a custom component and built the according jar-file. The next step was to import the jar-file into the workbench.
    When I tried to do so the following error occurred (workbench .log file):
    !ENTRY com.adobe.DSC_Admin_UI 4 4 2008-01-15 16:05:43.418
    !MESSAGE install of C:\tmp\adobe-components\adobe-component.jar failed
    !STACK 0
    ALC-DSC-000-000: com.adobe.idp.dsc.DSCRuntimeException: Internal error.
    Caused by: java.io.FileNotFoundException: C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ArchiveStore\306\at\integrata\livecycle\component\Boot strapImpl.class (The system cannot find the path specified)
    Caused by: java.io.FileNotFoundException: C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ArchiveStore\306\at\integrata\livecycle\component\Boot strapImpl.class (The system cannot find the path specified)
    The problem is, that the workbench is not running on the same computer as the ES server. When I extract the jar-file manually into the considered directory on the server everything works fine.
    Is this a bug or even not possible to import components from a remote workbench?
    kind regards
    Michael

    Hy all,
    I have been having the same problem.
    I think the cause with me is that I added libraries my component needs manually into the jar-file of my component and sometimes I added the component.xml file manually into the component-jar. I use 7Zip for this but every I did that I could not get the component to install correctly, unless I unpacked it manually in the temp-dir.
    I believe this is happens because when I manually place files in the jar file with a tool like 7Zip they are automatically being compressed and the jar-file of a component must not be compressed.
    So therefore I imported everything correctly in my Eclipse-project and now when I Export my component to a jar-file, everything is included and I don't have to place files manually into the jar-file of my component.
    When I install a component created like that I don't have any problems.
    Hope this helps for you to.
    Regards,
    RonnyR

Maybe you are looking for