Java Examples for com.google.gwt.user.client.ui.FormPanel

The following java examples will help you to understand the usage of com.google.gwt.user.client.ui.FormPanel. These source code samples are taken from different open source projects.

Example 1
Project: google-web-toolkit-svnmirror-master  File: FormPanel.java View source code
/**
   * Creates a FormPanel that wraps an existing <form> element.
   *
   * This element must already be attached to the document. If the element is
   * removed from the document, you must call
   * {@link RootPanel#detachNow(Widget)}.
   *
   * <p>
   * The specified form element's target attribute will not be set, and the
   * {@link FormSubmitCompleteEvent} will not be fired.
   * </p>
   *
   * @param element the element to be wrapped
   */
public static FormPanel wrap(Element element) {
    // Assert that the element is attached.
    assert Document.get().getBody().isOrHasChild(element);
    FormPanel formPanel = new FormPanel(element);
    // Mark it attached and remember it for cleanup.
    formPanel.onAttach();
    RootPanel.detachOnWindowClose(formPanel);
    return formPanel;
}
Example 2
Project: gwt-master  File: FormPanel.java View source code
/**
   * Creates a FormPanel that wraps an existing <form> element.
   *
   * This element must already be attached to the document. If the element is
   * removed from the document, you must call
   * {@link RootPanel#detachNow(Widget)}.
   *
   * <p>
   * The specified form element's target attribute will not be set, and the
   * {@link FormSubmitCompleteEvent} will not be fired.
   * </p>
   *
   * @param element the element to be wrapped
   */
public static FormPanel wrap(Element element) {
    // Assert that the element is attached.
    assert Document.get().getBody().isOrHasChild(element);
    FormPanel formPanel = new FormPanel(element);
    // Mark it attached and remember it for cleanup.
    formPanel.onAttach();
    RootPanel.detachOnWindowClose(formPanel);
    return formPanel;
}
Example 3
Project: gwt-sandbox-master  File: FormPanel.java View source code
/**
   * Creates a FormPanel that wraps an existing <form> element.
   *
   * This element must already be attached to the document. If the element is
   * removed from the document, you must call
   * {@link RootPanel#detachNow(Widget)}.
   *
   * <p>
   * The specified form element's target attribute will not be set, and the
   * {@link FormSubmitCompleteEvent} will not be fired.
   * </p>
   *
   * @param element the element to be wrapped
   */
public static FormPanel wrap(Element element) {
    // Assert that the element is attached.
    assert Document.get().getBody().isOrHasChild(element);
    FormPanel formPanel = new FormPanel(element);
    // Mark it attached and remember it for cleanup.
    formPanel.onAttach();
    RootPanel.detachOnWindowClose(formPanel);
    return formPanel;
}
Example 4
Project: gwt.svn-master  File: FormPanel.java View source code
/**
   * Creates a FormPanel that wraps an existing <form> element.
   *
   * This element must already be attached to the document. If the element is
   * removed from the document, you must call
   * {@link RootPanel#detachNow(Widget)}.
   *
   * <p>
   * The specified form element's target attribute will not be set, and the
   * {@link FormSubmitCompleteEvent} will not be fired.
   * </p>
   *
   * @param element the element to be wrapped
   */
public static FormPanel wrap(Element element) {
    // Assert that the element is attached.
    assert Document.get().getBody().isOrHasChild(element);
    FormPanel formPanel = new FormPanel(element);
    // Mark it attached and remember it for cleanup.
    formPanel.onAttach();
    RootPanel.detachOnWindowClose(formPanel);
    return formPanel;
}
Example 5
Project: scalagwt-gwt-master  File: FormPanel.java View source code
/**
   * Creates a FormPanel that wraps an existing <form> element.
   *
   * This element must already be attached to the document. If the element is
   * removed from the document, you must call
   * {@link RootPanel#detachNow(Widget)}.
   *
   * <p>
   * The specified form element's target attribute will not be set, and the
   * {@link FormSubmitCompleteEvent} will not be fired.
   * </p>
   *
   * @param element the element to be wrapped
   */
public static FormPanel wrap(Element element) {
    // Assert that the element is attached.
    assert Document.get().getBody().isOrHasChild(element);
    FormPanel formPanel = new FormPanel(element);
    // Mark it attached and remember it for cleanup.
    formPanel.onAttach();
    RootPanel.detachOnWindowClose(formPanel);
    return formPanel;
}
Example 6
Project: turmeric-policy-master  File: PolicyImportView.java View source code
@Override
public void initialize() {
    mainPanel.clear();
    TurmericStackPanel panel = new TurmericStackPanel();
    panel.setWidth("100%");
    VerticalPanel vp = new VerticalPanel();
    form = new FormPanel();
    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.setMethod(FormPanel.METHOD_POST);
    FileUploaderWidget.getFileUploaderWidget(form, PolicyAdminUIUtil.policyAdminConstants.policies());
    panel.add(form, PolicyAdminUIUtil.policyAdminConstants.importPolicyAction());
    vp.add(panel);
    vp.add(new Label(PolicyAdminUIUtil.policyAdminConstants.importConditionalFileMsg()));
    mainPanel.add(vp);
}
Example 7
Project: gwt-test-utils-master  File: BrowserTest.java View source code
@Test()
public void submit() {
    // Given
    final StringBuilder sb = new StringBuilder();
    FormPanel form = new FormPanel();
    form.addSubmitHandler(new SubmitHandler() {

        public void onSubmit(SubmitEvent event) {
            sb.append("onSubmit");
        }
    });
    form.addSubmitCompleteHandler(new SubmitCompleteHandler() {

        public void onSubmitComplete(SubmitCompleteEvent event) {
            sb.append(" complete : ").append(event.getResults());
        }
    });
    // Attach to the DOM
    RootPanel.get().add(form);
    // Given
    Browser.submit(form, "mock result");
    // Then
    assertThat(sb.toString()).isEqualTo("onSubmit complete : mock result");
}
Example 8
Project: droolsjbpm-master  File: AssetAttachmentFileWidget.java View source code
protected void initWidgets(final String uuid, String formName) {
    form = new FormPanel();
    form.setAction(GWT.getModuleBaseURL() + "asset");
    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.setMethod(FormPanel.METHOD_POST);
    FileUpload up = new FileUpload();
    up.setName(HTMLFileManagerFields.UPLOAD_FIELD_NAME_ATTACH);
    HorizontalPanel fields = new HorizontalPanel();
    fields.add(getHiddenField(HTMLFileManagerFields.FORM_FIELD_UUID, uuid));
    ok = new Button(constants.Upload());
    fields.add(up);
    fields.add(ok);
    form.add(fields);
    layout = new FormStyleLayout(getIcon(), formName);
    if (!this.asset.isreadonly)
        layout.addAttribute(constants.UploadNewVersion(), form);
    Button dl = new Button(constants.Download());
    dl.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            Window.open(GWT.getModuleBaseURL() + "asset?" + HTMLFileManagerFields.FORM_FIELD_UUID + "=" + uuid, "downloading", "resizable=no,scrollbars=yes,status=no");
        }
    });
    layout.addAttribute(constants.DownloadCurrentVersion(), dl);
    ok.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            showUploadingBusy();
            submitUpload();
        }
    });
    initWidget(layout);
    layout.setWidth("100%");
    this.setStyleName(getOverallStyleName());
}
Example 9
Project: onebusaway-application-modules-master  File: SearchWidget.java View source code
private void initializeWidget() {
    addStyleName(_css.SearchWidget());
    FormPanel form = new FormPanel();
    form.setAction("index.html");
    add(form);
    form.addSubmitHandler(new SubmitHandler() {

        public void onSubmit(SubmitEvent event) {
            event.cancel();
        }
    });
    FlowPanel panel = new FlowPanel();
    form.add(panel);
    DivPanel searchPanel = new DivPanel();
    searchPanel.addStyleName(_css.SearchWidgetSearchPanel());
    panel.add(searchPanel);
    DivPanel searchForPanel = new DivPanel();
    searchForPanel.addStyleName(_css.SearchWidgetSearchForPanel());
    searchPanel.add(searchForPanel);
    DivWidget queryLabel = new DivWidget("Search for:");
    queryLabel.addStyleName(_css.SearchWidgetLabel());
    searchForPanel.add(queryLabel);
    DivPanel queryTextBoxPanel = new DivPanel();
    queryTextBoxPanel.addStyleName(_css.SearchWidgetTextBoxPanel());
    searchForPanel.add(queryTextBoxPanel);
    _queryTextBox = new TextBox();
    _queryTextBox.addStyleName(_css.SearchWidgetTextBox());
    _queryTextBox.setName(ConstraintsParameterMapping.PARAM_QUERY);
    _queryTextBox.addKeyPressHandler(new QueryTextBoxHandler());
    queryTextBoxPanel.add(_queryTextBox);
    DivPanel searchForExamplePanel = new DivPanel();
    searchForExamplePanel.addStyleName(_css.SearchWidgetExamplePanel());
    searchForPanel.add(searchForExamplePanel);
    DivWidget searchForExampleLabel = new DivWidget("(ex. \"restaurants\", \"parks\", \"grocery stores\")");
    searchForExampleLabel.addStyleName(_css.SearchWidgetExampleLabel());
    searchForExamplePanel.add(searchForExampleLabel);
    DivPanel addressPanel = new DivPanel();
    searchPanel.add(addressPanel);
    DivPanel addressPanel1 = new DivPanel();
    addressPanel.add(addressPanel1);
    DivWidget addressLabel = new DivWidget("Start Address:");
    addressLabel.addStyleName(_css.SearchWidgetLabel());
    addressPanel1.add(addressLabel);
    DivPanel addressTextBoxPanel = new DivPanel();
    addressTextBoxPanel.addStyleName(_css.SearchWidgetTextBoxPanel());
    addressPanel1.add(addressTextBoxPanel);
    _addressTextBox = new TextBox();
    _addressTextBox.addStyleName(_css.SearchWidgetTextBox());
    _addressTextBox.setName(ConstraintsParameterMapping.PARAM_LOCATION);
    addressTextBoxPanel.add(_addressTextBox);
    DivPanel addressPanel2 = new DivPanel();
    addressPanel2.addStyleName(_css.SearchWidgetExamplePanel());
    addressPanel.add(addressPanel2);
    SpanWidget addressExampleLabel1 = new SpanWidget("(ex. \"3rd and pike\" or ");
    addressExampleLabel1.addStyleName(_css.SearchWidgetExampleLabel());
    addressPanel2.add(addressExampleLabel1);
    Anchor addressExampleLabel2 = new Anchor("use the map");
    addressExampleLabel2.addStyleName(_css.SearchWidgetExampleLabel());
    addressExampleLabel2.addClickHandler(new UseTheMapHandler());
    addressPanel2.add(addressExampleLabel2);
    SpanWidget addressExampleLabel3 = new SpanWidget(")");
    addressExampleLabel3.addStyleName(_css.SearchWidgetExampleLabel());
    addressPanel2.add(addressExampleLabel3);
    DivPanel buttonPanel = new DivPanel();
    buttonPanel.addStyleName(_css.SearchWidgetButtonPanel());
    searchPanel.add(buttonPanel);
    Button button = new Button("Go");
    buttonPanel.add(button);
    button.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent widget) {
            handleQuery();
        }
    });
    AddressTextBoxHandler handler = new AddressTextBoxHandler();
    _addressTextBox.addKeyPressHandler(handler);
    _addressTextBox.addFocusHandler(handler);
    _addressTextBox.addBlurHandler(handler);
    _optionsButton = new Anchor("Show More Options");
    _optionsButton.addStyleName(_css.SearchWidgetShowOptionsButton());
    _optionsButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent arg0) {
            toggleExpansion();
        // TODO : Refresh layout
        }
    });
    buttonPanel.add(_optionsButton);
    DivPanel clearPanel = new DivPanel();
    clearPanel.addStyleName(_css.ClearPanel());
    panel.add(clearPanel);
    Image hiddenPixel = new Image(CommonResources.INSTANCE.getHiddenPixel().getUrl());
    clearPanel.add(hiddenPixel);
    _optionsPanel = new DivPanel();
    _optionsPanel.addStyleName(_css.SearchWidgetOptionsPanel());
    _optionsPanel.setVisible(false);
    panel.add(_optionsPanel);
    Grid optionsGrid = new Grid(2, 4);
    optionsGrid.addStyleName(_css.SearchWidgetOptionsGrid());
    for (int i = 0; i < 4; i++) {
        optionsGrid.getCellFormatter().addStyleName(0, i, "SearchWidget-OptionsGrid-Column" + i);
        optionsGrid.getCellFormatter().addStyleName(1, i, "SearchWidget-OptionsGrid-Column" + i);
    }
    _optionsPanel.add(optionsGrid);
    SpanWidget timeLabel = new SpanWidget("Start Time:");
    optionsGrid.setWidget(0, 0, timeLabel);
    DivPanel dateAndTimePanel = new DivPanel();
    optionsGrid.setWidget(0, 1, dateAndTimePanel);
    _dateTextBox = new TextBox();
    _dateTextBox.addStyleName(_css.SearchWidgetStartDateTextBox());
    dateAndTimePanel.add(_dateTextBox);
    _timeTextBox = new TextBox();
    _timeTextBox.addStyleName(_css.SearchWidgetStartTimeTextBox());
    dateAndTimePanel.add(_timeTextBox);
    SpanWidget maxLengthLabel = new SpanWidget("Trip Time:");
    optionsGrid.setWidget(1, 0, maxLengthLabel);
    _maxTripLengthBox = new ListBox();
    _maxTripLengthBox.addItem("10 mins", "10");
    _maxTripLengthBox.addItem("15 mins", "15");
    _maxTripLengthBox.addItem("20 mins", "20");
    _maxTripLengthBox.addItem("30 mins", "30");
    _maxTripLengthBox.addItem("45 mins", "45");
    _maxTripLengthBox.addItem("1 hour", "60");
    _maxTripLengthBox.addStyleName(_css.SearchWidgetTripLengthList());
    optionsGrid.setWidget(1, 1, _maxTripLengthBox);
    SpanWidget maxTransfersLabel = new SpanWidget("Transfers:");
    optionsGrid.setWidget(0, 2, maxTransfersLabel);
    _maxTransfersListBox = new ListBox();
    _maxTransfersListBox.addItem("Don't Care", "-1");
    _maxTransfersListBox.addItem("0", "0");
    _maxTransfersListBox.addItem("1", "1");
    _maxTransfersListBox.addItem("2", "2");
    optionsGrid.setWidget(0, 3, _maxTransfersListBox);
    SpanWidget maxWalkLabel = new SpanWidget("Walk at most:");
    optionsGrid.setWidget(1, 2, maxWalkLabel);
    _maxWalkDistance = new ListBox();
    _maxWalkDistance.addItem("1/4 mile", "1320");
    _maxWalkDistance.addItem("1/2 mile", "2640");
    _maxWalkDistance.addItem("3/4 mile", "3960");
    _maxWalkDistance.addItem("1 mile", "5280");
    optionsGrid.setWidget(1, 3, _maxWalkDistance);
    DivPanel optionsPanelRowB = new DivPanel();
    _optionsPanel.add(optionsPanelRowB);
}
Example 10
Project: soundtransit-rds-master  File: SearchWidget.java View source code
private void initializeWidget() {
    addStyleName(_css.SearchWidget());
    FormPanel form = new FormPanel();
    form.setAction("index.html");
    add(form);
    form.addSubmitHandler(new SubmitHandler() {

        public void onSubmit(SubmitEvent event) {
            event.cancel();
        }
    });
    FlowPanel panel = new FlowPanel();
    form.add(panel);
    DivPanel searchPanel = new DivPanel();
    searchPanel.addStyleName(_css.SearchWidgetSearchPanel());
    panel.add(searchPanel);
    DivPanel searchForPanel = new DivPanel();
    searchForPanel.addStyleName(_css.SearchWidgetSearchForPanel());
    searchPanel.add(searchForPanel);
    DivWidget queryLabel = new DivWidget("Search for:");
    queryLabel.addStyleName(_css.SearchWidgetLabel());
    searchForPanel.add(queryLabel);
    DivPanel queryTextBoxPanel = new DivPanel();
    queryTextBoxPanel.addStyleName(_css.SearchWidgetTextBoxPanel());
    searchForPanel.add(queryTextBoxPanel);
    _queryTextBox = new TextBox();
    _queryTextBox.addStyleName(_css.SearchWidgetTextBox());
    _queryTextBox.setName(ConstraintsParameterMapping.PARAM_QUERY);
    _queryTextBox.addKeyPressHandler(new QueryTextBoxHandler());
    queryTextBoxPanel.add(_queryTextBox);
    DivPanel searchForExamplePanel = new DivPanel();
    searchForExamplePanel.addStyleName(_css.SearchWidgetExamplePanel());
    searchForPanel.add(searchForExamplePanel);
    DivWidget searchForExampleLabel = new DivWidget("(ex. \"restaurants\", \"parks\", \"grocery stores\")");
    searchForExampleLabel.addStyleName(_css.SearchWidgetExampleLabel());
    searchForExamplePanel.add(searchForExampleLabel);
    DivPanel addressPanel = new DivPanel();
    searchPanel.add(addressPanel);
    DivPanel addressPanel1 = new DivPanel();
    addressPanel.add(addressPanel1);
    DivWidget addressLabel = new DivWidget("Start Address:");
    addressLabel.addStyleName(_css.SearchWidgetLabel());
    addressPanel1.add(addressLabel);
    DivPanel addressTextBoxPanel = new DivPanel();
    addressTextBoxPanel.addStyleName(_css.SearchWidgetTextBoxPanel());
    addressPanel1.add(addressTextBoxPanel);
    _addressTextBox = new TextBox();
    _addressTextBox.addStyleName(_css.SearchWidgetTextBox());
    _addressTextBox.setName(ConstraintsParameterMapping.PARAM_LOCATION);
    addressTextBoxPanel.add(_addressTextBox);
    DivPanel addressPanel2 = new DivPanel();
    addressPanel2.addStyleName(_css.SearchWidgetExamplePanel());
    addressPanel.add(addressPanel2);
    SpanWidget addressExampleLabel1 = new SpanWidget("(ex. \"3rd and pike\" or ");
    addressExampleLabel1.addStyleName(_css.SearchWidgetExampleLabel());
    addressPanel2.add(addressExampleLabel1);
    Anchor addressExampleLabel2 = new Anchor("use the map");
    addressExampleLabel2.addStyleName(_css.SearchWidgetExampleLabel());
    addressExampleLabel2.addClickHandler(new UseTheMapHandler());
    addressPanel2.add(addressExampleLabel2);
    SpanWidget addressExampleLabel3 = new SpanWidget(")");
    addressExampleLabel3.addStyleName(_css.SearchWidgetExampleLabel());
    addressPanel2.add(addressExampleLabel3);
    DivPanel buttonPanel = new DivPanel();
    buttonPanel.addStyleName(_css.SearchWidgetButtonPanel());
    searchPanel.add(buttonPanel);
    Button button = new Button("Go");
    buttonPanel.add(button);
    button.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent widget) {
            handleQuery();
        }
    });
    AddressTextBoxHandler handler = new AddressTextBoxHandler();
    _addressTextBox.addKeyPressHandler(handler);
    _addressTextBox.addFocusHandler(handler);
    _addressTextBox.addBlurHandler(handler);
    _optionsButton = new Anchor("Show More Options");
    _optionsButton.addStyleName(_css.SearchWidgetShowOptionsButton());
    _optionsButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent arg0) {
            toggleExpansion();
        // TODO : Refresh layout
        }
    });
    buttonPanel.add(_optionsButton);
    DivPanel clearPanel = new DivPanel();
    clearPanel.addStyleName(_css.ClearPanel());
    panel.add(clearPanel);
    Image hiddenPixel = new Image(CommonResources.INSTANCE.getHiddenPixel().getUrl());
    clearPanel.add(hiddenPixel);
    _optionsPanel = new DivPanel();
    _optionsPanel.addStyleName(_css.SearchWidgetOptionsPanel());
    _optionsPanel.setVisible(false);
    panel.add(_optionsPanel);
    Grid optionsGrid = new Grid(2, 4);
    optionsGrid.addStyleName(_css.SearchWidgetOptionsGrid());
    for (int i = 0; i < 4; i++) {
        optionsGrid.getCellFormatter().addStyleName(0, i, "SearchWidget-OptionsGrid-Column" + i);
        optionsGrid.getCellFormatter().addStyleName(1, i, "SearchWidget-OptionsGrid-Column" + i);
    }
    _optionsPanel.add(optionsGrid);
    SpanWidget timeLabel = new SpanWidget("Start Time:");
    optionsGrid.setWidget(0, 0, timeLabel);
    DivPanel dateAndTimePanel = new DivPanel();
    optionsGrid.setWidget(0, 1, dateAndTimePanel);
    _dateTextBox = new TextBox();
    _dateTextBox.addStyleName(_css.SearchWidgetStartDateTextBox());
    dateAndTimePanel.add(_dateTextBox);
    _timeTextBox = new TextBox();
    _timeTextBox.addStyleName(_css.SearchWidgetStartTimeTextBox());
    dateAndTimePanel.add(_timeTextBox);
    SpanWidget maxLengthLabel = new SpanWidget("Trip Time:");
    optionsGrid.setWidget(1, 0, maxLengthLabel);
    _maxTripLengthBox = new ListBox();
    _maxTripLengthBox.addItem("10 mins", "10");
    _maxTripLengthBox.addItem("15 mins", "15");
    _maxTripLengthBox.addItem("20 mins", "20");
    _maxTripLengthBox.addItem("30 mins", "30");
    _maxTripLengthBox.addItem("45 mins", "45");
    _maxTripLengthBox.addItem("1 hour", "60");
    _maxTripLengthBox.addStyleName(_css.SearchWidgetTripLengthList());
    optionsGrid.setWidget(1, 1, _maxTripLengthBox);
    SpanWidget maxTransfersLabel = new SpanWidget("Transfers:");
    optionsGrid.setWidget(0, 2, maxTransfersLabel);
    _maxTransfersListBox = new ListBox();
    _maxTransfersListBox.addItem("Don't Care", "-1");
    _maxTransfersListBox.addItem("0", "0");
    _maxTransfersListBox.addItem("1", "1");
    _maxTransfersListBox.addItem("2", "2");
    optionsGrid.setWidget(0, 3, _maxTransfersListBox);
    SpanWidget maxWalkLabel = new SpanWidget("Walk at most:");
    optionsGrid.setWidget(1, 2, maxWalkLabel);
    _maxWalkDistance = new ListBox();
    _maxWalkDistance.addItem("1/4 mile", "1320");
    _maxWalkDistance.addItem("1/2 mile", "2640");
    _maxWalkDistance.addItem("3/4 mile", "3960");
    _maxWalkDistance.addItem("1 mile", "5280");
    optionsGrid.setWidget(1, 3, _maxWalkDistance);
    DivPanel optionsPanelRowB = new DivPanel();
    _optionsPanel.add(optionsPanelRowB);
}
Example 11
Project: opencms-core-master  File: CmsUploadDialogImpl.java View source code
/**
     * Creates a form that contains the file input fields and the target folder.<p>
     * 
     * @return the form
     */
