Properly binding an object to a custom component.

I am apparently not doing this. What am I missing to properly
bind an
object from a repeater looping over an array of object to the
custom
component called in the repeater?
<mx:Repeater
id="dayCells"
dataProvider="{days}"
startingIndex="{weekRows.currentItem}"
count="7">
<mx:GridItem
width="14%"
borderColor="black"
borderThickness="1"
borderStyle="solid">
<mx:Label
text="{dayCells.currentItem.formatedDate}" />
<ian:dayFormat2
drawData="{dayCells.currentItem as drawDay}"
test="{dayCells.currentItem.formatedDate}" />
</mx:GridItem>
</mx:Repeater>
{days} is an array of drawDate.as objects returned with a
remoteObject.
I can correctly bind properties of these drawDate objects in
the
lable and the test property of the dayFormat2
customComponent. But I
can NOT correctly bind the entire object over to dayFormat2.
What am I
missing?
My current version of dayFormat2.mxml, I have tried several
alternatives
for this file.
?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="
http://www.adobe.com/2006/mxml"
width="100%">
<mx:Script>
<![CDATA[
import drawDay;
//Define public variables
[Bindable]
public var drawData:drawDay;
[Bindable]
public var test:String;
]]>
</mx:Script>
<mx:DateFormatter id="dayNum" formatString="DD" />
<mx:HBox
backgroundColor="0x002649"
width="100%"
horizontalAlign="right">
<mx:Label
text="{test}"
color="white" />
<mx:HBox
backgroundColor="0xAF1E2D"
horizontalAlign="center">
<mx:Label
text="{dayNum.format(drawData.date)}"
color="white" />
</mx:HBox>
</mx:HBox>
<mx:Label text="foobar" />
</mx:VBox>
The first label bound to the test String works correctly. The
second
label bound to the drawData drawDay object date property does
not work
correctly.
What is the proper way to bind this object?

I have struggled with this all day and made no headway. The
only
strange thing I get is with this line:
<mx:Label text="{dayCells.currentItem.toString()}" />
outputs [object Object]
Not the expected string from this drawDay.as function.
// toString()
public function toString():String
return "Date: " + formatedDate;
Ian Skinner wrote:
> I am apparently not doing this. What am I missing to
properly bind an
> object from a repeater looping over an array of object
to the custom
> component called in the repeater?
>
> <mx:Repeater
> id="dayCells"
> dataProvider="{days}"
> startingIndex="{weekRows.currentItem}"
> count="7">
> <mx:GridItem
> width="14%"
> borderColor="black"
> borderThickness="1"
> borderStyle="solid">
> <mx:Label
> text="{dayCells.currentItem.formatedDate}" />
> <ian:dayFormat2
> drawData="{dayCells.currentItem as drawDay}"
> test="{dayCells.currentItem.formatedDate}" />
> </mx:GridItem>
> </mx:Repeater>
>
> {days} is an array of drawDate.as objects returned with
a remoteObject.
> I can correctly bind properties of these drawDate
objects in the lable
> and the test property of the dayFormat2 customComponent.
But I can NOT
> correctly bind the entire object over to dayFormat2.
What am I missing?
>
> My current version of dayFormat2.mxml, I have tried
several alternatives
> for this file.
>
> ?xml version="1.0" encoding="utf-8"?>
> <mx:VBox xmlns:mx="
http://www.adobe.com/2006/mxml"
width="100%">
> <mx:Script>
> <![CDATA[
> import drawDay;
>
> //Define public variables
> [Bindable]
> public var drawData:drawDay;
>
> [Bindable]
> public var test:String;
> ]]>
> </mx:Script>
>
> <mx:DateFormatter id="dayNum" formatString="DD" />
>
> <mx:HBox
> backgroundColor="0x002649"
> width="100%"
> horizontalAlign="right">
> <mx:Label
> text="{test}"
> color="white" />
> <mx:HBox
> backgroundColor="0xAF1E2D"
> horizontalAlign="center">
> <mx:Label
> text="{dayNum.format(drawData.date)}"
> color="white" />
> </mx:HBox>
> </mx:HBox>
>
> <mx:Label text="foobar" />
> </mx:VBox>
>
> The first label bound to the test String works
correctly. The second
> label bound to the drawData drawDay object date property
does not work
> correctly.
>
> What is the proper way to bind this object?

