>
> Hi there,
I want to change the way my app is working and absolutely dunno how to do
it.
To be honest, despite reading things around UiBinder and rf, i'm totally
lost.
*(Generally) How it works actually,*
I do have a window in which a table can be found populated with datas from
a database table A on load.
When clicking on a row, 3 modals dialog box appears respectively with
- 1st dialog : Detail about the selected row from table A
- 2nd dialog : Fields coming from a table B (linked to table A by an ID)
- 3rd dialog : Fields coming from a table C (linked to table A by an ID2)
Datas can be persisted on 2nd and 3rd dialog boxes.
Everything is working perfectly.
*Improvment :* I now want *not* to throw popups, but add a widget under the
table which will contains 1st, 2nd and 3rd widgets.
When clicking on table as usually, every of the 3 widgets must be filled as
they are actually in popups.
*Question :*Would be grateful if someone can guide me or give a example for
me to dig.
In the code below, i think that every popup is created and built as follows.
mvtEditor = new *MvtEditor*();
Binder.BINDER.createAndBindUi(this);
How to can tell gwt that Editor is already created and that datas must be
rerouted to this widget ?
Should i still link MvtAWorkflow with eventBus and factory in the main
constructor ?
Should i have to create another Event ?
Well i'm lost.
*(Code part) How it works actually : ( truncated and modified for a better
reading)*
I'm using a addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
> @Override
> public void onSelectionChange(SelectionChangeEvent event) {
> AProxy mvt = selectionModel.getSelectedObject();
>
> eventBus.fireEvent(new EditAEvent(mvt));
> [...] ( Getting mvtB )
> eventBus.fireEvent(new EditBEvent(mvtB));
> [...] ( Getting mvtC )
> eventBus.fireEvent(new EditCEvent(mvtC));
>
> }
> });
Example of EditAEvent ( app the same for B and C )
* EditAEvent*
> public class EditAEvent extends GwtEvent<EditAEvent.Handler> {
> public static final Type<Handler> TYPE = new Type<Handler>();
> public interface Handler extends EventHandler {
> void *startEdit*(AProxy mvt, RequestContext requestContext);
> }
> private final AProxy mvt;
> private final RequestContext request;
> public EditAEvent(AProxy mvt) {
> this(mvt, null);
> }
> public EditAEvent(AProxy mvt, RequestContext request) {
> this.mvt = mvt;
> this.request = request;
> }
> @Override
> protected void dispatch(Handler handler) {
> handler.startEdit(mvt, request);
> }
> @Override
> public com.google.gwt.event.shared.GwtEvent.Type<Handler>
> getAssociatedType() {
> return TYPE;
> }
> }
EditAEvent is imported by *AEditorWorkflow *( truncated )
> public class AEditorWorkflow {
> interface Binder extends UiBinder<DialogBox, AEditorWorkflow> {
> Binder BINDER = GWT.create(Binder.class);
> }
> interface Driver extends
> RequestFactoryEditorDriver<AProxy, MvtEditor> {
> }
> static void register(EventBus eventBus,
> final Factory requestFactory) {
> eventBus.addHandler(EditMvtEvent.TYPE, new EditMvtEvent.Handler() {
> public void *startEdit*(AProxy mvt, RequestContext requestContext) {
> new AEditorWorkflow(requestFactory, mvt).*edit*(requestContext);
> }
> });
> }
> Logger log = Logger.getLogger("");
> @UiField
> HTMLPanel contents;
> @UiField
> DialogBox dialog;
>
> @UiField(provided = true)
> *MvtEditor *mvtEditor;
> private Driver editorDriver;
> private AProxy mvt;
> private final Factory requestFactory;
> private AEditorWorkflow(Factory requestFactory,
> AProxy mvt) {
> this.requestFactory = requestFactory;
> this.mvt = mvt;
> mvtEditor = new *MvtEditor*();
> Binder.BINDER.createAndBindUi(this);
>
> contents.addDomHandler(new KeyUpHandler() {
> public void onKeyUp(KeyUpEvent event) {
> if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
> onCancel(null);
> }
> }
> }, KeyUpEvent.getType());
> }
[...]
private void edit(RequestContext requestContext) {
> editorDriver = GWT.create(Driver.class);
> editorDriver.initialize(requestFactory, mvtEditor);
> if (requestContext == null) {
> fetchAndEdit();
> return;
> }
> editorDriver.edit(mvt, requestContext);
> mvtEditor.focus();
> dialog.center();
> }
Finally, *MvtEditor *as follows
public class MvtEditor extends Composite implements Editor<AProxy> {
interface Binder extends UiBinder<Widget, MvtEditor> {
}
@UiField
ValueBoxEditorDecorator<String> A;
@UiField
ValueBoxEditorDecorator<String> B;
@UiField
ValueBoxEditorDecorator<String> C;
@UiField
ValueBoxEditorDecorator<Long> id;
@UiField
Focusable nameBox;
public MvtEditor() {
initWidget(GWT.<Binder> create(Binder.class).createAndBindUi(this));
}
public void focus() {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
nameBox.setFocus(true);
}
});
}
}
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.