private FormPanel createForm() {
    // create a form using the POST method and multipart MIME encoding
    FormPanel form = new FormPanel();
    form.setAction(getUploadUri());
    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.setMethod(FormPanel.METHOD_POST);
    // create a panel that contains the file input fields and the target folder
    FlowPanel inputFieldsPanel = new FlowPanel();
    int count = 0;
    for (CmsFileInput input : m_inputsToUpload.values()) {
        String filename = input.getFiles()[0].getFileName();
        String fieldName = "file_" + count++;
        input.setName(fieldName);
        if (getFilesToUpload().containsKey(filename)) {
            inputFieldsPanel.add(input);
        }
        addHiddenField(inputFieldsPanel, fieldName + I_CmsUploadConstants.UPLOAD_FILENAME_ENCODED_SUFFIX, URL.encode(filename));
    }
    for (String filename : getFilesToUnzip(false)) {
        addHiddenField(inputFieldsPanel, I_CmsUploadConstants.UPLOAD_UNZIP_FILES_FIELD_NAME, URL.encode(filename));
    }
    addHiddenField(inputFieldsPanel, I_CmsUploadConstants.UPLOAD_TARGET_FOLDER_FIELD_NAME, getTargetFolder());
    form.setWidget(inputFieldsPanel);
    return form;
}
Example 12
Project: opencms-master  File: CmsUploadDialogImpl.java View source code
/**
     * Creates a form that contains the file input fields and the target folder.<p>
     * 
     * @return the form
     */
private FormPanel createForm() {
    // create a form using the POST method and multipart MIME encoding
    FormPanel form = new FormPanel();
    form.setAction(getUploadUri());
    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.setMethod(FormPanel.METHOD_POST);
    // create a panel that contains the file input fields and the target folder
    FlowPanel inputFieldsPanel = new FlowPanel();
    int count = 0;
    for (CmsFileInput input : m_inputsToUpload.values()) {
        String filename = input.getFiles()[0].getFileName();
        String fieldName = "file_" + count++;
        input.setName(fieldName);
        if (getFilesToUpload().containsKey(filename)) {
            inputFieldsPanel.add(input);
        }
        addHiddenField(inputFieldsPanel, fieldName + I_CmsUploadConstants.UPLOAD_FILENAME_ENCODED_SUFFIX, URL.encode(filename));
    }
    for (String filename : getFilesToUnzip(false)) {
        addHiddenField(inputFieldsPanel, I_CmsUploadConstants.UPLOAD_UNZIP_FILES_FIELD_NAME, URL.encode(filename));
    }
    addHiddenField(inputFieldsPanel, I_CmsUploadConstants.UPLOAD_TARGET_FOLDER_FIELD_NAME, getTargetFolder());
    form.setWidget(inputFieldsPanel);
    return form;
}
Example 13
Project: FormDesigner-master  File: SaveFileDialog.java View source code
public void initWidgets(String url, String data, String fileName) {
    actionUrl = url;
    form.setAction(actionUrl);
    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.setMethod(FormPanel.METHOD_POST);
    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setSpacing(10);
    form.add(verticalPanel);
    txtArea = new TextArea();
    txtArea.setText(data);
    txtArea.setName("filecontents");
    txtArea.setVisible(false);
    txtName = new TextBox();
    txtName.setText(fileName);
    txtName.setName("filename");
    txtName.setWidth("250" + PurcConstants.UNITS);
    verticalPanel.add(txtName);
    verticalPanel.add(txtArea);
    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setWidth("100%");
    horizontalPanel.setHeight("100%");
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
    Button button = new Button(LocaleText.get("save"), new ClickHandler() {

        public void onClick(ClickEvent event) {
            String fileName = txtName.getText();
            if (fileName != null && fileName.trim().length() > 0) {
                String action = actionUrl;
                if (action.contains("?"))
                    action += "&";
                else
                    action += "?";
                action += "filename=" + fileName;
                form.setAction(action);
                ((VerticalPanel) txtName.getParent()).add(txtArea);
                form.submit();
                //hide();
                FormUtil.dlg.setText(LocaleText.get("processingMsg"));
                FormUtil.dlg.center();
            }
        }
    });
    horizontalPanel.add(button);
    horizontalPanel.setCellHorizontalAlignment(button, HasHorizontalAlignment.ALIGN_LEFT);
    button = new Button(LocaleText.get("cancel"), new ClickHandler() {

        public void onClick(ClickEvent event) {
            hide();
            FormUtil.dlg.hide();
        }
    });
    horizontalPanel.add(button);
    horizontalPanel.setCellHorizontalAlignment(button, HasHorizontalAlignment.ALIGN_RIGHT);
    verticalPanel.add(horizontalPanel);
    setWidget(form);
    form.addSubmitCompleteHandler(new SubmitCompleteHandler() {

        public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) {
            hide();
            FormUtil.dlg.hide();
            Window.Location.replace(form.getAction());
        }
    });
    setText(LocaleText.get("saveFileAs"));
}
Example 14
Project: ppj09_fd-master  File: UserForm.java View source code
public void onSubmitComplete(SubmitCompleteEvent event) {
    // When the form submission is successfully
    // completed, this event is
    // fired. Assuming the service returned a response
    // of type text/html,
    // we can get the result text here (see the
    // FormPanel documentation for
    // further explanation).
    MessageBox.alert(event.getResults());
    getuser();
    window.close();
}
Example 15
Project: jbpm-form-builder-master  File: RestyFormBuilderModel.java View source code
@Override
public void onSuccess(Method method, String response) {
    String fileName = helper.getFileName(response);
    FormPanel auxiliarForm = new FormPanel();
    auxiliarForm.setMethod(FormPanel.METHOD_GET);
    auxiliarForm.setAction(url);
    Hidden hidden1 = new Hidden("fileName");
    hidden1.setValue(fileName);
    Hidden hidden2 = new Hidden("formName");
    hidden2.setValue(form.getName() == null || "".equals(form.getName()) ? "template" : form.getName());
    VerticalPanel vPanel = new VerticalPanel();
    vPanel.add(hidden1);
    vPanel.add(hidden2);
    auxiliarForm.add(vPanel);
    RootPanel.get().add(auxiliarForm);
    auxiliarForm.submit();
}
Example 16
Project: ide-master  File: LocalZipImporterPagePresenterTest.java View source code
@Test
public void onImportClickedWhenShouldImportAndOpenProjectTest() {
    when(view.getProjectName()).thenReturn(PROJECT_NAME);
    MessageDialog dialog = mock(MessageDialog.class);
    when(dialogFactory.createMessageDialog(anyString(), anyString(), (ConfirmCallback) anyObject())).thenReturn(dialog);
    presenter.onImportClicked();
    verify(vfsServiceClient).getItemByPath(eq(PROJECT_NAME), callbackCaptorForItem.capture());
    AsyncRequestCallback<Item> itemCallback = callbackCaptorForItem.getValue();
    GwtReflectionUtils.callOnFailure(itemCallback, mock(Throwable.class));
    verify(dialogFactory, never()).createMessageDialog(anyString(), anyString(), (ConfirmCallback) anyObject());
    verify(dialog, never()).show();
    verify(importProjectNotificationSubscriber).subscribe(eq(PROJECT_NAME));
    verify(view).setEncoding(eq(FormPanel.ENCODING_MULTIPART));
    verify(view).setAction(anyString());
    verify(view).submit();
    verify(view).setLoaderVisibility(eq(true));
    verify(view).setInputsEnableState(eq(false));
}
Example 17
Project: cmestemp22-master  File: LoginDialogContent.java View source code
/**
     * Builds the UI.
     */
