Hi, 
I've been struggling for days to display a list of objects in an editor 
using UIBinder.

But I can't figure out which class to use and even less how.

Here are some code snippets:

The UIBinder file
<!-- EventImplEditor.ui.xml file -->
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent";>
<ui:UiBinder
        xmlns:ui="urn:ui:com.google.gwt.uibinder"
        xmlns:m="urn:import:gwt.material.design.client.ui"
        xmlns:ma="urn:import:gwt.material.design.addins.client"
        
xmlns:combobox="urn:import:gwt.material.design.addins.client.combobox"
        xmlns:g="urn:import:com.google.gwt.user.client.ui">
   <ui:style>
        .widget {
           margin: 30px;
       }
    </ui:style>
   <m:MaterialDialog ui:field="dialog" width="300px)">
      <m:MaterialContainer ui:field="container" width="300px)" 
addStyleNames="{style.widget}">
        <m:MaterialPanel>
                <m:MaterialButton  ui:field="exit" text="Exit"/>
        </m:MaterialPanel>
    <m:MaterialPanel>
    <m:MaterialTextBox ui:field="name" label="Name" iconType="FACE" />
    <m:MaterialTextBox ui:field="graphID" label="GraphID" iconType="FACE" />
    </m:MaterialPanel>
    <m:MaterialPanel ui:field="MaterialPanelCombo2"> 
    </m:MaterialPanel>
    <m:MaterialPanel ui:field="MaterialPanelCombo3"> 
    </m:MaterialPanel>
    <m:MaterialPanel ui:field="MaterialPanelCombo4"> 
    </m:MaterialPanel>
    <m:MaterialPanel ui:field="MaterialPanelCombo5"> 
    </m:MaterialPanel>
    <m:MaterialPanel ui:field="MaterialPanelCombo6"> 
    </m:MaterialPanel>
    <m:MaterialPanel>
    </m:MaterialPanel>
    <m:MaterialPanel>
    <!-- Here I tried to put List box  but no result -->
    <g:ListBox ui:field="canBeusedBy" />
    </m:MaterialPanel>
      </m:MaterialContainer>
    </m:MaterialDialog>
</ui:UiBinder>




The Editor Java file

package com.lacen.gwt.spot.client.ui.mvp.editors.generated;
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.editor.client.Editor;
 import com.google.gwt.editor.client.SimpleBeanEditorDriver;
 import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.gwt.uibinder.client.UiBinder;
 import com.google.gwt.uibinder.client.UiField;
 import com.google.gwt.uibinder.client.UiHandler;
 import com.google.gwt.user.client.ui.Composite;
 import com.google.gwt.user.client.ui.Widget;
 import com.lacen.event.Event;
 import gwt.material.design.client.ui.MaterialPanel;
 import com.lacen.gwt.spot.client.ui.mvp.editors.ComboBoxEnum;
 import gwt.material.design.client.ui.MaterialDialog;
 import gwt.material.design.client.ui.MaterialTextBox;
 import com.google.gwt.user.client.ui.ListBox;
 import java.util.List;
 import com.lacen.gwt.spot.client.ui.mvp.editors.ListValueSpot;
 import com.lacen.users.Stakeholder;
 import com.lacen.organisation.Action;
 /**
 * Create an editor to describe a event.
 * @author Antonio
 */
 public class EventEditor extends Composite implements Editor<Event> {
      /** The Constant driver. */
      // Editor driver
      private static final EventDriver driver = 
GWT.create(EventDriver.class);
      /**
      * The Interface EventDriver.
      */
      interface EventDriver extends SimpleBeanEditorDriver<Event, 
EventEditor> {
      }
      /** The Constant uiBinder. */
      // UiBinder and fields
      private static final EventEditorUiBinder uiBinder = 
GWT.create(EventEditorUiBinder.class);
      /**
      * The Interface EventEditorUiBinder.
      */
      interface EventEditorUiBinder extends UiBinder<Widget, EventEditor> {
      }
      /** The dialog. */
      @UiField
      MaterialDialog dialog;
      /** The name */
      @UiField
      MaterialTextBox name;
      /** The graphID */
      @UiField
      MaterialTextBox graphID;
      /** The eventStatus */
      @UiField
      MaterialPanel MaterialPanelCombo2;
      ComboBoxEnum<com.lacen.event.HandlingProgress> eventStatus;
      /** The relevance */
      @UiField
      MaterialPanel MaterialPanelCombo3;
      ComboBoxEnum<com.lacen.event.Relevance> relevance;
      /** The status */
      @UiField
      MaterialPanel MaterialPanelCombo4;
      ComboBoxEnum<com.lacen.event.StatusEvent> status;
      /** The detectability */
      @UiField
      MaterialPanel MaterialPanelCombo5;
      ComboBoxEnum<com.lacen.event.Detectability> detectability;
      /** The criticity */
      @UiField
      MaterialPanel MaterialPanelCombo6;
      ComboBoxEnum<com.lacen.event.Criticality> criticity;
      /** The canBeusedBy */
      ListBox canBeusedBy;
      /** The initial object (Event). */
      private Event initialObject;
      /**
      * Instantiates a new Event editor.
      */
      public EventEditor() {
           initWidget(uiBinder.createAndBindUi(this)); //// Create the UI 
of the Editor.
           eventStatus = new 
ComboBoxEnum<com.lacen.event.HandlingProgress>("eventStatus", 
com.lacen.event.HandlingProgress.VALUES);
           MaterialPanelCombo2.add(eventStatus.getComboBox());
           relevance = new 
ComboBoxEnum<com.lacen.event.Relevance>("relevance", 
com.lacen.event.Relevance.VALUES);
           MaterialPanelCombo3.add(relevance.getComboBox());
           status = new ComboBoxEnum<com.lacen.event.StatusEvent>("status", 
com.lacen.event.StatusEvent.VALUES);
           MaterialPanelCombo4.add(status.getComboBox());
           detectability = new 
ComboBoxEnum<com.lacen.event.Detectability>("detectability", 
com.lacen.event.Detectability.VALUES);
           MaterialPanelCombo5.add(detectability.getComboBox());
           criticity = new 
ComboBoxEnum<com.lacen.event.Criticality>("criticity", 
com.lacen.event.Criticality.VALUES);
           MaterialPanelCombo6.add(criticity.getComboBox());
           dialog.open(); //// Visualize the editor.
      }
      /**
      * Initialize and fill in the editors fields with the Event properties.
      *
      * @param obj the Event.
      */
      public void edit(Event obj) {
           this.initialObject = obj;
           driver.initialize(this); //// Initialize the driver
           driver.edit(this.initialObject); //// Fill the editor with the 
object
      }
      /**
      * Exit the editor closing the dialog.
      *
      * @param event the event
      */
      @UiHandler("exit")
      public void onExitSelect(ClickEvent event) {
           dialog.close();
      }
 }

In my Event object model, "canBeusedBy" is the name of a "Stakeholder" list 
that 
I want to display in the ListBox.

When I call my editor everything is displayed but not the list?  Here after 
a copy of the editor displayed:
[image: Editor.PNG]

Do you have an idea, a specific example with a list of objects.

Thank you for your help.

Antonio
 

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/4f85a2c2-7b65-48af-9603-621627f1027en%40googlegroups.com.

Reply via email to