Example usage for com.google.gwt.user.client.ui SubmitButton SubmitButton

List of usage examples for com.google.gwt.user.client.ui SubmitButton SubmitButton

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui SubmitButton SubmitButton.

Prototype

public SubmitButton() 

Source Link

Document

Creates a button with no caption.

Usage

From source file:com.eduworks.gwt.client.pagebuilder.PageAssembler.java

License:Apache License

/** preserves event handlers on element to be wrapped */
public static Widget elementToWidget(Element e, String typ) {
    Widget result = null;/*from   w  ww  . ja v a  2s  .com*/
    if (e != null) {
        int eventsSunk = DOM.getEventsSunk(e);
        EventListener el = DOM.getEventListener(e);
        if (typ == TEXT)
            result = TextBox.wrap(e);
        else if (typ == TEXT_AREA)
            result = TextArea.wrap(e);
        else if (typ == PASSWORD)
            result = PasswordTextBox.wrap(e);
        else if (typ == LABEL)
            result = Label.wrap(e);
        else if (typ == A)
            result = Anchor.wrap(e);
        else if (typ == IMAGE)
            result = Image.wrap(e);
        else if (typ == SELECT)
            result = ListBox.wrap(e);
        else if (typ == HIDDEN)
            result = Hidden.wrap(e);
        else if (typ == FILE)
            result = FileUpload.wrap(e);
        else if (typ == FORM)
            result = FormPanel.wrap(e, true);
        else if (typ == FRAME)
            result = Frame.wrap(e);
        else if (typ == SUBMIT)
            result = SubmitButton.wrap(e);
        else if (typ == BUTTON)
            result = Button.wrap(e);
        else if (typ == CHECK_BOX)
            result = SimpleCheckBox.wrap(e);
        DOM.sinkEvents(e, eventsSunk);
        DOM.setEventListener(e, el);
    } else {
        if (typ == TEXT)
            result = new TextBox();
        else if (typ == TEXT_AREA)
            result = new TextArea();
        else if (typ == PASSWORD)
            result = new PasswordTextBox();
        else if (typ == LABEL)
            result = new Label();
        else if (typ == A)
            result = new Anchor();
        else if (typ == SELECT)
            result = new ListBox();
        else if (typ == IMAGE)
            result = new Image();
        else if (typ == HIDDEN)
            result = new Hidden();
        else if (typ == FILE)
            result = new FileUpload();
        else if (typ == FORM)
            result = new FormPanel();
        else if (typ == FRAME)
            result = new Frame();
        else if (typ == SUBMIT)
            result = new SubmitButton();
        else if (typ == BUTTON)
            result = new Button();
        else if (typ == CHECK_BOX)
            result = SimpleCheckBox.wrap(e);
    }
    return result;
}

From source file:com.eduworks.gwt.client.pagebuilder.PageAssembler.java

License:Apache License