private void setupWidgets() {
    loginForm.setAction("/j_spring_security_check");
    loginForm.setMethod(FormPanel.METHOD_POST);
    loginContentContainer.addStyleName(StaticResourceBundle.INSTANCE.coreCss().loginContentContainer());
    FlowPanel loginPanel = new FlowPanel();
    loginPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().loginContent());
    loginForm.setWidget(loginPanel);
    FlowPanel navPanel = new FlowPanel();
    navPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().loginNavPanel());
    navPanel.add(errorMessage);
    loginContentContainer.add(navPanel);
    submitButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().loginButton());
    cancelButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().cancelButton());
    final FlowPanel usernamePanel = new FlowPanel();
    usernamePanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formElement());
    Label usernameLabel = new Label("Username: ");
    usernameLabel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formLabel());
    usernamePanel.add(usernameLabel);
    username.setName("j_username");
    usernamePanel.add(username);
    loginPanel.add(usernamePanel);
    final FlowPanel passwordPanel = new FlowPanel();
    Label passwordLabel = new Label("Password: ");
    passwordPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formElement());
    passwordLabel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formLabel());
    passwordPanel.add(passwordLabel);
    password.setName("j_password");
    passwordPanel.add(password);
    Hidden returnTo = new Hidden("spring-security-redirect", "/login.html");
    returnTo.setName("spring-security-redirect");
    loginPanel.add(returnTo);
    rememberMe.setName("_spring_security_remember_me");
    loginPanel.add(passwordPanel);
    loginPanel.add(rememberMe);
    errorMessage.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formErrorBox());
    errorMessage.setVisible(false);
    loginContentContainer.add(loginPanel);
    FlowPanel buttonPanel = new FlowPanel();
    buttonPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().loginButtonPanel());
    buttonPanel.add(submitButton);
    buttonPanel.add(cancelButton);
    loginContentContainer.add(buttonPanel);
    loginForm.add(loginContentContainer);
}
Example 18
Project: eurekastreams-master  File: LoginDialogContent.java View source code
/**
     * Builds the UI.
     */