Similar Messages

  • 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;
    }

  • Interactions to custom component stopped working

    I have created a beta site with 6 Page States. The last state has a custom component state that has 9 states of its own. The icon on Page 1 was clickable and transitioned to State 1 of Page 6, but when I linked the remaining 8 icons on Page 1 (for a total of 9) to their component states' variation; it stopped all transition to page 6 stopped. The transitions/interaction to Page 9 w/ custom components stop working. Is their a limit to the number of  these states? All other transitions to the remaining pages are working beautifully! This is a cool program. I almost completed a project without any help other than the videos.

    Gotcha. There is no limit to the number of objects per state of a custom component, and there is no problem with having text and an image in the same custom component.
    I think your explanation of states, transitions, and custom components might still be a little confused, so let me try to explain it a different way:
    Your main application has a set of states, aka views or places the user can go. You can create transitions that play when the user goes from a state to another state - so there are two transitions for every pair of states (A -> B and B -> A). It also has a set of objects (aka layers) which you can see in the Layers panel. Some objects only exist in one state, while some objects appear in multiple states.
    A custom component is like an enclosed microcosm of the main application. You can create states, and define transitions between pairs of states. You also define the set of objects in the custom component. These objects may exist in one or more states of the custom component, but are separate from the objects in the main application.
    There's no such thing as a transition from a state of the custom component to a state of the main application, or vice versa. Each component (the main application and the custom component) has its own set of states and transitions between those states. Likewise, each component has its own set of layers, and cannot manipulate the layers of other components.
    When you have an instance of a custom component in your main application, you can set its visibility, position, and other properties in each state of the main application, but you can't make changes to its layers between states of the main application. One property that you can change is its its state (either by creating an Interaction, or by creating a "Set Component State" action in a timeline). Setting its state will cause it to play the transition that exists from its current state to the new state, if such a transition exists.
    Does that make sense?
    -Adam

  • Can i Bind more than one Model object to the Custom controller or not

    Hi All, I trying to bind more than one model object to the custom controller, Both the model objects contains same attribute name called ( output). Both model objects created on to top of the BAPI. So when i bind first model object to the custom controller will work fine. When i am trying to bind the second model object to the same controller. This second model object also having the same attribute name called "output" . So it is giving an error of "Duplicate context element "Detail". Rename or uncheck duplicate elements.
    can i assign more than one model object to the single controller or not?
    But in the reference document, it has given that , we can create model object with more than one bapi.So in this case if both the bapis contains any element with the same name will also be problem. Any body give me the solution.
    Initially we have created one custom controller for each model object. But later i realized that, why con't we use same controller for all the model object. Because, the custom controller context is the public context. this context shared across all the view controllers.
    The concept which I am trying to do is right or wrong?

    Hi Vishal,
    of course, you can bind one controler to many models. When the same name occours you can simply RENAME binded node in controler.
    Regards
    Bogdan

  • How to bind a complex object to a composite component

    I'm using JSF2 and having an issue binding an object (EL Expression) as a parameter to my composite component.
    I have written a composite component (not very complex) that will display a drop-down list of countries and should bind the selection to a provided target bean.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:composite="http://java.sun.com/jsf/composite"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich">
    <!-- INTERFACE -->
    <composite:interface>
    <composite:attribute name="label" required="true" />
    <composite:attribute name="requiredMessage" required="true"/>
    <composite:attribute name="target" required="true" type="com.mycompany.entity.Country"/>
    </composite:interface>
    <!-- IMPLEMENATION -->
    <composite:implementation>
    <h:panelGrid columns="2">
    <h:outputLabel for="country-list" value="#{cc.attrs.label}"/>
    <h:panelGrid id="country" columns="1" styleClass="select-one-menu-panel" >
    <h:selectOneMenu id="country-list"
    enabledClass="select-one-menu-enabled" disabledClass="select-one-menu-disabled"
    layout="pageDirection"
    value="#{cc.attrs.target}"
    required="true" requiredMessage="#{cc.attrs.requiredMessage}"
    >
    <f:selectItem itemLabel="#{msgs['label.pleaseSelect']}" itemValue="" />
    <f:selectItems value="#{countryController.countries}" />
    <a4j:ajax />
    </h:selectOneMenu>
    <a4j:outputPanel id="country-list-error-panel" ajaxRendered="true">
    <h:message id="country-list-error" for="country-list" style="color:red"/>
    </a4j:outputPanel>
    </h:panelGrid>
    </h:panelGrid>
    </composite:implementation>
    </html>
    I want to be able to use the composite component in the following way:
    <util:country-select
    label="#{msgs['label.countryOfBirth']}"
    requiredMessge="#{msgs['error.birthCountryRequired']}"
    target="#{participant.countryOfBirth}"/>
    When I load the page everything renders correctly, but when I select an item from the drop-down I get a validation error.
    apply-form:j_idt77:country-list: Validation Error: Value is not valid
    I know that it must be something with the way that I have the parameters defined but I simply can't find any information to help me figure this out.
    Any light that you might be able to she on this would be greatly appreciated.
    Thank you for the help...

    Hi,
    well, you can. What the ADF Data Control and thus the binding gives you is the JSF component binding and the business service access.
    If you don't want to use ADF, then what you can do is
    - Create an ADF BC root Application Module from a managed bean
    e.g. see http://docs.oracle.com/cd/E21764_01/web.1111/b31974/bcservices.htm#CHDDDBFC
    - Access the View Object for querying the data to display
    - Expose the queried data so the component can handle it e.g. setter/getter for input components, ArrayList for tables (or you create the more complex component models like table and tree models)
    Having outlined the above, here are some gotchas to watch out for
    - Make sure creating the root application module is done such that you don't create/release it with each request. So you may consider a data serving managed bean in a scope like page flow or session
    - Ensure you have helper methods that allow you to query and CRUD operate the View Object data
    Frank

  • Custom component  - how to store java Properties object in ucm environment

    Hi Experts,
    I am developing a custom component.
    my custom component code is reading a properties file and load in Properties object. Everytime this custom Service is called, properties file is read from file system and new Properties Object is created.
    Is there any way to load the Properties object once and store somewhere in UCM context ? (just like we do in JSP using application object"
    thanks!!
    Edited by: user4884609 on Jul 12, 2010 3:01 PM

    I'd say there are quite a few ways how to do it, but many of them have nothing in common with UCM.
    - I'd opt for the only "UCM" way I' aware of: as a part of custom component you can create your own properties file (it's also called environment variables) as a part of your custom component. You can, then, easily read (and write?) properties from/to the file.
    - The first option could have disadvantage, if there are too many properties. In this case you could use Java serialization - it should be UCM independent
    - Another option is to create your properties in the database - it is a bit similar to the first option, but it's more robust. Plus, you may use features of the database if you want to have some additional logic in you properties.
    - Note that you can also create a static object, which could be initialized e.g during class load

  • JSF custom component: value not binding to component

    I have a custom UIInput component which is not able to bind to the value of the component from a backing bean. Here is the JSF code snippet:
    <tw:validateInputText id="locationIdStopInput" table="location" column="location" styleClass="wideSingleInput" value="#{currentStop.customer.customer}" rendered="#{loadTypeView.renderWarehouse or (currentStop.stopNumber gt 1 and loadTypeView.renderOutbound) or (currentStop.stopNumber eq 1 and loadTypeView.renderInbound)}"/>
    tw is the custom tag and validateInputText is the custom UiInput component.
    On posting the form the decode method is not able to get the value from the requestParameter map. Following is the decode() I wrote:
    public void decode(FacesContext context,
    UIComponent component) {
    // assertValidInput(context, component);
    if (context == null || component == null) {
    throw new NullPointerException();
    ValidateInputTextComponent map = (ValidateInputTextComponent) component;
    String key = map.getId();
    if (component instanceof UIInput) {
    UIInput input = (UIInput) component;
    String clientId = input
    .getClientId(context);
    Map requestMap = context
    .getExternalContext()
    .getRequestParameterMap();
    String newValue = (String) requestMap
    .get(clientId);
    if (null != newValue) {
    input.setSubmittedValue(newValue);
    Also providing the setProperties() from the custom tag class:
    protected void setProperties(UIComponent component){
    super.setProperties(component);
    if (getValue()!=null){
    if (isValueReference(getValue())){
    ValueBinding vbTarget = FacesContext.getCurrentInstance().getApplication().
    createValueBinding(getValue());
    component.setValueBinding(VB_VALUE, vbTarget);
    System.out.println(component.getValueBinding("value").getValue(FacesContext.getCurrentInstance()));
    } else{
    ((UIInput) component).setValue(value);
    // component.getAttributes().put("value",getValue());
    if (getCompValue()!=null){
    if (isValueReference(getCompValue())){
    ValueBinding vbCompTarget = FacesContext.getCurrentInstance().getApplication().
    createValueBinding(getCompValue());
    component.setValueBinding(VB_COMPONENT_VALUE, vbCompTarget);
    } else{
    // ((UIInput) component).setValue(compValue);
    component.getAttributes().put(VB_COMPONENT_VALUE,getCompValue());
    if (getTable() != null && isValueReference(getTable())){
    ValueBinding vbTable = FacesContext.getCurrentInstance().getApplication().
    createValueBinding(getTable());
    component.setValueBinding(VB_TABLE, vbTable);
    } else{
    component.getAttributes().put(VB_TABLE, getTable());
    if (getColumn() != null && isValueReference(getColumn())){
    ValueBinding vbColumn = FacesContext.getCurrentInstance().getApplication().
    createValueBinding(getColumn());
    component.setValueBinding(VB_COLUMN, vbColumn);
    } else{
    component.getAttributes().put(VB_COLUMN,getColumn());
    if (getStyleClass() != null && isValueReference(getStyleClass())){
    ValueBinding vbClass = FacesContext.getCurrentInstance().getApplication().
    createValueBinding(getStyleClass());
    component.setValueBinding(VB_STYLE_CLASS, vbClass);
    } else{
    component.getAttributes().put(VB_STYLE_CLASS, getStyleClass());
    if(getRendered() != null && isValueReference(getRendered())){
    ValueBinding vbRendered = FacesContext.getCurrentInstance().getApplication().
    createValueBinding(getRendered());
    component.setValueBinding(VB_RENDERED, vbRendered);
    } else{
    Boolean a = new Boolean(getRendered());
    component.getAttributes().put(VB_RENDERED, new Boolean(getRendered()));
    Please let me know If I am missing something here to retrieve the value from the component.
    Thanks

    See this tutorial:
    http://www.jsftutorials.net/components/index.html

  • Custom component data binding

    Hey people,
    I'm trying to write a custom component which extends from JPanel (has a List<?>). It will basically display some sub-panels on itself by considering the underlying data (database table rows). I want to have the same functionality with JTable binding. I'm having difficulty listening changes occur on the list. How can I listen to changes inside the list in my JPanel component? Should I write a custom model? or Should I use a ObservableList? any suggestions are welcome..

    Actually, it's not a JList. My component is a custom JPanel which has an underlying collection to hold data. I'm binding this underlying collection to an ObservableList which is filled with the result set fetched from the database. It's a standart ArrayList<?> and I want to listen to the changed that made to this list.
    MyPanel extends JPanel {
        private List<Person> list = new ArrayList<Person>();
    }I'd like to see any changes made to the list inside MyPanel class.

  • 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 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.

  • Custom component/tag class:  ---which setters/getters do what?

    Hi
    I'm trying to create a custom component, but, there is a major concept that I do not understand...
    ---What are the setters/getters in the "component" class used for?...
    ---What are the setters/getters in the "tag" class used for?
    Another way of asking is...
    ---Which setters/getters are used simply to keep track of attribute name/id/key?
    ---Which setters and getters refer to the actual objects that the attribute names point to?
    The reason for my confusion is that nearly all "custom component" examples I've seen thus far, utilize attributes that point to "String" objects... (i.e., as opposed to ArrayList, HashMap, etc)...
    This makes it difficult for me to distinguish whether the String values in the getters/setters are referring to the String name/"id" of the attribute...or, the String "value" of the attribute...
    I have not been able to verify how I should code the getter/setters (and type casts) for other kinds of objects like ArrayLists, HashMaps, etc
    For example, a typical logic mechanism Ive seen in the custom "tag" examples is as follows...
    in a "tag" class...
            if( tabledata != null )
                if (isValueReference (tabledata))
                    FacesContext context = FacesContext.getCurrentInstance ();
                    Application app = context.getApplication ();
                    ValueBinding vb = app.createValueBinding (tabledata);
                    component.setValueBinding ("tabledata", vb);
                else
                    component.getAttributes ().put ("tabledata", tabledata);
    in the "component" class...
        public void setTabledata (List tabledata)
            this.tabledata = tabledata;
        public List getTabledata ()
            if(null != tabledata)
                return tabledata;
            ValueBinding _vb = getValueBinding ("tabledata");
            if(_vb != null)
                return (List)_vb.getValue (getFacesContext ());
            else
                return null;
        }...considering the above code,
    ---when/where should the "tabledata" variable be referring the "name/id" of the attribute?...
    ---when/where should the "tabledata" variable be referring to the "value" of the attribute?...
    ...as, I need to change the type casting to adjust to what it should be...
    ***NOTE: This is one error that I'm getting, and I believe it is because I do not understand how getter/setter is used in "component" and "tag" classe, i.e., :
    "org.apache.jasper.JasperException: jsp.error.beans.property.conversion
         org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:885)"...
    Thanks for any help on this!
    sd

    The "tabledata" variable always refers the local value of the attribute.
    When using a value binding to some backing bean,
    the local value is null and the model value is owned by the bean.
    You don't need any casting in the tag class nor the component class.
    The setters/getters in the component class specify the type of the attributes.
    Conversion from/to String to/from the type is done automatically if possible.
    When the automatic conversion is impossible, you should specify f:converter
    for the attribute.

  • Can I define a constructor for a Custom Component?

    I have a custom component which I instantiate through ActionScript.  For the sake of clean code, I would like to be able to assign the variables through the constructor like any other class:
    var myComp:CustomComponent = new CustomComponent(arg1, arg2, ...);
    However, when I try to write a constructor in the Script block for the component, it gives me a compile error telling me that I have multiple constructors:
    //In Script tag//
    public function CustomeComponent(arg1, arg2 ...):void { ... }
    Are we not able to define constructors for Custom Components?

    If this post helps, please mark it as such.
    If you create an array variable in your MXML component, and then set it with myVar="[val1, val2, val3]" in the opening tag of your component, then you basically have a constructor in MXML.
    You can use the [Bindable] metadata tag in three places:
    Before a public class definition.
    The [Bindable] metadata tag makes usable as the source of a binding expression all public properties that you defined as variables, and all public properties that are defined by using both a setter and a getter method. In this case, [Bindable] takes no parameters, as the following example shows:
    [Bindable]
    public class TextAreaFontControl extends TextArea {}
    The Flex compiler automatically generates an event named propertyChange, of type PropertyChangeEvent, for all public properties so that the properties can be used as the source of a data binding expression.
    If the property value remains the same on a write, Flex does not dispatch the event or update the property, where not the same translates to the following test:
    (oldValue !== value)
    That means if a property contains a reference to an object, and that reference is modified to reference a different but equivalent object, the binding is triggered. If the property is not modified, but the object that it points to changes internally, the binding is not triggered.
    Note: When you use the [Bindable] metadata tag before a public class definition, it only applies to public properties; it does not apply to private or protected properties, or to properties defined in any other namespace. You must insert the [Bindable] metadata tag before a nonpublic property to make it usable as the source for a data binding expression.
    Before a public, protected, or private property defined as a variable to make that specific property support binding.
    The tag can have the following forms:
    [Bindable]
    public var foo:String;
    The Flex compiler automatically generates an event named propertyChange, of type PropertyChangeEvent, for the property. If the property value remains the same on a write, Flex does not dispatch the event or update the property.
    You can also specify the event name, as the following example shows:
    [Bindable(event="fooChanged")]
    public var foo:String;
    In this case, you are responsible for generating and dispatching the event, typically as part of some other method of your class. You can specify a [Bindable] tag that includes the event specification if you want to name the event, even when you already specified the [Bindable] tag at the class level.
    Before a public, protected, or private property defined by a getter or setter method.
    You must define both a setter and a getter method to use the [Bindable] tag with the property. If you define just a setter method, you create a write-only property that you cannot use as the source of a data-binding expression. If you define just a getter method, you create a read-only property that you can use as the source of a data-binding expression without inserting the [Bindable] metadata tag. This is similar to the way that you can use a variable, defined by using the const keyword, as the source for a data binding expression.
    The tag can have the following forms:
    As far as binding, you can add the [Bindable] tag before the class declaration to make bindable all public properties defined as variables, and all public properties defined by using both a setter and a getter method.

  • 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

  • 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 to handle custom component data on overviewset save button CRM UI

    Hi,
    I have added a custom component to a standard view which is enchanted.
    I can handle any data with my buttons on the component but after editing data
    i need the save the data when the save button on the overview(top) is pressed.
    I have redefined save button of overview but i cant get my data.
    My node name is Root. I think i couldnt bind it to overview.
    How can i do that?
    Thank you

    Probably it can be done by
    http://wiki.sdn.sap.com/wiki/display/CRM/CRMWebUITechnical-CreatingTableViewInWebUI
    i am trying
    Thank you

Maybe you are looking for

  • On a Mac, can you navigate menus with one handed key strokes like Windows?

    On a Mac, is there anyway to navigate menus with one handed keyboard strokes like you can in Windows? My girlfriend is a graphic designer and switched from Windows to Mac. She misses being able to use the Alt key and make menu selections. On Windows

  • Using a network adapter multiple times problem

    <Microsoft Network Adapter Multiplexor Driver(Team 1) is either part of more than one virual switch or added twice as part of a single team .Make sure the physica l network adapter is used only once > this is the problem that is shown me and still i

  • Problems after Jelly Bean upgrade

    I upgraded to Jelly Bean when it came available and immediately started noticing problems.  The phone became sluggish in general but most notably the keyboard lagged to the point where texting became problematic.  I was unable to use the gallery app

  • Which Date for Sales Date in Demantra

    Hi Experts, For 'Shipment History – requested items –shipped date' option for collecting actual quantity, which date is picked from oe_order_lines_all table. I assume it is Actual_shipment_date . Initially I was thinking of scheduled_arrival_date or

  • Purchase Price Determination in VKP5

    Hi, For Determining Sales Pricing Procedure, we assign Pricing Procedure in Pricing Type and Pricing Type is assigned to Sales Org and DChn. However, I am not sure how Purchase Price Procedure is determined in VKP5. We do not enter purchase org/Group