/** preserves event handlers on element to be wrapped  */
public static Widget elementToWidget(String elementName, String typ) {
    Widget result = null;/*from  ww w .ja v a  2s. c om*/
    Element e = DOM.getElementById(elementName);
    if (e != null) {
        int eventsSunk = DOM.getEventsSunk(e);
        EventListener el = DOM.getEventListener(e);
        if (typ == TEXT)
            result = TextBox.wrap(e);
        else if (typ == TEXT_AREA)
            result = TextArea.wrap(e);
        else if (typ == PASSWORD)
            result = PasswordTextBox.wrap(e);
        else if (typ == LABEL)
            result = Label.wrap(e);
        else if (typ == A)
            result = Anchor.wrap(e);
        else if (typ == SELECT)
            result = ListBox.wrap(e);
        else if (typ == IMAGE)
            result = Image.wrap(e);
        else if (typ == HIDDEN)
            result = Hidden.wrap(e);
        else if (typ == FILE)
            result = FileUpload.wrap(e);
        else if (typ == FORM)
            result = FormPanel.wrap(e, true);
        else if (typ == FRAME)
            result = Frame.wrap(e);
        else if (typ == SUBMIT)
            result = SubmitButton.wrap(e);
        else if (typ == BUTTON)
            result = Button.wrap(e);
        else if (typ == CHECK_BOX)
            result = SimpleCheckBox.wrap(e);
        DOM.sinkEvents(e, eventsSunk);
        DOM.setEventListener(e, el);
    } else {
        if (typ == TEXT)
            result = new TextBox();
        else if (typ == TEXT_AREA)
            result = new TextArea();
        else if (typ == PASSWORD)
            result = new PasswordTextBox();
        else if (typ == LABEL)
            result = new Label();
        else if (typ == A)
            result = new Anchor();
        else if (typ == IMAGE)
            result = new Image();
        else if (typ == SELECT)
            result = new ListBox();
        else if (typ == HIDDEN)
            result = new Hidden();
        else if (typ == FILE)
            result = new FileUpload();
        else if (typ == FORM)
            result = new FormPanel();
        else if (typ == FRAME)
            result = new Frame();
        else if (typ == SUBMIT)
            result = new SubmitButton();
        else if (typ == BUTTON)
            result = new Button();
        else if (typ == CHECK_BOX)
            result = SimpleCheckBox.wrap(e);
    }
    return result;
}

From source file:com.ephesoft.dcma.gwt.login.client.LoginEntryPoint.java

License:Open Source License

@Override
public void onLoad() {
    Document.get().setTitle(LocaleDictionary.get().getConstantValue(LoginConstants.LOGIN_TITLE));
    Label userName = new Label(LocaleDictionary.get().getConstantValue(LoginConstants.LOGIN_USERNAME));
    userName.setStyleName("text_bold");
    Label password = new Label(LocaleDictionary.get().getConstantValue(LoginConstants.LOGIN_PASSWORD));
    password.setStyleName("text_bold");
    /*/*from   w  ww.j  av a  2 s.  c  o  m*/
     * CheckBox remMe = new CheckBox(LocaleDictionary.get().getConstantValue( LoginConstants.login_remember_me));
     * remMe.setEnabled(false); Label forgPwd = new Label(LocaleDictionary.get().getConstantValue(LoginConstants
     * .login_forgot_pwd));
     */
    Label version = new Label(LocaleDictionary.get().getConstantValue(LoginConstants.VERSION_TEXT));
    final Label versionNumber = new Label();
    RootPanel.get("userName").add(userName);
    RootPanel.get("password").add(password);
    /*
     * RootPanel.get("remMe").add(remMe); RootPanel.get("forgPwd").add(forgPwd);
     */
    RootPanel.get("version").add(version);
    ((LoginRemoteServiceAsync) createRpcService()).getProductVersion(new EphesoftAsyncCallback<String>() {

        @Override
        public void onSuccess(String version) {
            versionNumber.setText(version);
        }

        @Override
        public void customFailure(Throwable arg0) {
            ConfirmationDialogUtil.showConfirmationDialogError(
                    LocaleDictionary.get().getMessageValue(LoginConstants.UNABLE_TO_RETRIVE_VERSION_INFO));

        }
    });
    RootPanel.get("versionLabel").add(versionNumber);

    SubmitButton submitButton = new SubmitButton();
    submitButton.setFocus(true);
    submitButton.setText(LocaleDictionary.get().getConstantValue(LoginConstants.LOGIN_BUTTON_TEXT));
    submitButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            login();
        }
    });

    submitButton.setStyleName("btn_blue");
    RootPanel.get("buttonLogin").add(submitButton);
    final Label expiryMsg = new Label();

    ((LoginRemoteServiceAsync) createRpcService()).getLicenseExpiryMsg(new EphesoftAsyncCallback<Void>() {

        @Override
        public void customFailure(Throwable arg0) {
            String alertMsg = arg0.getLocalizedMessage();
            int indexOfDelimiter = alertMsg.indexOf('@');
            String days = alertMsg.substring(0, indexOfDelimiter);
            int remainingDays = Integer.parseInt(days);
            String dateString = alertMsg.substring(indexOfDelimiter + 1);
            if (remainingDays != 0) {
                expiryMsg.setText(LocaleDictionary.get().getMessageValue(LoginMessages.LICENSE_EXPIRY_MSG, days,
                        dateString));
            } else {
                expiryMsg.setText(
                        LocaleDictionary.get().getMessageValue(LoginMessages.LICENSE_EXPIRY_MSG_TODAY));
            }
        }

        @Override
        public void onSuccess(Void arg0) {
            // Nothing to do .. on success of RPC call
        }
    });
    expiryMsg.setStyleName(LICENSE_TEXT);
    RootPanel.get(EXPIRY_MSG_LEBEL).add(expiryMsg);
    final HorizontalPanel horPanel = new HorizontalPanel();
    horPanel.setWidth("100%");
    RootPanel.get().add(horPanel);
    ScreenMaskUtility.maskScreen("Loading");
    rpcService.getFooterProperties(new EphesoftAsyncCallback<Map<String, String>>() {

        @Override
        public void onSuccess(Map<String, String> footerProperties) {
            String footerText = footerProperties.get(CoreCommonConstants.FOOTER_TEXT_KEY);
            String footerLink = footerProperties.get(CoreCommonConstants.FOOTER_LINK_KEY);
            final Anchor footerInfo = new Anchor(footerText, footerLink);
            horPanel.add(footerInfo);
            horPanel.setCellHorizontalAlignment(footerInfo, HasHorizontalAlignment.ALIGN_CENTER);
            ScreenMaskUtility.unmaskScreen();
        }

        @Override
        public void customFailure(Throwable arg0) {
            ScreenMaskUtility.unmaskScreen();
            ConfirmationDialogUtil
                    .showConfirmationDialogError("Application could not be authorized. Please try again.");
        }
    });
}