private void setupWidgets() {
    loginForm.setAction("/j_spring_security_check");
    loginForm.setMethod(FormPanel.METHOD_POST);
    loginContentContainer.addStyleName(StaticResourceBundle.INSTANCE.coreCss().loginContentContainer());
    FlowPanel loginPanel = new FlowPanel();
    loginPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().loginContent());
    loginForm.setWidget(loginPanel);
    FlowPanel navPanel = new FlowPanel();
    navPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().loginNavPanel());
    navPanel.add(errorMessage);
    loginContentContainer.add(navPanel);
    submitButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().loginButton());
    cancelButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().cancelButton());
    final FlowPanel usernamePanel = new FlowPanel();
    usernamePanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formElement());
    Label usernameLabel = new Label("Username: ");
    usernameLabel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formLabel());
    usernamePanel.add(usernameLabel);
    username.setName("j_username");
    usernamePanel.add(username);
    loginPanel.add(usernamePanel);
    final FlowPanel passwordPanel = new FlowPanel();
    Label passwordLabel = new Label("Password: ");
    passwordPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formElement());
    passwordLabel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formLabel());
    passwordPanel.add(passwordLabel);
    password.setName("j_password");
    passwordPanel.add(password);
    Hidden returnTo = new Hidden("spring-security-redirect", "/login.html");
    returnTo.setName("spring-security-redirect");
    loginPanel.add(returnTo);
    loginPanel.add(passwordPanel);
    // rememberMe.setName("_spring_security_remember_me");
    // loginPanel.add(rememberMe);
    Hidden usePersistentLogon = new Hidden("_spring_security_remember_me", "on");
    usePersistentLogon.setName("_spring_security_remember_me");
    loginPanel.add(usePersistentLogon);
    errorMessage.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formErrorBox());
    errorMessage.setVisible(false);
    loginContentContainer.add(loginPanel);
    FlowPanel buttonPanel = new FlowPanel();
    buttonPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().loginButtonPanel());
    buttonPanel.add(submitButton);
    buttonPanel.add(cancelButton);
    loginContentContainer.add(buttonPanel);
    loginForm.add(loginContentContainer);
}
Example 19
Project: geo-platform-master  File: GPFileUploader.java View source code
@Override
public void onSubmitComplete(SubmitCompleteEvent event) {
    // When the form submission is successfully completed,
    // this event is fired. Assuming the service returned a
    // response of type text/html, we can get the result text here 
    // (see the FormPanel documentation for further explanation)
    htmlResult = event.getResults();
    System.out.println("HTML Result: " + htmlResult);
    //Execute this code only if the session is still alive
    if (htmlResult.contains("Session Timeout")) {
        GPHandlerManager.fireEvent(new GPLoginEvent(null));
    } else if (!htmlResult.contains("HTTP ERROR")) {
        formPanel.reset();
        htmlResult = htmlResult.replaceAll("<pre>", "");
        htmlResult = htmlResult.replaceAll("</pre>", "");
        htmlResult = htmlResult.replaceAll("<pre style=\"word-wrap: break-word; white-space: pre-wrap;\">", "");
        if (GPSharedUtils.isNotEmpty(htmlResult)) {
            //                                logger.info("HTMLResult: " + htmlResult);
            uploadEvent.setResult(htmlResult);
            GPHandlerManager.fireEvent(uploadEvent);
            //done.enable();
            //mapPreviewWidget.drawAoiOnMap(wkt);
            LayoutManager.getInstance().getStatusMap().setStatus(BasicWidgetConstants.INSTANCE.GPFileUploader_successStatusText(), EnumSearchStatus.STATUS_SEARCH.toString());
        } else {
            LayoutManager.getInstance().getStatusMap().setStatus(BasicWidgetConstants.INSTANCE.GPFileUploader_failedStatusText(), EnumSearchStatus.STATUS_NO_SEARCH.toString());
        }
    } else {
        GeoPlatformMessage.errorMessage(BasicWidgetConstants.INSTANCE.GPFileUploader_failedErrorMessageTitleText(), BasicWidgetConstants.INSTANCE.GPFileUploader_failedErrorGenericBodyText());
        LayoutManager.getInstance().getStatusMap().setStatus(BasicWidgetConstants.INSTANCE.GPFileUploader_failedStatusText(), EnumSearchStatus.STATUS_NO_SEARCH.toString());
    }
    uploaderProgressBar.hide();
}
Example 20
Project: incubator-wave-master  File: AttachmentPopupWidget.java View source code
@Override
public void onSubmitComplete(SubmitCompleteEvent event) {
    // When the form submission is successfully completed, this
    // event is fired. Assuming the service returned a response of type
    // text/html, we can get the result text here (see the FormPanel
    // documentation for further explanation).
    spinnerImg.setVisible(false);
    String results = event.getResults();
    if (results != null && results.contains("OK")) {
        status.setText("Done!");
        status.addStyleName(style.done());
        listener.onDone(waveRefStr, attachmentId.getId(), fileUpload.getFilename());
        hide();
    } else {
        status.setText("Error!");
        status.addStyleName(style.error());
    }
}
Example 21
Project: qafe-platform-master  File: BuiltinHandlerHelper.java View source code
public static Object getValue(UIObject uiObject, final UIObject sender, boolean idValueOnly, String groupName) {
    Object returnObject = null;
    if (uiObject instanceof QPagingScrollTable) {
        returnObject = getValue((QPagingScrollTable) uiObject, groupName);
    } else if (uiObject instanceof QRadioButton) {
        returnObject = getValue((QRadioButton) uiObject);
    } else if (uiObject instanceof HasData) {
        returnObject = getValue((HasData) uiObject);
    } else if (uiObject instanceof CheckBox) {
        returnObject = getValue((CheckBox) uiObject);
    } else if (uiObject instanceof FormPanel) {
        returnObject = getValue((FormPanel) uiObject);
    } else if (uiObject instanceof ListBox) {
        returnObject = getValue((ListBox) uiObject, idValueOnly);
    } else if (uiObject instanceof QDatePicker) {
        returnObject = getValue((QDatePicker) uiObject);
    } else if (uiObject instanceof HasText) {
        returnObject = getValue((HasText) uiObject);
    } else if (uiObject instanceof MapWidget) {
        returnObject = getValue((MapWidget) uiObject, sender);
    } else if (uiObject instanceof Image) {
        returnObject = getValue((Image) uiObject);
    } else if (uiObject instanceof ValueSpinner) {
        returnObject = getValue((ValueSpinner) uiObject);
    } else if (uiObject instanceof Tiles) {
        returnObject = getValue((Tiles) uiObject, sender);
    } else if (uiObject instanceof SliderBar) {
        returnObject = getValue((SliderBar) uiObject);
    } else if (isDataGridField(uiObject)) {
        returnObject = getDataGridValue(sender);
    }
    return returnObject;
}
Example 22
Project: rstudio-master  File: RemoteServerAuth.java View source code
private void safeCleanupPreviousUpdateCredentials() {
    try {
        for (int i = 0; i < previousUpdateCredentialsForms_.size(); i++) {
            FormPanel formPanel = previousUpdateCredentialsForms_.get(i);
            RootPanel.get().remove(formPanel);
        }
        previousUpdateCredentialsForms_.clear();
    } catch (Throwable e) {
    }
}
Example 23
Project: swellrt-master  File: AttachmentPopupWidget.java View source code
@Override
public void onSubmitComplete(SubmitCompleteEvent event) {
    // When the form submission is successfully completed, this
    // event is fired. Assuming the service returned a response of type
    // text/html, we can get the result text here (see the FormPanel
    // documentation for further explanation).
    spinnerImg.setVisible(false);
    String results = event.getResults();
    if (results != null && results.contains("OK")) {
        status.setText("Done!");
        status.addStyleName(style.done());
        listener.onDone(waveRefStr, attachmentId.getId(), fileUpload.getFilename());
        hide();
    } else {
        status.setText("Error!");
        status.addStyleName(style.error());
    }
}
Example 24
Project: Wave-master  File: AttachmentPopupWidget.java View source code
@Override
public void onSubmitComplete(SubmitCompleteEvent event) {
    // When the form submission is successfully completed, this
    // event is fired. Assuming the service returned a response of type
    // text/html, we can get the result text here (see the FormPanel
    // documentation for further explanation).
    spinnerImg.setVisible(false);
    String results = event.getResults();
    if (results != null && results.contains("OK")) {
        status.setText("Done!");
        status.addStyleName(style.done());
        listener.onDone(waveRefStr, attachmentId.getId(), fileUpload.getFilename());
        hide();
    } else {
        status.setText("Error!");
        status.addStyleName(style.error());
    }
}
Example 25
Project: WaveInCloud-master  File: AttachmentPopupWidget.java View source code
@Override
public void onSubmitComplete(SubmitCompleteEvent event) {
    // When the form submission is successfully completed, this
    // event is fired. Assuming the service returned a response of type
    // text/html, we can get the result text here (see the FormPanel
    // documentation for further explanation).
    spinnerImg.setVisible(false);
    String results = event.getResults();
    if (results != null && results.contains("OK")) {
        status.setText("Done!");
        status.addStyleName(style.done());
        listener.onDone(attachmentId.getId(), fileUpload.getFilename());
        hide();
    } else {
        status.setText("Error!");
        status.addStyleName(style.error());
    }
}
Example 26
Project: bonita-web-master  File: FileUploadWidget.java View source code
protected void createFileUploadForm(final String FileUloadName) {
    formPanel = new FormPanel();
    formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
    formPanel.setMethod(FormPanel.METHOD_POST);
    FormElement.as(formPanel.getElement()).setAcceptCharset("UTF-8");
    formPanel.setAction(RpcFormsServices.getFileUploadURL());
    fileUpload = addFileUploalToFormPanel(FileUloadName);
}
Example 27
Project: kura-master  File: ServerCertsTabUi.java View source code
private void initForm() {
    this.serverSslCertsForm.setAction(SERVLET_URL);
    this.serverSslCertsForm.setEncoding(com.google.gwt.user.client.ui.FormPanel.ENCODING_MULTIPART);
    this.serverSslCertsForm.setMethod(com.google.gwt.user.client.ui.FormPanel.METHOD_POST);
    StringBuilder title = new StringBuilder();
    title.append("<p>");
    title.append(MSGS.settingsAddCertDescription1());
    title.append(" ");
    title.append(MSGS.settingsAddCertDescription2());
    title.append("</p>");
    this.description.add(new Span(title.toString()));
    this.serverSslCertsForm.addSubmitCompleteHandler(new SubmitCompleteHandler() {

        @Override
        public void onSubmitComplete(SubmitCompleteEvent event) {
            ServerCertsTabUi.this.gwtXSRFService.generateSecurityToken(new AsyncCallback<GwtXSRFToken>() {

                @Override
                public void onFailure(Throwable ex) {
                    FailureHandler.handle(ex);
                    EntryClassUi.hideWaitModal();
                }

                @Override
                public void onSuccess(GwtXSRFToken token) {
                    ServerCertsTabUi.this.gwtCertificatesService.storeSSLPublicChain(token, ServerCertsTabUi.this.certificateInput.getValue(), ServerCertsTabUi.this.storageAliasInput.getValue(), new AsyncCallback<Integer>() {

                        @Override
                        public void onFailure(Throwable caught) {
                            FailureHandler.handle(caught);
                            EntryClassUi.hideWaitModal();
                        }

                        @Override
                        public void onSuccess(Integer certsStored) {
                            reset();
                            setDirty(false);
                            ServerCertsTabUi.this.apply.setEnabled(false);
                            ServerCertsTabUi.this.reset.setEnabled(false);
                            EntryClassUi.hideWaitModal();
                        }
                    });
                }
            });
        }
    });
    this.storageAliasLabel.setText(MSGS.settingsStorageAliasLabel());
    this.storageAliasInput.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            isAliasValid();
            setDirty(true);
            ServerCertsTabUi.this.apply.setEnabled(true);
            ServerCertsTabUi.this.reset.setEnabled(true);
        }
    });
    this.certificateLabel.setText(MSGS.settingsPublicCertLabel());
    this.certificateInput.setVisibleLines(20);
    this.certificateInput.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            isServerCertValid();
            setDirty(true);
            ServerCertsTabUi.this.apply.setEnabled(true);
            ServerCertsTabUi.this.reset.setEnabled(true);
        }
    });
    this.reset.setText(MSGS.reset());
    this.reset.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            reset();
            setDirty(false);
            ServerCertsTabUi.this.apply.setEnabled(false);
            ServerCertsTabUi.this.reset.setEnabled(false);
        }
    });
    this.apply.setText(MSGS.apply());
    this.apply.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (isValid()) {
                EntryClassUi.showWaitModal();
                ServerCertsTabUi.this.serverSslCertsForm.submit();
            }
        }
    });
}
Example 28
Project: appinventor-sources-master  File: Uploader.java View source code
@Override
public void onSubmitComplete(FormSubmitCompleteEvent event) {
    // When the form submission is successfully completed, this event is
    // fired. Assuming the service returned a response of type text/html,
    // we can get the result text here (see the FormPanel documentation for
    // further explanation).
    String results = event.getResults();
    // If the submit completely failed, results will be null.
    if (results == null) {
        callback.onFailure(new RuntimeException("Upload error"));
    } else {
        // results contains the UploadResponse value as a String. It was written on the server
        // side in the doPost method in ode/server/UploadServlet.java.
        UploadResponse uploadResponse = UploadResponse.extractUploadResponse(results);
        if (uploadResponse != null) {
            callback.onSuccess(uploadResponse);
        } else {
            callback.onFailure(new RuntimeException("Upload error"));
        }
    }
}
Example 29
Project: bi-platform-v2-master  File: ExecuteWAQRPreviewCommand.java View source code
protected void performOperation() {
    MantleTabPanel contentTabPanel = SolutionBrowserPerspective.getInstance().getContentTabPanel();
    //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    contentTabPanel.showNewURLTab(Messages.getString("preview"), Messages.getString("adhocPreview"), "about:blank", false);
    NamedFrame namedFrame = ((IFrameTabPanel) contentTabPanel.getWidget(contentTabPanel.getTabBar().getSelectedTab())).getFrame();
    final FormPanel form = new FormPanel(namedFrame);
    RootPanel.get().add(form);
    form.setMethod(FormPanel.METHOD_POST);
    form.setAction(url);
    //$NON-NLS-1$
    form.add(new Hidden("reportXml", xml));
    form.submit();
    ((IFrameTabPanel) contentTabPanel.getWidget(contentTabPanel.getTabBar().getSelectedTab())).setForm(form);
}
Example 30
Project: crux-master  File: FormPanelFactory.java View source code
@Override
public void instantiateWidget(SourcePrinter out, WidgetCreatorContext context) {
    String className = FormPanel.class.getCanonicalName();
    String target = context.readWidgetProperty("target");
    if (target != null && target.length() > 0) {
        out.println(className + " " + context.getWidget() + " = new " + className + "(" + EscapeUtils.quote(target) + ");");
    } else {
        out.println(className + " " + context.getWidget() + " = new " + className + "();");
    }
}
Example 31
Project: data-access-master  File: MetadataImportDialogController.java View source code
private void createWorkingForm() {
    if (formPanel == null) {
        formPanel = new FormPanel();
        formPanel.setMethod(FormPanel.METHOD_POST);
        formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
        formPanel.setAction(METADATA_IMPORT_URL);
        formPanel.getElement().getStyle().setProperty("position", "absolute");
        formPanel.getElement().getStyle().setProperty("visibility", "hidden");
        formPanel.getElement().getStyle().setProperty("overflow", "hidden");
        formPanel.getElement().getStyle().setProperty("clip", "rect(0px,0px,0px,0px)");
        mainFormPanel = new FlowPanel();
        formPanel.add(mainFormPanel);
        propertiesFileImportPanel = new FlowPanel();
        mainFormPanel.add(propertiesFileImportPanel);
        formDomainIdText = new TextBox();
        formDomainIdText.setName("domainId");
        mainFormPanel.add(formDomainIdText);
        metadataFileUpload = new FileUpload();
        metadataFileUpload.setName("metadataFile");
        metadataFileUpload.getElement().setId("metaFileUpload");
        metadataFileUpload.addChangeHandler(new ChangeHandler() {

            @Override
            public void onChange(ChangeEvent event) {
                String filename = ((FileUpload) event.getSource()).getFilename();
                if (filename != null && filename.trim().length() > 0) {
                    metaFileLocation.setValue(filename);
                    importDialogModel.setUploadedFile(filename);
                    acceptButton.setDisabled(!isValid());
                } else {
                    metaFileLocation.setValue(resBundle.getString("importDialog.SELECT_METAFILE_LABEL", "browse for metadata file"));
                    importDialogModel.setUploadedFile(null);
                    acceptButton.setDisabled(!isValid());
                }
            }
        });
        mainFormPanel.add(metadataFileUpload);
        VerticalPanel vp = (VerticalPanel) hiddenArea.getManagedObject();
        vp.add(formPanel);
    }
}
Example 32
Project: geomajas-project-client-gwt2-master  File: DefaultPrintRequestHandler.java View source code
private void createHiddenForm(PrintFinishedInfo info) {
    final FormPanel panel;
    switch(info.getPostPrintAction()) {
        case SAVE:
            panel = new FormPanel();
            break;
        case OPEN:
        default:
            panel = new FormPanel("_blank");
            break;
    }
    panel.setVisible(false);
    panel.setPixelSize(0, 0);
    panel.setAction(info.getUrl());
    panel.setMethod(FormPanel.METHOD_POST);
    FlowPanel fieldsPanel = new FlowPanel();
    panel.add(fieldsPanel);
    for (String name : info.getParams().keySet()) {
        fieldsPanel.add(new Hidden(name, info.getParams().get(name)));
    }
    panel.getElement().getStyle().setPosition(Style.Position.ABSOLUTE);
    panel.getElement().getStyle().setBorderWidth(0, Style.Unit.PX);
    RootPanel.get().add(panel);
    panel.submit();
}
Example 33
Project: pentaho-platform-master  File: ExecuteUrlInNewTabCommand.java View source code
protected void performOperation() {
    MantleTabPanel contentTabPanel = SolutionBrowserPanel.getInstance().getContentTabPanel();
    //$NON-NLS-1$
    contentTabPanel.showNewURLTab(this.tabName, this.tabToolTip, "about:blank", false);
    NamedFrame namedFrame = ((IFrameTabPanel) contentTabPanel.getSelectedTab().getContent()).getFrame();
    final FormPanel form = new FormPanel(namedFrame);
    RootPanel.get().add(form);
    form.setMethod(FormPanel.METHOD_POST);
    form.setAction(url);
    //$NON-NLS-1$
    form.add(new Hidden("reportXml", URL.encode(xml)));
    form.submit();
    ((IFrameTabPanel) contentTabPanel.getSelectedTab().getContent()).setForm(form);
}
Example 34
Project: socialpm-master  File: NewProjectViewImpl.java View source code
@Override
public void setup() {
    name.getElement().setAttribute("placeholder", "Project name...");
    FormPanel form = new FormPanel();
    HeroPanel hero = new HeroPanel();
    hero.setHeading("Start a new Project");
    hero.setContent("What do you call your project?");
    HorizontalPanel panel = new HorizontalPanel();
    panel.add(name);
    hero.getUnder().add(panel);
    create.addStyleName("btn btn-primary btn-large");
    hero.addAction(create);
    form.add(hero);
    content.add(form);
    setupInputs();
}
Example 35
Project: test-rebase-strategy-master  File: UploadFileEntryPoint.java View source code
public void onModuleLoad() {
    // Create a FormPanel and point it at a service.
    final FormPanel uploadForm = new FormPanel();
    uploadForm.setAction(GWT.getModuleBaseURL() + "/UploadService");
    // Because we're going to add a FileUpload widget, we'll need to set the
    // form to use the POST method, and multipart MIME encoding.
    uploadForm.setEncoding(FormPanel.ENCODING_MULTIPART);
    uploadForm.setMethod(FormPanel.METHOD_POST);
    // Create a panel to hold all of the form widgets.
    VerticalPanel panel = new VerticalPanel();
    uploadForm.setWidget(panel);
    // Create a TextBox, giving it a name so that it will be submitted.
    final TextBox tb = new TextBox();
    tb.setName("textBoxFormElement");
    panel.add(tb);
    // Create a FileUpload widget.
    FileUpload upload = new FileUpload();
    upload.setName("uploadFormElement");
    panel.add(upload);
    // Add a 'Upload' button.
    Button uploadSubmitButton = new Button("Upload");
    panel.add(uploadSubmitButton);
    uploadSubmitButton.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            uploadForm.submit();
        }
    });
    uploadForm.addFormHandler(new FormHandler() {

        public void onSubmit(FormSubmitEvent event) {
        }

        public void onSubmitComplete(FormSubmitCompleteEvent event) {
            Window.alert(event.getResults());
        }
    });
    RootPanel.get().add(uploadForm);
}
Example 36
Project: aokp-gerrit-master  File: NewAgreementScreen.java View source code
@Override
protected void onInitUI() {
    super.onInitUI();
    setPageTitle(Util.C.newAgreement());
    final FlowPanel formBody = new FlowPanel();
    radios = new VerticalPanel();
    formBody.add(radios);
    agreementGroup = new FlowPanel();
    agreementGroup.add(new SmallHeading(Util.C.newAgreementReviewLegalHeading()));
    agreementHtml = new HTML();
    agreementHtml.setStyleName(Gerrit.RESOURCES.css().contributorAgreementLegal());
    agreementGroup.add(agreementHtml);
    formBody.add(agreementGroup);
    contactGroup = new FlowPanel();
    contactGroup.add(new SmallHeading(Util.C.newAgreementReviewContactHeading()));
    formBody.add(contactGroup);
    finalGroup = new VerticalPanel();
    finalGroup.add(new SmallHeading(Util.C.newAgreementCompleteHeading()));
    final FlowPanel fp = new FlowPanel();
    yesIAgreeBox = new NpTextBox();
    yesIAgreeBox.setVisibleLength(Util.C.newAgreementIAGREE().length() + 8);
    yesIAgreeBox.setMaxLength(Util.C.newAgreementIAGREE().length());
    fp.add(yesIAgreeBox);
    fp.add(new InlineLabel(Util.M.enterIAGREE(Util.C.newAgreementIAGREE())));
    finalGroup.add(fp);
    submit = new Button(Util.C.buttonSubmitNewAgreement());
    submit.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            doSign();
        }
    });
    finalGroup.add(submit);
    formBody.add(finalGroup);
    new OnEditEnabler(submit, yesIAgreeBox);
    final FormPanel form = new FormPanel();
    form.add(formBody);
    add(form);
}
Example 37
Project: Bam-master  File: FileUploadEditorView.java View source code
private void initFormPanel() {
    formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
    formPanel.setMethod(FormPanel.METHOD_POST);
    formPanel.setWidget(fileUpload);
    formPanel.addSubmitHandler(new FormPanel.SubmitHandler() {

        @Override
        public void onSubmit(final FormPanel.SubmitEvent event) {
            final boolean isFireEvent = presenter.onSubmit();
            if (!isFireEvent) {
                event.cancel();
            }
        }
    });
    formPanel.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {

        @Override
        public void onSubmitComplete(final FormPanel.SubmitCompleteEvent event) {
            presenter.onSubmitComplete(event.getResults());
        }
    });
}
Example 38
Project: dashbuilder-master  File: FileUploadEditorView.java View source code
private void initFormPanel() {
    formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
    formPanel.setMethod(FormPanel.METHOD_POST);
    formPanel.setWidget(fileUpload);
    formPanel.addSubmitHandler(new FormPanel.SubmitHandler() {

        @Override
        public void onSubmit(final FormPanel.SubmitEvent event) {
            final boolean isFireEvent = presenter.onSubmit();
            if (!isFireEvent) {
                event.cancel();
            }
        }
    });
    formPanel.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {

        @Override
        public void onSubmitComplete(final FormPanel.SubmitCompleteEvent event) {
            presenter.onSubmitComplete(event.getResults());
        }
    });
}
Example 39
Project: framework-master  File: LoginFormConnector.java View source code
@Override
protected void init() {
    super.init();
    loginFormRpc = getRpcProxy(LoginFormRpc.class);
    getWidget().addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {

        @Override
        public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) {
            valuesChanged();
            loginFormRpc.submitCompleted();
        }
    });
}
Example 40
Project: gerrit-master  File: NewAgreementScreen.java View source code
@Override
protected void onInitUI() {
    super.onInitUI();
    setPageTitle(Util.C.newAgreement());
    final FlowPanel formBody = new FlowPanel();
    radios = new VerticalPanel();
    formBody.add(radios);
    agreementGroup = new FlowPanel();
    agreementGroup.add(new SmallHeading(Util.C.newAgreementReviewLegalHeading()));
    agreementHtml = new HTML();
    agreementHtml.setStyleName(Gerrit.RESOURCES.css().contributorAgreementLegal());
    agreementGroup.add(agreementHtml);
    formBody.add(agreementGroup);
    finalGroup = new VerticalPanel();
    finalGroup.add(new SmallHeading(Util.C.newAgreementCompleteHeading()));
    final FlowPanel fp = new FlowPanel();
    yesIAgreeBox = new NpTextBox();
    yesIAgreeBox.setVisibleLength(Util.C.newAgreementIAGREE().length() + 8);
    yesIAgreeBox.setMaxLength(Util.C.newAgreementIAGREE().length());
    fp.add(yesIAgreeBox);
    fp.add(new InlineLabel(Util.M.enterIAGREE(Util.C.newAgreementIAGREE())));
    finalGroup.add(fp);
    submit = new Button(Util.C.buttonSubmitNewAgreement());
    submit.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            doSign();
        }
    });
    finalGroup.add(submit);
    formBody.add(finalGroup);
    new OnEditEnabler(submit, yesIAgreeBox);
    final FormPanel form = new FormPanel();
    form.add(formBody);
    add(form);
}
Example 41
Project: kie-wb-common-master  File: AttachmentFileWidget.java View source code
void setup(boolean addFileUpload) {
    up = createUploadWidget(addFileUpload);
    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.setMethod(FormPanel.METHOD_POST);
    formEncoder.addUtf8Charset(form);
    // Validation is not performed in a SubmitHandler as it fails to be invoked with GWT-Bootstrap3. See:-
    // - https://issues.jboss.org/browse/GUVNOR-2302 and
    // - the underlying cause https://github.com/gwtbootstrap3/gwtbootstrap3/issues/375
    // Validation is now performed prior to the form being submitted.
    form.addSubmitCompleteHandler(new Form.SubmitCompleteHandler() {

        @Override
        public void onSubmitComplete(final Form.SubmitCompleteEvent event) {
            if ("OK".equalsIgnoreCase(event.getResults())) {
                executeCallback(successCallback);
                showMessage(CommonConstants.INSTANCE.UploadSuccess());
            } else {
                executeCallback(errorCallback);
                if (event.getResults().contains("org.uberfire.java.nio.file.FileAlreadyExistsException")) {
                    showMessage(org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants.INSTANCE.ExceptionFileAlreadyExists0(fieldFileName.getText()));
                } else if (event.getResults().contains("DecisionTableParseException")) {
                    showMessage(CommonConstants.INSTANCE.UploadGenericError());
                } else {
                    showMessage(org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants.INSTANCE.ExceptionGeneric0(event.getResults()));
                }
            }
            reset();
        }
    });
    fields.add(up);
    fields.add(fieldFilePath);
    fields.add(fieldFileName);
    fields.add(fieldFileFullPath);
    fields.add(fieldFileOperation);
    form.add(fields);
    initWidget(form);
}
Example 42
Project: Kornell-master  File: GenericInstitutionAssetsView.java View source code
private FlowPanel buildFileUploadPanel(final String fileName, final String contentType, String label) {
    // Create a FormPanel and point it at a service
    final FormPanel form = new FormPanel();
    final String elementId = fileName.replace('.', '-');
    // Create a panel to hold all of the form widgets
    FlowPanel fieldPanelWrapper = new FlowPanel();
    fieldPanelWrapper.addStyleName("fieldPanelWrapper fileUploadPanel");
    form.setWidget(fieldPanelWrapper);
    // Create the label panel
    FlowPanel labelPanel = new FlowPanel();
    labelPanel.addStyleName("labelPanel");
    Label lblLabel = new Label(label);
    lblLabel.addStyleName("lblLabel");
    labelPanel.add(lblLabel);
    fieldPanelWrapper.add(labelPanel);
    // Create the FileUpload component
    FlowPanel fileUploadPanel = new FlowPanel();
    FileUpload fileUpload = new FileUpload();
    fileUpload.setName("uploadFormElement");
    fileUpload.setId(elementId);
    fileUploadPanel.add(fileUpload);
    fieldPanelWrapper.add(fileUpload);
    // Add a submit button to the form
    Button btnOK = new Button("Atualizar");
    btnOK.addStyleName("btnAction btnStandard");
    btnOK.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            String test = fileName.replace(".", "%2E");
            session.institution(institution.getUUID()).getUploadURL(test, new Callback<String>() {

                @Override
                public void ok(String url) {
                    getFile(elementId, contentType, url);
                }
            });
        }
    });
    fieldPanelWrapper.add(btnOK);
    Anchor anchor = new Anchor();
    anchor.setHTML("<icon class=\"fa fa-eye\"></i>");
    anchor.setTitle("Visualizar");
    anchor.setHref(StringUtils.mkurl(institution.getBaseURL(), "repository", institution.getAssetsRepositoryUUID(), fileName));
    anchor.setTarget("_blank");
    fieldPanelWrapper.add(anchor);
    return fieldPanelWrapper;
}
Example 43
Project: mini-git-server-master  File: NewAgreementScreen.java View source code
@Override
protected void onInitUI() {
    super.onInitUI();
    setPageTitle(Util.C.newAgreement());
    final FlowPanel formBody = new FlowPanel();
    radios = new VerticalPanel();
    formBody.add(radios);
    agreementGroup = new FlowPanel();
    agreementGroup.add(new SmallHeading(Util.C.newAgreementReviewLegalHeading()));
    agreementHtml = new HTML();
    agreementHtml.setStyleName(Gerrit.RESOURCES.css().contributorAgreementLegal());
    agreementGroup.add(agreementHtml);
    formBody.add(agreementGroup);
    contactGroup = new FlowPanel();
    contactGroup.add(new SmallHeading(Util.C.newAgreementReviewContactHeading()));
    formBody.add(contactGroup);
    finalGroup = new VerticalPanel();
    finalGroup.add(new SmallHeading(Util.C.newAgreementCompleteHeading()));
    final FlowPanel fp = new FlowPanel();
    yesIAgreeBox = new NpTextBox();
    yesIAgreeBox.setVisibleLength(Util.C.newAgreementIAGREE().length() + 8);
    yesIAgreeBox.setMaxLength(Util.C.newAgreementIAGREE().length());
    fp.add(yesIAgreeBox);
    fp.add(new InlineLabel(Util.M.enterIAGREE(Util.C.newAgreementIAGREE())));
    finalGroup.add(fp);
    submit = new Button(Util.C.buttonSubmitNewAgreement());
    submit.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            doSign();
        }
    });
    finalGroup.add(submit);
    formBody.add(finalGroup);
    new OnEditEnabler(submit, yesIAgreeBox);
    final FormPanel form = new FormPanel();
    form.add(formBody);
    add(form);
}
Example 44
Project: PonySDK-master  File: PTFileUpload.java View source code
@Override
protected FormPanel createUIObject() {
    fileUpload = new FileUpload();
    fileUploadId = DOM.createUniqueId();
    fileUpload.getElement().setPropertyString("id", fileUploadId);
    final FormPanel formPanel = new FormPanel();
    formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
    formPanel.setMethod(FormPanel.METHOD_POST);
    container = new FlowPanel();
    container.add(fileUpload);
    formPanel.setWidget(container);
    formPanel.addSubmitCompleteHandler( event -> {
        final PTInstruction instruction = new PTInstruction(objectID);
        instruction.put(ClientToServerModel.HANDLER_SUBMIT_COMPLETE);
        uiBuilder.sendDataToServer(uiObject, instruction);
    });
    return formPanel;
}
Example 45
Project: tools_gerrit-master  File: NewAgreementScreen.java View source code
@Override
protected void onInitUI() {
    super.onInitUI();
    setPageTitle(Util.C.newAgreement());
    final FlowPanel formBody = new FlowPanel();
    radios = new VerticalPanel();
    formBody.add(radios);
    agreementGroup = new FlowPanel();
    agreementGroup.add(new SmallHeading(Util.C.newAgreementReviewLegalHeading()));
    agreementHtml = new HTML();
    agreementHtml.setStyleName(Gerrit.RESOURCES.css().contributorAgreementLegal());
    agreementGroup.add(agreementHtml);
    formBody.add(agreementGroup);
    contactGroup = new FlowPanel();
    contactGroup.add(new SmallHeading(Util.C.newAgreementReviewContactHeading()));
    formBody.add(contactGroup);
    finalGroup = new VerticalPanel();
    finalGroup.add(new SmallHeading(Util.C.newAgreementCompleteHeading()));
    final FlowPanel fp = new FlowPanel();
    yesIAgreeBox = new NpTextBox();
    yesIAgreeBox.setVisibleLength(Util.C.newAgreementIAGREE().length() + 8);
    yesIAgreeBox.setMaxLength(Util.C.newAgreementIAGREE().length());
    fp.add(yesIAgreeBox);
    fp.add(new InlineLabel(Util.M.enterIAGREE(Util.C.newAgreementIAGREE())));
    finalGroup.add(fp);
    submit = new Button(Util.C.buttonSubmitNewAgreement());
    submit.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            doSign();
        }
    });
    finalGroup.add(submit);
    formBody.add(finalGroup);
    new TextSaveButtonListener(yesIAgreeBox, submit);
    final FormPanel form = new FormPanel();
    form.add(formBody);
    add(form);
}
Example 46
Project: uberfire-master  File: MediaLibraryWidget.java View source code
@PostConstruct
public void init() {
    fileUpload = createFileUpload();
    initWidget(uiBinder.createAndBindUi(this));
    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.setMethod(FormPanel.METHOD_POST);
    formEncoder.addUtf8Charset(form);
    form.addSubmitHandler(new AbstractForm.SubmitHandler() {

        @Override
        public void onSubmit(final AbstractForm.SubmitEvent event) {
            final String fileName = fileUpload.getFilename();
            if (isNullOrEmpty(fileName)) {
                event.cancel();
            }
        }

        private boolean isNullOrEmpty(final String fileName) {
            return fileName == null || "".equals(fileName);
        }
    });
    form.addSubmitCompleteHandler(new AbstractForm.SubmitCompleteHandler() {

        @Override
        public void onSubmitComplete(final AbstractForm.SubmitCompleteEvent event) {
            if ("OK".equalsIgnoreCase(event.getResults())) {
                Window.alert("Upload Success");
            } else if ("FAIL".equalsIgnoreCase(event.getResults())) {
                Window.alert("Upload Failed");
            } else if ("FAIL - ALREADY EXISTS".equalsIgnoreCase(event.getResults())) {
                Window.alert("File already exists");
            }
        }
    });
}
Example 47
Project: vaadin-master  File: LoginFormConnector.java View source code
@Override
protected void init() {
    super.init();
    loginFormRpc = getRpcProxy(LoginFormRpc.class);
    getWidget().addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {

        @Override
        public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) {
            valuesChanged();
            loginFormRpc.submitCompleted();
        }
    });
}
Example 48
Project: HTML5-Player-deprecated-master  File: Html5Player.java View source code
//##########################################################################
public void onModuleLoad() {
    mainPanel.add(rotateLeftButton);
    mainPanel.add(rotateRightButton);
    final String projectFileUrl = Window.Location.getParameter("projectfileurl");
    final String projectNumber = Window.Location.getParameter("projectnumber");
    if (projectFileUrl != null) {
        mainPanel.add(rePlayButton);
        mainPanel.add(zoomInButton);
        mainPanel.add(zoomOutButton);
        mainPanel.add(screenPanel);
    } else {
        if (projectNumber == null) {
            //			mainPanel.add(playButton);
            //			playButton.ensureDebugId("playButton");
            //
            //			mainPanel.add(projectListBox);
            //			playButton.ensureDebugId("projectListBox");
            //
            //			mainPanel.add(showLogButton);
            //			showLogButton.ensureDebugId("showLogBox");
            //
            //			mainPanel.add(screenPanel);
            //			screenPanel.add(logBox);
            mainPanel.add(rePlayButton);
            mainPanel.add(zoomInButton);
            mainPanel.add(zoomOutButton);
            VerticalPanel panel = new VerticalPanel();
            //create a file upload widget
            final FileUpload fileUpload = new FileUpload();
            //create upload button
            //pass action to the form to point to service handling file
            //receiving operation.
            form.setAction(GWT.getModuleBaseURL() + "fileupload");
            // set form to use the POST method, and multipart MIME encoding.
            form.setEncoding(FormPanel.ENCODING_MULTIPART);
            form.setMethod(FormPanel.METHOD_POST);
            fileUpload.setName("uploadFormElement");
            panel.add(fileUpload);
            //add a button to upload the file
            panel.add(uploadButton);
            uploadButton.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    //get the filename to be uploaded
                    String filename = fileUpload.getFilename();
                    if (filename.length() == 0) {
                        Window.alert("No File Specified!");
                    } else {
                        form.submit();
                    }
                }
            });
            form.add(panel);
            mainPanel.add(uploadLabel);
            mainPanel.add(form);
            mainPanel.add(screenPanel);
        } else {
            mainPanel.add(rePlayButton);
            mainPanel.add(zoomInButton);
            mainPanel.add(zoomOutButton);
            mainPanel.add(screenPanel);
        }
    }
    if (Scene.get().createScene() == false) {
        //TODO exception  if canvas not supported?
        CatrobatDebug.error("Canvas not supported");
        return;
    }
    rootCanvas = Scene.get().getCanvas();
    screenPanel.add(rootCanvas);
    rootCanvas.ensureDebugId("rootCanvas");
    //populateProjectsListBox();
    RootPanel.get("firstWindow").add(mainPanel);
    final Stage stage = Stage.getInstance();
    stage.setCanvas(rootCanvas);
    stage.setLogBox(logBox);
    stage.defaultLogBoxSettings();
    server = new ServerConnectionCalls();
    playButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            rotationAngle = 0;
            rotateDirection(0, screenPanel);
            CatrobatDebug.info("Play button was clicked, project: " + projectNumber + " is selected");
            stage.clearStage();
            stage.displayLoadingImage();
            stage.setProjectNumber(projectNumber);
            //get xml-projectfile from server
            server.getXML(projectNumber);
        }
    });
    form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {

        @Override
        public void onSubmitComplete(SubmitCompleteEvent event) {
            //Window.alert(event.getResults());
            rotationAngle = 0;
            rotateDirection(0, screenPanel);
            //int selectedIndex = projectListBox.getSelectedIndex();
            //String projectNumber = projectListBox.getValue(selectedIndex);
            stage.clearStage();
            stage.displayLoadingImage();
            stage.setProjectNumber(projectNumber);
            server.getXML();
        }
    });
    //handle click on the log-button
    //
    showLogButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            logBox.setVisible(!logBox.isVisible());
        }
    });
    //handle click on the rotateLeft-button
    //
    rotateLeftButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            rotateLeft(screenPanel);
        }
    });
    //handle click on the rotateRight-button
    //
    rotateRightButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            rotateRight(screenPanel);
        }
    });
    //handle click on the replay-button
    //
    rePlayButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            stage.clearStage();
            stage.displayLoadingImage();
            stage.setProjectNumber(projectNumber);
            if (projectNumber != null) {
                server.getXML(projectNumber);
            } else {
                server.getXML();
            }
        }
    });
    //handle click on the zoomIn-button
    //
    zoomInButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            double twice = 2;
            Scene.get().zoomScene(twice);
        }
    });
    //handle click on the zoomOut-button
    //
    zoomOutButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            double half = 0.5;
            Scene.get().zoomScene(half);
        }
    });
    //handle click on the canvas
    //
    rootCanvas.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            stage.getSpriteManager().handleScreenClick(getRelativeXforRotation(event.getRelativeX(rootCanvas.getCanvasElement()), event.getRelativeY(rootCanvas.getCanvasElement()), screenPanel), getRelativeYforRotation(event.getRelativeX(rootCanvas.getCanvasElement()), event.getRelativeY(rootCanvas.getCanvasElement()), screenPanel));
        }
    });
    if (projectFileUrl != null) {
        stage.clearStage();
        stage.displayLoadingImage();
        server.getXMLFromProjectFileUrl(projectFileUrl);
    }
}
Example 49
Project: RUSSEL-master  File: EPSSScreen.java View source code
@Override
public void onEvent(Event event) {
    saveProject0();
    ESBPacket postData = new ESBPacket();
    FormPanel fp = ((FormPanel) PageAssembler.elementToWidget("epssExportSCORMForm", PageAssembler.FORM));
    fp.setAction(RusselApi.getESBActionURL("zipResources"));
    fp.setMethod(CommunicationHub.POST);
    fp.setEncoding(FormPanel.ENCODING_MULTIPART);
    postData.put("sessionid", RusselApi.sessionId);
    JSONArray ja = new JSONArray();
    int c = 0;
    for (String key : currentProject.getAssets().keySet()) ja.set(c++, new JSONString(key));
    ja.set(c++, new JSONString(currentProject.getGuid()));
    postData.put("resourcemetadata", ja);
    postData.put("resourceid", currentProject.getTitle().replaceAll(" ", "_") + ".zip");
    ((Hidden) PageAssembler.elementToWidget("epssExportSCORMPayload", PageAssembler.HIDDEN)).setValue(postData.toString());
    ((Hidden) PageAssembler.elementToWidget("epssExportImsmanifestPayload", PageAssembler.HIDDEN)).setValue(SCORMTemplates.INSTANCE.getImsmanifest().getText());
    ((Hidden) PageAssembler.elementToWidget("epssExportInitPagePayload", PageAssembler.HIDDEN)).setValue(SCORMTemplates.INSTANCE.getInitPage().getText());
    fp.addSubmitHandler(new SubmitHandler() {

        @Override
        public void onSubmit(SubmitEvent event) {
            StatusHandler.createMessage(StatusHandler.getZipExportMessageDone(currentProject.getTitle().replaceAll(" ", "_") + ".zip"), StatusRecord.ALERT_SUCCESS);
            RootPanel.get("epssDownloadArea").clear();
            PageAssembler.closePopup("exportProjectModal");
        }
    });
    fp.submit();
    RootPanel.get("epssDownloadArea").add(new Image("images/orbit/loading.gif"));
}
Example 50
Project: roda-master  File: RestUtils.java View source code
public static <T extends IsIndexed> void requestCSVExport(Class<T> classToReturn, Filter filter, Sorter sorter, Sublist sublist, Facets facets, boolean onlyActive, boolean exportFacets, String filename) {
    // api/v1/index/findFORM?type=csv
    String url = RodaConstants.API_REST_V1_INDEX + "findFORM";
    FindRequest request = new FindRequest(classToReturn.getName(), filter, sorter, sublist, facets, onlyActive, exportFacets, filename);
    final FormPanel form = new FormPanel();
    form.setAction(URL.encode(url));
    form.setMethod(FormPanel.METHOD_POST);
    form.setEncoding(FormPanel.ENCODING_URLENCODED);
    FlowPanel layout = new FlowPanel();
    form.setWidget(layout);
    layout.add(new Hidden("findRequest", FIND_REQUEST_MAPPER.write(request)));
    layout.add(new Hidden("type", "csv"));
    form.setVisible(false);
    RootPanel.get().add(form);
    // using submit instead of submit completed because Chrome doesn't created
    // the other event
    form.addSubmitHandler(new SubmitHandler() {

        @Override
        public void onSubmit(SubmitEvent event) {
            Timer timer = new Timer() {

                @Override
                public void run() {
                    RootPanel.get().remove(form);
                }
            };
            // remove form 10 seconds in the future
            timer.schedule(10000);
        }
    });
    form.submit();
}
Example 51
Project: activityinfo-master  File: ImageUploadRow.java View source code
private void upload() {
    imageContainer.setVisible(true);
    downloadButton.setVisible(false);
    if (oldHandler != null)
        oldHandler.removeHandler();
    oldHandler = formPanel.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {

        @Override
        public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) {
            // what about fail results?
            String responseString = event.getResults();
            imageContainer.setVisible(false);
            downloadButton.setVisible(true);
            thumbnail.setVisible(true);
            thumbnail.setUrl(buildThumbnailUrl());
        }
    });
    formPanel.submit();
}
Example 52
Project: avro-ui-master  File: MainActivity.java View source code
private void bind(final EventBus eventBus) {
    final FormConstructorView schemaConstructor = view.getSchemaConstructorView();
    registrations.add(schemaConstructor.getGenerateRecordButton().addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            doGenerateRecordForm();
        }
    }));
    registrations.add(schemaConstructor.getShowJsonButton().addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            showSchemaJson();
            schemaConstructor.fireChanged();
        }
    }));
    registrations.add(schemaConstructor.getUploadJSONButton().addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            uploadSchemaFromJson();
        }
    }));
    registrations.add(schemaConstructor.getUploadFileForm().addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {

        @Override
        public void onSubmitComplete(FormPanel.SubmitCompleteEvent submitCompleteEvent) {
            String result = submitCompleteEvent.getResults();
            if ("".equals(result)) {
                view.setErrorMessage(Utils.constants.uploadEmptyFileError());
            } else {
                schemaConstructor.setFormJson(result);
            }
        }
    }));
    registrations.add(schemaConstructor.getDownloadJsonButton().addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            String json = schemaConstructor.getFormJson().getValue();
            AvroUiSandbox.getAvroUiSandboxService().uploadJsonToFile(json, new BusyAsyncCallback<String>() {

                @Override
                public void onSuccessImpl(String result) {
                    ServletHelper.downloadJsonSchema(result);
                }

                @Override
                public void onFailureImpl(Throwable caught) {
                    view.setErrorMessage(Utils.getErrorMessage(caught));
                }
            });
        }
    }));
    final FormConstructorView recordConstructor = view.getRecordConstructorView();
    registrations.add(recordConstructor.getShowJsonButton().addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            showRecordJson();
            recordConstructor.fireChanged();
        }
    }));
    registrations.add(recordConstructor.getUploadJSONButton().addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            uploadRecordFromJson();
        }
    }));
    registrations.add(recordConstructor.getUploadFileForm().addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {

        @Override
        public void onSubmitComplete(FormPanel.SubmitCompleteEvent submitCompleteEvent) {
            String result = submitCompleteEvent.getResults();
            if ("".equals(result)) {
                view.setErrorMessage(Utils.constants.uploadEmptyFileError());
            } else {
                recordConstructor.setFormJson(result);
            }
        }
    }));
    registrations.add(recordConstructor.getDownloadJsonButton().addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            String json = recordConstructor.getFormJson().getValue();
            AvroUiSandbox.getAvroUiSandboxService().uploadJsonToFile(json, new BusyAsyncCallback<String>() {

                @Override
                public void onSuccessImpl(String result) {
                    ServletHelper.downloadJsonRecord(result);
                }

                @Override
                public void onFailureImpl(Throwable caught) {
                    view.setErrorMessage(Utils.getErrorMessage(caught));
                }
            });
        }
    }));
    registrations.add(clientFactory.getHeaderView().getResetButton().addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            view.reset();
            loadEmptySchemaForm();
        }
    }));
    view.reset();
    loadEmptySchemaForm();
}
Example 53
Project: guvnor-master  File: UploadFormViewImpl.java View source code
private Form doUploadForm() {
    form.setAction(getWebContext() + "/maven2wb");
    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.setMethod(FormPanel.METHOD_POST);
    form.setType(FormType.HORIZONTAL);
    /*
         * After upgrade of GWT-BOOTSTRAP3 version, will be needed to register
         * org.gwtbootstrap3.client.ui.Form.SubmitHandler
         */
    form.addHandler(new FormPanel.SubmitHandler() {

        @Override
        public void onSubmit(com.google.gwt.user.client.ui.FormPanel.SubmitEvent submitEvent) {
            presenter.handleSubmit(submitEvent);
        }
    }, FormPanel.SubmitEvent.getType());
    form.addSubmitCompleteHandler(new Form.SubmitCompleteHandler() {

        public void onSubmitComplete(final Form.SubmitCompleteEvent event) {
            presenter.handleSubmitComplete(event);
        }
    });
    uploader = new FileUpload(new Command() {

        @Override
        public void execute() {
            form.submit();
        }
    });
    uploader.setName(HTMLFileManagerFields.UPLOAD_FIELD_NAME_ATTACH);
    hiddenGroupIdField.setName(HTMLFileManagerFields.GROUP_ID);
    hiddenArtifactIdField.setName(HTMLFileManagerFields.ARTIFACT_ID);
    hiddenVersionIdField.setName(HTMLFileManagerFields.VERSION_ID);
    form.addAttribute("File", uploader);
    groupIdItem = form.addAttribute("Group ID", hiddenGroupIdField);
    artifactIdItem = form.addAttribute("Artifact ID", hiddenArtifactIdField);
    versionIdItem = form.addAttribute("Version ID", hiddenVersionIdField);
    hideGAVInputs();
    return form;
}
Example 54
Project: iambookmaster-master  File: RemotePanel.java View source code
public void execute() {
    setFrameWindowName(frame.getElement(), framName);
    formElements.clear();
    form.setAction(currentRequest.getUrl());
    form.setMethod(currentRequest.isPost() ? FormPanel.METHOD_POST : FormPanel.METHOD_GET);
    form.setEncoding(FormPanel.ENCODING_URLENCODED);
    final HashMap<String, String> params = currentRequest.getParameters();
    if (params != null && params.size() > 0) {
        addParameters(params, CALLBACK_BASE64);
    } else {
        addParameter(FIELD_CALLBACK, CALLBACK_BASE64);
    }
    if (currentRequest.isWaitForAnswer()) {
        //wait for answer
        timeoutChecher = new Timer() {

            @Override
            public void run() {
                String name;
                try {
                    name = getFrameWindowName(frame.getElement());
                    if (framName.equals(name)) {
                    //nothing
                    } else if (name.length() > 0) {
                        //found
                        timeoutChecher.cancel();
                        parseAnswer(name);
                    }
                } catch (Throwable e) {
                }
            }
        };
        timeoutChecher.scheduleRepeating(300);
    } else {
        listener.success();
    }
    form.submit();
}
Example 55
Project: ovirt-engine-master  File: ConsoleModel.java View source code
public static void makeConsoleConfigRequest(String fileName, String contentType, String configFileContent) {
    final FlowPanel innerPanel = new FlowPanel();
    //$NON-NLS-1$
    innerPanel.add(buildTextArea("contenttype", contentType));
    //$NON-NLS-1$
    innerPanel.add(buildTextArea("content", URL.encodeQueryString(configFileContent)));
    //$NON-NLS-1$ $NON-NLS-2$
    innerPanel.add(buildTextArea("encodingtype", "plain"));
    //$NON-NLS-1$
    final FormPanel formPanel = new FormPanel();
    formPanel.setMethod(FormPanel.METHOD_POST);
    //$NON-NLS-1$
    formPanel.getElement().setId("conform" + Double.valueOf(Math.random()).toString());
    formPanel.setWidget(innerPanel);
    formPanel.setAction(GET_ATTACHMENT_SERVLET_URL + fileName);
    formPanel.setEncoding(FormPanel.ENCODING_URLENCODED);
    formPanel.setVisible(false);
    // clean-up after form submit
    formPanel.addSubmitCompleteHandler( event -> RootPanel.get().remove(formPanel));
    RootPanel.get().add(formPanel);
    FormElement.as(formPanel.getElement()).submit();
}
Example 56
Project: RichWebClient-master  File: VMultipleUpload.java View source code
/**
	 * Initializes this {@link Widget}.
	 * 
	 * @param buttonStyleName The style of the upload button
	 */
