/**
 * This file is part of DBNavigation.
 *
 * RiPhone is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of
 * the License, or (at your option) any later version.
 *
 * RiPhone is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with RiPhone.  If not, see <http://www.gnu.org/licenses/>
 *
 *
 * Copyright (c) 2011-2012 Manfred Tremmel
 *
 * --
 *    Name        Date        Change
 */
package de.knightsoft.DBNavigationBar.client.ui;

import com.google.gwt.user.client.History;
import com.google.gwt.user.client.ui.Composite;

import de.knightsoft.DBNavigationBar.client.Parent;
import de.knightsoft.DBNavigationBar.client.domain.DomainUser;

/**
 * The <code>BasicTemplateUI</code> class is a template for all
 * input mask.
 *
 * @param <F> parent widget
 *
 * @author Manfred Tremmel
 * @version 1.0.0, 2011-02-19
 */
public abstract class BasicTemplateUI<F extends Parent> extends Composite
    implements BasicTemplateUIInterface<F> {

    /**
     * parent widget.
     */
    private F parentwidget;

    /**
     * Constructor.
     */
    public BasicTemplateUI() {
        super();
    }

    /**
     * Constructor.
     *
     * @param setParentwidget
     *         the parent widget, where this frame is displayed
     */
    public BasicTemplateUI(
            final F setParentwidget) {

        this.parentwidget  =    setParentwidget;
    }

    /**
     * <code>setFocusOnFirstWidget</code> set focus to first enabled
     * input field.
     *
     */
    protected abstract void setFocusOnFirstWidget();

    /**
     * set up the mask.
     * @param user
     *            user information about the currently logged in user
     */
    protected abstract void setUpMask(DomainUser user);


    /**
     * The Method <code>matchesMenuSimple</code> looks if this UI is selected
     * and makes the necessary changes.
     *
     * @param itemtext
     *            selected menu item
     * @param user
     *            user information about the currently logged in user
     * @return true if it is allowed for this user
     */
    public final boolean matchesMenuSimple(
            final String itemtext,
            final DomainUser user) {
        boolean matches = false;
        if (this.allowedToSee(user)
         && itemtext != null
         && itemtext.equals(this.getMenuText())) {
            //this.myNavigationBar.enableAllButtons();
            this.parentwidget.getMainPanel().clear();
            this.setUpMask(user);
            this.parentwidget.getMainPanel().add(this);
            matches    =    true;
            History.newItem("page=" + this.getMenuText());
        }
        return matches;
    }

    @Override
    public final void onLoad() {
        super.onLoad();
        this.setFocusOnFirstWidget();
    }
    /**
     * return parent widget.
     * @return the parent widget
     */
    @Override
    public final F getParentwidget() {
        return parentwidget;
    }


    /**
     * @param parentwidgetSet the parentwidget to set
     */
    public final void setParentwidget(final F parentwidgetSet) {
        this.parentwidget = parentwidgetSet;
    }
}

@@ -824,16 +824,104 @@
 nt.ui;%0A%0A
+import com.google.gwt.core.client.Scheduler;%0Aimport com.google.gwt.user.client.Command;%0A
 import c
@@ -3100,120 +3100,486 @@
     
-%7D%0A        return matches;%0A    %7D%0A%0A    @Override%0A    public final void onLoad() %7B%0A        super.onLoad();%0A        
+    Scheduler.get().scheduleDeferred(new Command() %7B%0A                @Override%0A                public void execute() %7B%0A                    BasicTemplateUI.this.setFocusOnFirstWidget();%0A                %7D%0A            %7D);%0A        %7D%0A        return matches;%0A    %7D%0A%0A    @Override%0A    public final void onLoad() %7B%0A        super.onLoad();%0A        Scheduler.get().scheduleDeferred(new Command() %7B%0A            @Override%0A            public void execute() %7B%0A                BasicTemplateUI.
 this
@@ -3600,24 +3600,50 @@
 stWidget();%0A
+            %7D%0A        %7D);%0A
     %7D%0A    /*

set focus update