From source file:com.ephesoft.gxt.login.client.LoginEntryPoint.java

License:Open Source License

@Override
public void onLoad() {
    Window.setTitle(LocaleDictionary.getConstantValue(LoginConstants.LOGIN_TITLE));

    Label userName = new Label(LocaleDictionary.getConstantValue(LoginConstants.login_username));
    Label password = new Label(LocaleDictionary.getConstantValue(LoginConstants.login_password));
    RootPanel.get("loginHeader").getElement()
            .setInnerText(LocaleDictionary.getConstantValue(LoginConstants.login_button_text));
    RootPanel.get("j_username").getElement().setAttribute("placeholder", userName.getText());
    RootPanel.get("j_username").getElement().focus();
    RootPanel.get("j_password").getElement().setAttribute("placeholder", password.getText());
    final Label versionNumber = new Label();

    ((LoginRemoteServiceAsync) createRpcService()).getProductVersion(new AsyncCallback<String>() {

        @Override/*from  ww w . j  a va2 s  .c o  m*/
        public void onSuccess(String version) {
            versionNumber.setText(version);
            RootPanel.get("versionLabel").getElement().setInnerText(versionNumber.getText());
        }

        @Override
        public void onFailure(Throwable arg0) {
            DialogUtil.showMessageDialog(LocaleDictionary.getConstantValue(LocaleCommonConstants.ERROR_TITLE),
                    LocaleDictionary.getConstantValue(LoginConstants.UNABLE_TO_RETRIVE_VERSION_INFO),
                    DialogIcon.ERROR);

        }
    });

    final Label expiryMsg = new Label();
    final Label failOverMsg = new Label();
    ((LoginRemoteServiceAsync) createRpcService()).getLicenseExpiryMsg(new AsyncCallback<Void>() {

        @Override
        public void onFailure(Throwable arg0) {
            String alertMsg = arg0.getLocalizedMessage();
            int indexOfDelimiter = alertMsg.indexOf('@');
            String days = alertMsg.substring(0, indexOfDelimiter);
            int remainingDays = Integer.parseInt(days);
            String dateString = alertMsg.substring(indexOfDelimiter + 1);
            if (remainingDays != 0) {
                expiryMsg.setText(
                        LocaleDictionary.getMessageValue(LoginMessages.LICENSE_EXPIRY_MSG, days, dateString));
            } else {
                expiryMsg.setText(LocaleDictionary.getMessageValue(LoginMessages.LICENSE_EXPIRY_MSG_TODAY));
            }
            expiryMsg.addStyleName(FONT_RED_CSS);
            expiryMsg.addStyleName(BOLD_TEXT_CSS);
            RootPanel.get(EXPIRY_MSG_LEBEL).getElement().setInnerText(expiryMsg.getText());
            RootPanel.get(EXPIRY_MSG_LEBEL).addStyleName(expiryMsg.getStyleName());
        }

        @Override
        public void onSuccess(Void arg0) {
        }
    });

    ((LoginRemoteServiceAsync) createRpcService()).getFailOverMessage(new AsyncCallback<Boolean>() {

        @Override
        public void onSuccess(Boolean result) {
            if (true == result) {
                // failOverMsg.setText("");
            } else {
                failOverMsg.setText(LocaleDictionary.getMessageValue(LoginMessages.FAILOVER_MSG));
                failOverMsg.addStyleName(FONT_RED_CSS);
                failOverMsg.addStyleName(BOLD_TEXT_CSS);
                RootPanel.get(FAIL_OVER_LABEL).getElement().setInnerText(failOverMsg.getText());
                RootPanel.get(FAIL_OVER_LABEL).addStyleName(failOverMsg.getStyleName());
            }
        }

        @Override
        public void onFailure(Throwable arg0) {

        }

    });
    final HorizontalPanel horPanel = new HorizontalPanel();
    horPanel.addStyleName("horizontalPanel");
    RootPanel.get().add(horPanel);
    ScreenMaskUtility.maskScreen(LocaleDictionary.getMessageValue(LoginMessages.LOADING));
    rpcService.getFooterProperties(new AsyncCallback<Map<String, String>>() {

        @Override
        public void onSuccess(Map<String, String> footerProperties) {
            footerText = footerProperties.get(CoreCommonConstants.FOOTER_TEXT_KEY);
            footerLink = footerProperties.get(CoreCommonConstants.FOOTER_LINK_KEY);
            final Anchor footerInfo = new Anchor(footerText, footerLink);
            horPanel.addStyleName("loginFooter");
            horPanel.add(footerInfo);
            horPanel.setCellHorizontalAlignment(footerInfo, HasHorizontalAlignment.ALIGN_CENTER);
            ScreenMaskUtility.unmaskScreen();
        }

        @Override
        public void onFailure(Throwable arg0) {
            ScreenMaskUtility.unmaskScreen();
            DialogUtil.showMessageDialog(LocaleDictionary.getConstantValue(LocaleCommonConstants.ERROR_TITLE),
                    LocaleDictionary.getMessageValue(LoginMessages.APPLICATION_NOT_AUTHORIZED),
                    DialogIcon.ERROR);
        }
    });
    RootPanel.get("error").getElement()
            .setInnerText(LocaleDictionary.getConstantValue(LoginConstants.INVALID_CREDENTIALS));
    RootPanel.get("error").addStyleName(FONT_RED_CSS);

    SubmitButton submitButton = new SubmitButton();
    //            (SubmitButton) SubmitButton.wrap(RootPanel.get("button").getElement());
    // submitButton.setFocus(true);

    submitButton.getElement().setTitle(LocaleDictionary.getConstantValue(LoginConstants.login_button_text));
    submitButton.getElement().setInnerHTML("<i class=\"icon-arrow-right icon-large\"></i>");
    submitButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            login();
        }
    });

    submitButton.setStyleName("gwt-Button");
    RootPanel.get("button").getElement().addClassName("submit");
    RootPanel.get("button").add(submitButton);

}

From source file:ilarkesto.gwt.client.Gwt.java

License:Open Source License

public static SubmitButton createInvisibleSubmitButton() {
    SubmitButton button = new SubmitButton();
    button.setVisible(false);
    return button;
}