private void initUpload(String buttonStyleName) {
    timer = new Timer() {

        @Override
        public void run() {
            applicationConnection.sendPendingVariableChanges();
        }
    };
    fileUpload = new FileUpload();
    fileUpload.addStyleName("outside-screen");
    button = new VButton();
    if (buttonStyleName != null && !buttonStyleName.equals("")) {
        button.addStyleName(button.getStylePrimaryName() + "-" + buttonStyleName);
        button.addStyleName(buttonStyleName);
    }
    button.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            fireNativeClick(fileUpload.getElement());
        }
    });
    FormPanel formPanel = new FormPanel();
    formPanel.add(fileUpload);
    wrapperPanel.add(button);
    wrapperPanel.add(formPanel);
}
Example 57
Project: tocollege.net-master  File: LoginWindow.java View source code
private void setupForm() {
    form = new FormPanel();
    form.setAction(Interactive.getRelativeURL(SECURITY_URL));
    form.setMethod(FormPanel.METHOD_POST);
    // Create a panel to hold all of the form widgets.
    VerticalPanel panel = new VerticalPanel();
    DecoratedTabPanel tabs = new DecoratedTabPanel();
    tabs.add(getOpenIDTab(), "OpenID");
    tabs.add(getUPTab(), "Username/Password");
    tabs.selectTab(1);
    panel.add(tabs);
    messageLabel = new Label("");
    panel.add(messageLabel);
    form.addFormHandler(new FormHandler() {

        // note, this doesn't need to be perfectly secure. We just
        // want to know that we think we're secure. The next request
        // will tell us for sure
        public void onSubmitComplete(FormSubmitCompleteEvent event) {
            Log.debug("submit event results " + event.getResults());
            if (event.getResults().equals("OK")) {
                success();
            } else {
                Log.warn("Login Fail: " + event.getResults());
                failure();
            }
        // // TODO parse bad password etc. Super-Fragile string
        // comps
        // if (event.getResults() == null
        // || -1 != event.getResults().indexOf(
        // "not successful")
        // || -1 != event.getResults().indexOf(
        // "Bad credentials")
        // || -1 != event.getResults().indexOf("404")) {
        // Log.warn("Login Fail: " + event.getResults());
        // failure();
        // } else {
        // Log.info("Login Success");
        // Log.debug(event.getResults());
        // success();
        // }
        }

        public void onSubmit(FormSubmitEvent event) {
            Log.debug("submit to " + form.getAction());
            // This event is fired just before the form is submitted.
            // We can take
            // this opportunity to perform validation.
            // if (username.getText().length() == 0) {
            // AlertDialog.alert("Username cannot be empty");
            // event.setCancelled(true);
            // }
            // if (password.getText().length() == 0) {
            // AlertDialog.alert("Password cannot be empty");
            // event.setCancelled(true);
            // }
            lastNameEntered = username.getText();
        }
    });
    form.setWidget(panel);
}
Example 58
Project: m3s-master  File: InsertMedia.java View source code
/**
	 * 
	 * Inits the upload images servlet service and the graphical elements
	 */
private void initUploadWidget() {
    uploadForm = new FormPanel();
    uploadForm.setAction(GWT.getModuleBaseURL() + "uploadFile");
    uploadForm.setEncoding(FormPanel.ENCODING_MULTIPART);
    uploadForm.setMethod(FormPanel.METHOD_POST);
    uploadInternalPanel = new VerticalPanel();
    uploadForm.setWidget(uploadInternalPanel);
    // Create a FileUpload widget.
    uploadWidget = new FileUpload();
    uploadWidget.setName("uploadFormElement");
    uploadInternalPanel.add(uploadWidget);
    main.add(uploadForm, multimediaPathDiv);
    // Add a 'upload' button.
    uploadButton = new Button("Subir", new ClickListener() {

        public void onClick(Widget sender) {
            uploadForm.submit();
        }
    });
    main.add(uploadButton, uploadBrowseAgainDiv);
    // uploadForm.addFormHandler(this);
    uploadForm.addFormHandler(new FormHandler() {

        public void onSubmit(FormSubmitEvent event) {
            // This is what happens when the file starts the upload
            submitingMediaFile();
        }

        public void onSubmitComplete(FormSubmitCompleteEvent event) {
            // This is what happens when the file finish uploading
            mediaFileSubmited(event);
        }
    });
}
Example 59
Project: hive-mrc-master  File: Indexer.java View source code
private void initialize() {
    this.deleteFile = new HorizontalPanel();
    this.isFileUploaded = false;
    this.isURL = false;
    uploadPopup = new PopupPanel(false);
    uploadPopup.addStyleName("upload-popup");
    uploadPopup.setGlassEnabled(true);
    Label uploading = new Label(messages.indexer_uploadingMessage());
    uploading.setHeight("100%");
    uploadPopup.add(uploading);
    openedVocabularies = new ArrayList<String>();
    selectedConcepts = new ArrayList<ConceptProxy>();
    indexingSteps = new FlowPanel();
    indexingSteps.addStyleName("indexing-steps");
    final HTML steps = new HTML(messages.indexer_pageDesc() + "<br>" + "<ul><li>" + messages.indexer_step1() + "</li>" + "<li>" + messages.indexer_step2() + "</li>" + "<li>" + messages.indexer_step3() + "</li></ul>");
    indexingSteps.add(steps);
    indexingCaption = new CaptionPanel(messages.indexer_indexerLabel());
    indexingCaption.addStyleName("indexing-Caption");
    indexingTable = new FlexTable();
    this.configure = new HorizontalPanel();
    configure.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    SimplePanel configureWrapper = new SimplePanel();
    configureWrapper.setStyleName("configure");
    final Label lb1 = new Label(messages.indexer_selectVocab());
    final HTML step1 = new HTML("<img src = './img/step1.png'/>");
    HorizontalPanel hp1 = new HorizontalPanel();
    hp1.add(step1);
    hp1.add(lb1);
    hp1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hp1.setCellVerticalAlignment(lb1, HasVerticalAlignment.ALIGN_MIDDLE);
    hp1.setCellVerticalAlignment(step1, HasVerticalAlignment.ALIGN_MIDDLE);
    lb1.addStyleName("label");
    indexingTable.setWidget(0, 0, hp1);
    indexingTable.setWidget(0, 1, configure);
    indexingTable.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE);
    indexingTable.getCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE);
    addVocabularyPanel = new FlowPanel();
    addVocabularyPanel.setSize("200px", "150px");
    this.displayOpenedVocabularies();
    this.initVocabulariesMenu();
    final FormPanel form = new FormPanel();
    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.setMethod(FormPanel.METHOD_POST);
    form.setAction("/FileUpload");
    HorizontalPanel uploadholder = new HorizontalPanel();
    final FileUpload upload = new FileUpload();
    upload.setName("uploadFormElement");
    form.add(upload);
    Button uploadButton = new Button(messages.indexer_uploadButton());
    uploadButton.addStyleName("upload-button");
    uploadholder.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    uploadholder.setCellVerticalAlignment(uploadButton, HasVerticalAlignment.ALIGN_TOP);
    uploadholder.addStyleName("uploadholder");
    uploadholder.add(form);
    uploadholder.add(uploadButton);
    uploadButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent e) {
            form.submit();
        }
    });
    form.addSubmitHandler(new FormPanel.SubmitHandler() {

        public void onSubmit(SubmitEvent event) {
            // Window.alert(path);
            if (upload.getFilename().length() == 0) {
                Window.alert(messages.indexer_uploadMessage());
                event.cancel();
            } else {
                uploadPopup.center();
                uploadPopup.show();
            }
        }
    });
    form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {

        public void onSubmitComplete(SubmitCompleteEvent event) {
            String result = event.getResults();
            if (result.contains("success")) {
                uploadPopup.hide();
                if (isFileUploaded = true) {
                    deleteFile.clear();
                    deleteFile.removeFromParent();
                }
                String response = result.substring(result.indexOf("|") + 1, result.lastIndexOf("?"));
                String[] fileNames = response.split("\\|");
                fileName = fileNames[0];
                tempFileName = fileNames[1];
                isFileUploaded = true;
                Label filename = new Label(fileName);
                // Window.alert(fileName);
                final PushButton delete = new PushButton(new Image("./img/cancel-upld.gif"));
                deleteFile.add(delete);
                deleteFile.add(filename);
                indexingTable.insertRow(2);
                indexingTable.setWidget(2, 1, deleteFile);
                delete.addClickHandler(new ClickHandler() {

                    @Override
                    public void onClick(ClickEvent event) {
                        // TODO Auto-generated method stub
                        isFileUploaded = false;
                        deleteFile.removeFromParent();
                    }
                });
            }
        }
    });
    Label lb3 = new Label(messages.indexer_uploadLabel());
    lb3.addStyleName("label");
    HorizontalPanel hp2 = new HorizontalPanel();
    final HTML step2 = new HTML("<img src = './img/step2.png'/>");
    hp2.add(step2);
    hp2.add(lb3);
    hp2.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hp2.setCellVerticalAlignment(lb3, HasVerticalAlignment.ALIGN_MIDDLE);
    hp2.setCellVerticalAlignment(step2, HasVerticalAlignment.ALIGN_MIDDLE);
    indexingTable.setWidget(1, 0, hp2);
    indexingTable.setWidget(1, 1, uploadholder);
    indexingTable.getCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_MIDDLE);
    indexingTable.getCellFormatter().setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_MIDDLE);
    final FlowPanel logoPanel = new FlowPanel();
    Label powered = new Label(messages.indexer_poweredBy());
    HTML kea = new HTML("<a class = 'kea' href='http://www.nzdl.org/Kea/index.html' target = '_blank'><img src = './img/kea_logo.gif'/></a>", true);
    logoPanel.add(powered);
    logoPanel.add(kea);
    HTML lb4 = new HTML(messages.indexer_enterURL(), false);
    lb4.addStyleName("or-label");
    lb4.addStyleName("label");
    indexingTable.setWidget(2, 0, lb4);
    final TextBox docURL = new TextBox();
    docURL.setWidth("300px");
    docURL.addStyleName("docURL");
    indexingTable.setCellSpacing(0);
    indexingTable.setWidget(2, 1, docURL);
    final DisclosurePanelImages images = (DisclosurePanelImages) GWT.create(DisclosurePanelImages.class);
    class DisclosurePanelHeader extends HorizontalPanel {

        public DisclosurePanelHeader(boolean isOpen, String html) {
            add(isOpen ? images.disclosurePanelOpen().createImage() : images.disclosurePanelClosed().createImage());
            add(new HTML(html));
        }
    }
    final DisclosurePanel advancedPanel = new DisclosurePanel(messages.indexer_showAdvancedSettings());
    advancedPanel.addCloseHandler(new CloseHandler<DisclosurePanel>() {

        @Override
        public void onClose(CloseEvent<DisclosurePanel> event) {
            advancedPanel.setHeader(new DisclosurePanelHeader(false, messages.indexer_showAdvancedSettings()));
        }
    });
    advancedPanel.addOpenHandler(new OpenHandler<DisclosurePanel>() {

        @Override
        public void onOpen(OpenEvent<DisclosurePanel> event) {
            advancedPanel.setHeader(new DisclosurePanelHeader(true, messages.indexer_hideAdvancedSettings()));
        }
    });
    // Create the algorithm selection listbox and panel
    final ListBox algSel = new ListBox();
    algSel.addItem("Maui");
    algSel.addItem("KEA");
    algSel.addItem("dummy");
    Label algSelLbl = new Label();
    algSelLbl.setText("  " + messages.indexer_algorithm());
    algSelLbl.addStyleName("label");
    HorizontalPanel algSelPanel = new HorizontalPanel();
    algSelPanel.setStyleName("advanced-subpanel");
    algSelPanel.add(algSel);
    algSelPanel.add(algSelLbl);
    algSelPanel.setTitle(messages.indexer_algorithmDesc());
    // Create the max hops listbox and panel
    final ListBox maxHops = new ListBox();
    maxHops.addItem("0");
    maxHops.addItem("1");
    maxHops.addItem("2");
    maxHops.addItem("3");
    maxHops.addItem("4");
    maxHops.addItem("5");
    maxHops.setStyleName("max-hops");
    Label maxHopsLbl = new Label();
    maxHopsLbl.setText("  " + messages.indexer_numHops());
    maxHopsLbl.addStyleName("label");
    HorizontalPanel maxHopsPanel = new HorizontalPanel();
    maxHopsPanel.setStyleName("advanced-subpanel");
    maxHopsPanel.add(maxHops);
    maxHopsPanel.add(maxHopsLbl);
    maxHopsPanel.setTitle(messages.indexer_numHopsDesc());
    // Create max terms listbox and panel
    final ListBox maxTerms = new ListBox();
    maxTerms.addItem("5");
    maxTerms.addItem("10");
    maxTerms.addItem("15");
    maxTerms.addItem("20");
    maxTerms.setItemSelected(1, true);
    maxTerms.setStyleName("max-hops");
    Label maxTermsLbl = new Label();
    maxTermsLbl.setText("  " + messages.indexer_numTerms());
    maxTermsLbl.addStyleName("label");
    HorizontalPanel maxTermsPanel = new HorizontalPanel();
    maxTermsPanel.setStyleName("advanced-subpanel");
    maxTermsPanel.add(maxTerms);
    maxTermsPanel.add(maxTermsLbl);
    maxTermsPanel.setTitle(messages.indexer_numTermsTip());
    // Create minoccur listbox and panel
    final ListBox minOccur = new ListBox();
    minOccur.addItem("1");
    minOccur.addItem("2");
    minOccur.setItemSelected(1, true);
    minOccur.setStyleName("max-hops");
    Label minOccurLbl = new Label();
    minOccurLbl.setText("  " + messages.indexer_minOccur());
    minOccurLbl.addStyleName("label");
    HorizontalPanel minOccurPanel = new HorizontalPanel();
    minOccurPanel.setStyleName("advanced-subpanel");
    minOccurPanel.add(minOccur);
    minOccurPanel.add(minOccurLbl);
    minOccurPanel.setTitle(messages.indexer_minOccurTip());
    final CheckBox diffCb = new CheckBox();
    Label diffLbl = new Label();
    diffLbl.setText(" " + messages.indexer_diffOnly());
    diffLbl.setStyleName("label");
    HorizontalPanel diffPanel = new HorizontalPanel();
    diffPanel.setStyleName("advanced-subpanel");
    diffPanel.add(diffCb);
    diffPanel.add(diffLbl);
    diffPanel.setTitle(messages.indexer_diffOnlyTip());
    VerticalPanel vp = new VerticalPanel();
    vp.add(algSelPanel);
    vp.add(maxHopsPanel);
    vp.add(maxTermsPanel);
    vp.add(minOccurPanel);
    vp.add(diffPanel);
    advancedPanel.add(vp);
    advancedPanel.setStyleName("advanced-panel");
    advancedPanel.setWidth("300px");
    indexingTable.setWidget(3, 1, advancedPanel);
    Button startProcessing = new Button(messages.indexer_startButton());
    startProcessing.setStyleName("start-processing");
    final HTML step3 = new HTML("<img src = './img/step3.png'/>");
    indexingTable.setWidget(0, 2, step3);
    indexingTable.setWidget(1, 2, startProcessing);
    indexingTable.getFlexCellFormatter().setHorizontalAlignment(1, 2, HasHorizontalAlignment.ALIGN_RIGHT);
    indexingTable.setWidget(2, 2, logoPanel);
    indexingTable.getFlexCellFormatter().addStyleName(0, 2, "border-left");
    indexingTable.getFlexCellFormatter().addStyleName(1, 2, "border-left-increase");
    indexingTable.getFlexCellFormatter().addStyleName(2, 2, "border-left-increase2");
    startProcessing.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            // TODO Auto-generated method stub
            boolean isValid = false;
            String url = docURL.getValue();
            String algorithm = algSel.getValue(algSel.getSelectedIndex());
            int hops = Integer.parseInt(maxHops.getValue(maxHops.getSelectedIndex()));
            int terms = Integer.parseInt(maxTerms.getValue(maxTerms.getSelectedIndex()));
            int minoccur = Integer.parseInt(minOccur.getValue(minOccur.getSelectedIndex()));
            boolean diff = diffCb.getValue();
            if (openedVocabularies.isEmpty()) {
                Window.alert(messages.indexer_selectVocabMessage());
            } else if (isFileUploaded == true && url.equals("")) {
                fileToProcess = tempFileName;
                isValid = true;
            } else if (isFileUploaded == false && !url.equals("")) {
                if (!url.startsWith("http://") && !url.startsWith("https://"))
                    url = "http://" + url;
                fileToProcess = url;
                isValid = true;
            } else if (isFileUploaded == true && !url.equals("")) {
                Window.alert(messages.indexer_uploadOrUrlError());
            } else if (isFileUploaded == false && url.equals("")) {
                Window.alert(messages.indexer_uploadOrUrlMessage());
            }
            if (isValid == true) {
                final PopupPanel processingPopup = new PopupPanel();
                final Label processing = new Label(messages.indexer_processingMessagej());
                processingPopup.addStyleName("z-index");
                processingPopup.add(processing);
                processingPopup.setGlassEnabled(true);
                processingPopup.center();
                processingPopup.show();
                indexerService.getTags(fileToProcess, openedVocabularies, hops, terms, diff, minoccur, algorithm, new AsyncCallback<List<ConceptProxy>>() {

                    @Override
                    public void onFailure(Throwable caught) {
                        Window.alert(messages.indexer_errorMessage());
                        caught.printStackTrace();
                        processingPopup.hide();
                    }

                    @Override
                    public void onSuccess(List<ConceptProxy> result) {
                        // TODO Auto-generated method stub
                        processingPopup.hide();
                        displayResult(result);
                    }
                });
            }
        }
    });
    for (int i = 0; i < indexingTable.getRowCount(); i++) {
        indexingTable.getCellFormatter().addStyleName(i, 0, "indexing-table-prompt");
        indexingTable.getCellFormatter().addStyleName(i, 1, "indexing-table-control");
        if (i <= 2) {
            indexingTable.getRowFormatter().addStyleName(i, "indexing-table-operation");
        }
    }
    indexingTable.addStyleName("indexing-table");
    indexingCaption.add(indexingTable);
    resultDock = new DockPanel();
    resultDock.addStyleName("result-Dock");
    resultDock.add(indexingSteps, DockPanel.NORTH);
    resultDock.add(indexingCaption, DockPanel.CENTER);
    RootPanel.get("indexer").add(resultDock);
// test RootPanel.get("indexer").add(indexingCaption);
}
Example 60
Project: knowledge_vault-master  File: FancyFileUpload.java View source code
@Override
public void onSubmitComplete(SubmitCompleteEvent event) {
    // Fire an onChange Event
    fireChange();
    // Cancel all timers to be absolutely sure nothing is going on.
    p.cancel();
    // Ensure that the form encoding is set correctly.
    uploadForm.setEncoding(FormPanel.ENCODING_MULTIPART);
    // Check the result to see if an OK message is returned from the
    // server.
    // Return params could be <pre> or <pre style=""> with some IE
    // and chrome
    String msg = event.getResults();
    if (msg.contains(returnOKMessage)) {
        String docPath = "";
        if (msg.indexOf("path[") > 0 && msg.indexOf("]path") > 0) {
            docPath = msg.substring(msg.indexOf("path[") + 5, msg.indexOf("]path"));
            docPath = URL.decodeQueryString(docPath);
        }
        // Normal case document uploaded is not a workflow
        if (actualFileToUpload.getWorkflow() == null) {
            // Case is not importing a zip and wizard is enabled
            if (!uploadForm.isImportZip() && action == UIFileUploadConstants.ACTION_INSERT && (Main.get().workspaceUserProperties.getWorkspace().isWizardPropertyGroups() || Main.get().workspaceUserProperties.getWorkspace().isWizardWorkflows() || Main.get().workspaceUserProperties.getWorkspace().isWizardCategories() || Main.get().workspaceUserProperties.getWorkspace().isWizardKeywords())) {
                wizard = true;
            } else {
                // wizard only it'll be enable in case digital signature
                // be true
                wizard = uploadForm.isDigitalSignature();
            }
            if (wizard) {
                Main.get().wizardPopup.start(docPath);
            }
            // By default selected row after uploading is uploaded file
            if (!docPath.equals("")) {
                Main.get().mainPanel.desktop.browser.fileBrowser.mantainSelectedRowByPath(docPath);
            }
            uploadItem.setLoaded();
        } else {
            actualFileToUpload.setDocumentPath(docPath);
            repositoryService.getUUIDByPath(docPath, new AsyncCallback<String>() {

                @Override
                public void onSuccess(String result) {
                    actualFileToUpload.setDocumentUUID(result);
                    uploadItem.setLoaded();
                }

                @Override
                public void onFailure(Throwable caught) {
                    Main.get().showError("getUUIDByPath", caught);
                }
            });
        }
    } else {
        uploadItem.setFailed(msg);
    }
}
Example 61
Project: aplikator-master  File: BinaryFieldWidget.java View source code
private Modal createDialogBox() {
    // Create a FormPanel and point it at a service.
    final Form form = new Form();
    form.setAction(Aplikator.getBaseURL() + "upload");
    // Because we're going to add a FileUpload widget, we'll need to set the
    // form to use the POST method, and multipart MIME encoding.
    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.setMethod(FormPanel.METHOD_POST);
    FormElement.as(form.getElement()).setAcceptCharset("UTF-8");
    // Create a panel to hold all of the form widgets.
    FieldSet panel = new FieldSet();
    form.add(panel);
    // add hidden upload parameters
    FormControlStatic entityIdField = new FormControlStatic();
    entityIdField.setId(ENTITY_ID);
    entityIdField.setText(this.entityId);
    entityIdField.setVisible(false);
    FormControlStatic propertyIdField = new FormControlStatic();
    propertyIdField.setId(PROPERTY_ID);
    propertyIdField.setText(property.getId());
    propertyIdField.setVisible(false);
    primaryKeyField = new FormControlStatic();
    primaryKeyField.setId(PRIMARY_KEY_ID);
    primaryKeyField.setVisible(false);
    FormGroup entityIdFG = new FormGroup();
    entityIdFG.add(entityIdField);
    FormGroup propertyIdFG = new FormGroup();
    propertyIdFG.add(propertyIdField);
    FormGroup primaryKeyFG = new FormGroup();
    primaryKeyFG.add(primaryKeyField);
    panel.add(entityIdFG);
    panel.add(propertyIdFG);
    panel.add(primaryKeyFG);
    // Create a FileUpload widget.
    upload = new OnChangeFileUpload(form);
    upload.setName("uploadFormElement");
    panel.add(upload);
    panel.add(statusLabel);
    timer = new ProgressTimer(statusLabel);
    timer.scheduleRepeating(1000);
    final Modal db = new Modal();
    //fix against hidding scrollbar in modal stack
    db.getElement().getStyle().setOverflowY(Style.Overflow.AUTO);
    ModalBody contents = new ModalBody();
    db.setClosable(true);
    db.setSize(ModalSize.SMALL);
    db.setTitle(Aplikator.application.getConfigString("aplikator.binary.uploadTitle"));
    db.add(contents);
    db.setFade(true);
    contents.add(form);
    // Add an event handler to the form.
    form.addSubmitCompleteHandler(new AbstractForm.SubmitCompleteHandler() {

        @Override
        public void onSubmitComplete(AbstractForm.SubmitCompleteEvent event) {
            timer.setRunning(false);
            uploading = false;
            String uploadedFilename = "";
            Document d = XMLParser.parse(event.getResults());
            Node de = d.getDocumentElement();
            if (de != null && de.getFirstChild() != null) {
                uploadedFilename = de.getFirstChild().getNodeValue();
            }
            if ("".equals(uploadedFilename)) {
                statusLabel.setHTML(Aplikator.application.getConfigString("aplikator.binary.statusUploadFailed"));
            } else if (uploadedFilename.startsWith(ERROR_PREFIX)) {
                statusLabel.setHTML(Aplikator.application.getConfigString("aplikator.binary.statusUploadFailed") + ": " + uploadedFilename.replace(ERROR_PREFIX, ""));
            } else {
                statusLabel.setHTML(Aplikator.application.getConfigString("aplikator.binary.statusUploaded"));
                setValue(uploadedFilename);
                setDirty(true);
                thumbnailHolder.showWidget(2);
                //Window.alert("COMPLETE");
                new Timer() {

                    public void run() {
                        db.hide();
                    }
                }.schedule(1500);
            }
        }
    });
    form.addSubmitHandler(new AbstractForm.SubmitHandler() {

        @Override
        public void onSubmit(AbstractForm.SubmitEvent event) {
            uploading = true;
            timer.setRunning(true);
            // start the timer that monitors the progress
            new Timer() {

                public void run() {
                    if (uploading) {
                        timer.run();
                    }
                }
            }.schedule(2000);
            primaryKeyField.setText(Integer.toString(primaryKey.getId()));
            statusLabel.setText(Aplikator.application.getConfigString("aplikator.binary.statusStarted"));
        //Window.alert("SUBMITTED");
        }
    });
    return db;
}
Example 62
Project: gwt-bootstrap-master  File: Form.java View source code
@Override
protected void onAttach() {
    super.onAttach();
    if (frameName != null) {
        // Create and attach a hidden iframe to the body element.
        createFrame();
        Document.get().getBody().appendChild(synthesizedFrame);
    }
    // Hook up the underlying iframe's onLoad event when attached to the
    // DOM.
    // Making this connection only when attached avoids memory-leak issues.
    // The FormPanel cannot use the built-in GWT event-handling mechanism
    // because there is no standard onLoad event on iframes that works
    // across
    // browsers.
    impl.hookEvents(synthesizedFrame, getElement(), this);
}
Example 63
Project: gwtquery-master  File: Ajax.java View source code
private static void resolveSettings(Settings settings) {
    String url = settings.getUrl();
    assert settings != null && settings.getUrl() != null : "no url found in settings";
    String type = "POST";
    if (settings.getType() != null) {
        type = settings.getType().toUpperCase();
    }
    if ("jsonp".equalsIgnoreCase(settings.getDataType())) {
        type = "GET";
    }
    settings.setType(type);
    IsProperties data = settings.getData();
    if (data != null) {
        String dataString = null, contentType = null;
        if (data.getDataImpl() instanceof JavaScriptObject && JsUtils.isFormData(data.<JavaScriptObject>getDataImpl())) {
            dataString = null;
            contentType = FormPanel.ENCODING_URLENCODED;
        } else if (settings.getType().matches("(POST|PUT)") && "json".equalsIgnoreCase(settings.getDataType())) {
            dataString = data.toJson();
            contentType = JSON_CONTENT_TYPE_UTF8;
        } else {
            dataString = data.toQueryString();
            contentType = FormPanel.ENCODING_URLENCODED;
        }
        settings.setDataString(dataString);
        settings.setContentType(contentType);
    }
    if ("GET".equals(settings.getType()) && settings.getDataString() != null) {
        url += (url.contains("?") ? "&" : "?") + settings.getDataString();
        settings.setUrl(url);
    }
}
Example 64
Project: gwtcc-master  File: FormPanel.java View source code
/**
   * Creates a FormPanel that wraps an existing <form> element.
   *
   * This element must already be attached to the document. If the element is
   * removed from the document, you must call
   * {@link RootPanel#detachNow(Widget)}.
   *
   * <p>
   * The specified form element's target attribute will not be set, and the
   * {@link FormSubmitCompleteEvent} will not be fired.
   * </p>
   *
   * @param element the element to be wrapped
   */
public static FormPanel wrap(Element element) {
    // Assert that the element is attached.
    assert Document.get().getBody().isOrHasChild(element);
    FormPanel formPanel = new FormPanel(element);
    // Mark it attached and remember it for cleanup.
    formPanel.onAttach();
    RootPanel.detachOnWindowClose(formPanel);
    return formPanel;
}
Example 65
Project: ABMS-master  File: AdminViewImpl.java View source code
protected Widget createUploadFormWidget() {
    VerticalPanel vPanel = new VerticalPanel();
    String UPLOAD_ACTION_URL = GWT.getModuleBaseURL() + "upload";
    // Create a FormPanel and point it at a service
    final FormPanel form = new FormPanel();
    form.setAction(UPLOAD_ACTION_URL);
    // Because we're going to add a FileUpload widget, we'll need to set the form to use the POST method, and multipart MIME encoding
    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.setMethod(FormPanel.METHOD_POST);
    // Create a panel to hold all of the form widgets
    VerticalPanel panel = new VerticalPanel();
    form.setWidget(panel);
    // Create a FileUpload widget
    FileUpload upload = new FileUpload();
    upload.setName("uploadFormElement");
    panel.add(upload);
    // Add a submit Button
    Button submitButton = new Button();
    submitButton.setText("Submit");
    submitButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            DOM.getElementById("loading").getStyle().setDisplay(Display.BLOCK);
            form.submit();
        }
    });
    form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {

        @Override
        public void onSubmitComplete(SubmitCompleteEvent event) {
            DOM.getElementById("loading").getStyle().setDisplay(Display.NONE);
            Window.alert(event.getResults());
        }
    });
    panel.add(submitButton);
    HTML description = new HTML("<p>Please use the form below to upload the Excel File containing the upkeep costs for the current month.</p>");
    vPanel.add(description);
    vPanel.add(form);
    return vPanel;
}
Example 66
Project: CS130-master  File: ServerLibraryManager.java View source code
////////////////////////////////////////////////////////////
// Private Functions - Workarea - Import
////////////////////////////////////////////////////////////
/**
	 *  Sets workarea to an import form
	 */
private void importForm() {
    clearWorkarea();
    // Title
    Label title = new Label("Import File(s)");
    title.setHeight(30);
    title.setStyleName("workarea-title");
    // Uses GWT form components so we can submit in the background
    Grid grid = new Grid(4, 3);
    final FormPanel uploadForm = new FormPanel();
    uploadForm.setWidget(grid);
    uploadForm.setEncoding(FormPanel.ENCODING_MULTIPART);
    uploadForm.setMethod(FormPanel.METHOD_POST);
    uploadForm.setAction(GWT.getModuleBaseURL() + "upload");
    // Package Name
    Label packageLabel = new Label("Package");
    packageLabel.setHeight(30);
    final TextBox packageName = new TextBox();
    packageName.setName("packageName");
    packageName.setWidth("300px");
    Label packageDescription = new Label("Set package to put all uploaded files into that package.<br/>" + "If empty all files will be placed in the package specified in the file");
    packageDescription.setHeight(30);
    packageDescription.setWidth(500);
    packageDescription.setStyleName("workarea-description");
    grid.setWidget(0, 0, packageLabel);
    grid.setWidget(0, 1, packageName);
    grid.setWidget(0, 2, packageDescription);
    // Upload local file
    Label uploadLabel = new Label("Upload Local Files");
    uploadLabel.setHeight(40);
    FileUpload fileItem = new FileUpload();
    fileItem.setName("theMostUniqueName");
    Scheduler.get().scheduleDeferred(new Command() {

        @Override
        public void execute() {
            //FROM :: http://forums.smartclient.com/showthread.php?t=16007
            enableUpload();
        }
    });
    Label uploadDescription = new Label("Select local files to upload. Accepts \".pipe\" files only. All other files are discarded.");
    uploadDescription.setHeight(30);
    uploadDescription.setWidth(500);
    uploadDescription.setStyleName("workarea-description");
    grid.setWidget(1, 0, uploadLabel);
    grid.setWidget(1, 1, fileItem);
    grid.setWidget(1, 2, uploadDescription);
    // Upload URLs
    Label urlLabel = new Label("Upload From URLs");
    urlLabel.setHeight(40);
    final TextArea urls = new TextArea();
    urls.setName("urls");
    urls.setWidth("300px");
    urls.setHeight("100px");
    Label urlDescription = new Label("Enter a newline seperated list of urls.");
    urlDescription.setHeight(40);
    urlDescription.setWidth(400);
    urlDescription.setStyleName("workarea-description");
    grid.setWidget(2, 0, urlLabel);
    grid.setWidget(2, 1, urls);
    grid.setWidget(2, 2, urlDescription);
    Button uploadButton = new Button("Send");
    uploadButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            uploadForm.submit();
        }
    });
    grid.setWidget(3, 0, uploadButton);
    uploadForm.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {

        public void onSubmitComplete(SubmitCompleteEvent event) {
            if (event.getResults().length() == 0) {
                success("Successfully uploaded files");
            } else {
                error("Failed to upload files: " + event.getResults());
            }
            updateFullTree(null);
            basicInstructions();
        }
    });
    // Root Directory	
    Hidden hRoot = new Hidden();
    hRoot.setName("root");
    hRoot.setValue(rootDirectory.absolutePath);
    grid.setWidget(3, 1, hRoot);
    workarea.addMember(title);
    workarea.addMember(uploadForm);
}
Example 67
Project: rhq-master  File: LoginView.java View source code
public void showLoginDialog(boolean isLogout) {
    setLoginButtonDisabled(false);
    if (!loginShowing) {
        if (isLogout) {
            UserSessionManager.logout();
        }
        if (!isLoginView()) {
            redirectTo(LOGIN_VIEW);
            return;
        }
        isLoginView = true;
        loginShowing = true;
        form = new DynamicForm();
        form.setMargin(25);
        form.setAutoFocus(true);
        form.setShowErrorText(true);
        form.setErrorOrientation(FormErrorOrientation.BOTTOM);
        // NOTE: This image will either be an RHQ logo or a JON logo.
        //       but must be 80x40
        Img logoImg = new Img("header/rhq_logo_40px.png", 80, 40);
        CanvasItem logo = new CanvasItem();
        logo.setShowTitle(false);
        logo.setCanvas(logoImg);
        HeaderItem header = new HeaderItem();
        header.setValue(MSG.view_login_prompt());
        TextItem user = new TextItem("user", MSG.common_title_user());
        user.setRequired(true);
        user.setAttribute("autoComplete", "native");
        final PasswordItem password = new PasswordItem("password", MSG.common_title_password());
        password.setRequired(true);
        password.setAttribute("autoComplete", "native");
        loginButton = new SubmitItem("login", MSG.view_login_login());
        loginButton.setAlign(Alignment.CENTER);
        loginButton.setColSpan(2);
        user.addKeyPressHandler(new KeyPressHandler() {

            public void onKeyPress(KeyPressEvent event) {
                if ((event.getCharacterValue() != null) && (((event.getCharacterValue() == KeyCodes.KEY_ENTER)) || (event.getCharacterValue() == KeyCodes.KEY_TAB))) {
                    // Work around the form not getting auto-fill values until the field is focused
                    password.focusInItem();
                }
            }
        });
        password.addKeyPressHandler(new KeyPressHandler() {

            public void onKeyPress(KeyPressEvent event) {
                if ((event.getCharacterValue() != null) && (event.getCharacterValue() == KeyCodes.KEY_ENTER)) {
                    form.submit();
                }
            }
        });
        form.setFields(logo, header, new RowSpacerItem(), user, password, loginButton);
        window = new Window();
        window.setWidth(400);
        window.setHeight(275);
        window.setTitle(MSG.common_title_welcome());
        // forced focused, static size, can't close / dismiss
        window.setIsModal(true);
        window.setShowModalMask(true);
        window.setCanDragResize(false);
        window.setCanDragReposition(false);
        window.setShowCloseButton(false);
        window.setShowMinimizeButton(false);
        window.setAutoCenter(true);
        window.addItem(form);
        form.addSubmitValuesHandler(new SubmitValuesHandler() {

            public void onSubmitValues(SubmitValuesEvent submitValuesEvent) {
                if (form.validate()) {
                    setUsername(form.getValueAsString("user"));
                    setPassword(form.getValueAsString("password"));
                    fakeForm.submit();
                }
            }
        });
        // Get a handle to the form and set its action to __gwt_login() method
        fakeForm = FormPanel.wrap(Document.get().getElementById(LOGINFORM_ID), false);
        fakeForm.setVisible(true);
        fakeForm.setAction("javascript:__gwt_login()");
        // export the JSNI function
        injectLoginFunction(this);
        if (errorMessage != null) {
            form.setErrorsPreamble(errorMessage);
            form.setFieldErrors("login", errorMessage, true);
            setLoginError(errorMessage);
            // hide it next time
            errorMessage = null;
        }
    }
}
Example 68
Project: wte4j-master  File: TemplateUploadFormPanel.java View source code
private void initForm() {
    formPanel = new FormPanel(id);
    formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
    formPanel.setMethod(FormPanel.METHOD_POST);
}
Example 69
Project: che-master  File: UploadSshKeyPresenter.java View source code
@Override
public void onUploadClicked() {
    String host = view.getHost();
    if (host.isEmpty()) {
        view.setMessage(constant.hostValidationError());
        return;
    }
    view.setEncoding(FormPanel.ENCODING_MULTIPART);
    view.setAction(restContext + "/ssh");
    view.submit();
}
Example 70
Project: che-plugins-master  File: UploadSshKeyPresenter.java View source code
/** {@inheritDoc} */
@Override
public void onUploadClicked() {
    String host = view.getHost();
    if (host.isEmpty()) {
        view.setMessage(constant.hostValidationError());
        return;
    }
    view.setEncoding(FormPanel.ENCODING_MULTIPART);
    view.setAction(restContext + "/ssh");
    view.submit();
}
Example 71
Project: DevTools-master  File: UploadSshKeyPresenter.java View source code
@Override
public void onUploadClicked() {
    String host = view.getHost();
    if (host.isEmpty()) {
        view.setMessage(constant.hostValidationError());
        return;
    }
    view.setEncoding(FormPanel.ENCODING_MULTIPART);
    view.setAction(restContext + "/ssh");
    view.submit();
}
Example 72
Project: geogebra-master  File: UploadImagePanel.java View source code
private void initGUI() {
    panel = new FormPanel();
    panel.add(uploadImageBtn = new FileUpload());
    add(panel);
}
Example 73
Project: AzzeroCO2-master  File: MultiUploadView.java View source code
private FormPanel createFormPanel() {
    formPanel = new UploadFormPanel();
    formPanel.setMethod(FormPanel.METHOD_POST);
    formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
    formPanel.setVisible(false);
    return formPanel;
}
Example 74
Project: gae-studio-master  File: UploadForm.java View source code
@Override
public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) {
    handleSubmitComplete(event.getResults());
    formPanel.reset();
}
Example 75
Project: gwtupload-master  File: DragAndDropFormPanel.java View source code
/**
   * Fire a {@link FormPanel.SubmitEvent}.
   *
   * @return true to continue, false if canceled
   */
private boolean fireSubmitEvent() {
    FormPanel.SubmitEvent event = new FormPanel.SubmitEvent();
    fireEvent(event);
    return !event.isCanceled();
}
Example 76
Project: gwt-mvp-master  File: SimpleWizard.java View source code
/**
     * Returns the form panel used as a base widget. You can control the appearance, etc. Note the use of the FormPanel as it allows you to
     * have panels which include a file upload widget.
     * 
     * @return the form panel
     */
public FormPanel getFormPanel() {
    return formPanel;
}
Example 77
Project: ilarkesto-master  File: Gwt.java View source code
public static final FormPanel createForm(Widget content) {
    FormPanel form = new FormPanel();
    form.add(content);
    return form;
}
Example 78
Project: utilities-master  File: Gwt.java View source code
public static final FormPanel createForm(Widget content) {
    FormPanel form = new FormPanel();
    form.add(content);
    return form;
}