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

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

Introduction

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

Prototype

protected Hidden(Element element) 

Source Link

Document

This constructor may be used by subclasses to explicitly use an existing element.

Usage

From source file:com.dawg6.web.dhcalc.client.SavePanel.java

License:Open Source License

public SavePanel() {

    CaptionPanel captionPanel = new CaptionPanel("Save/Load");
    initWidget(captionPanel);//from   w w  w.j  a v a2  s  .co  m

    FlexTable flexTable_3 = new FlexTable();
    flexTable_3.setCellPadding(2);
    captionPanel.setContentWidget(flexTable_3);

    tabPanel = new TabPanel();
    flexTable_3.setWidget(0, 0, tabPanel);

    browserPanel = new FlexTable();
    browserPanel.setCellPadding(2);

    if (Storage.isLocalStorageSupported()) {
        tabPanel.add(browserPanel, "Browser Storage", false);
    }

    storageList = new ListBox();
    browserPanel.setWidget(0, 0, storageList);
    storageList.setWidth("100%");
    storageList.setVisibleItemCount(5);

    nameField = new TextBox();
    nameField.setVisibleLength(30);
    nameField.setText("Enter a Name");
    browserPanel.setWidget(1, 0, nameField);

    Button btnNewButton = new Button("New button");
    browserPanel.setWidget(1, 1, btnNewButton);
    btnNewButton.setText("Add");

    btnNewButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            addLocalStorage();
        }
    });

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setSpacing(5);
    horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    browserPanel.setWidget(2, 0, horizontalPanel);

    Button button_6 = new Button("New button");
    button_6.setText("Save");
    horizontalPanel.add(button_6);

    button_6.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            saveLocalStorage();
        }
    });

    Button button_5 = new Button("New button");
    horizontalPanel.add(button_5);
    button_5.setText("Restore");

    button_5.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            restoreLocalStorage();
        }
    });

    Button button_2 = new Button("New button");
    horizontalPanel.add(button_2);
    button_2.setText("Delete");

    button_2.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            deleteLocalStorage();
        }
    });

    Button btnNewButton_1 = new Button("New button");
    horizontalPanel.add(btnNewButton_1);
    btnNewButton_1.setText("Rename");

    btnNewButton_1.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            renameLocalStorage();
        }
    });

    browserPanel.getFlexCellFormatter().setColSpan(0, 0, 1);
    browserPanel.getFlexCellFormatter().setColSpan(2, 0, 1);
    browserPanel.getFlexCellFormatter().setColSpan(0, 0, 2);
    browserPanel.getFlexCellFormatter().setColSpan(2, 0, 2);
    browserPanel.getCellFormatter().setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_CENTER);

    filePanel = new FlexTable();
    filePanel.setCellPadding(2);
    tabPanel.add(filePanel, "Local File", false);

    HorizontalPanel horizontalPanel_1 = new HorizontalPanel();
    filePanel.setWidget(0, 0, horizontalPanel_1);

    loadPanel = new FormPanel();
    loadPanel.setMethod(FormPanel.METHOD_POST);
    loadPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
    loadPanel.setAction("loadData");
    horizontalPanel_1.add(loadPanel);

    HorizontalPanel horizontalPanel_2 = new HorizontalPanel();
    loadPanel.setWidget(horizontalPanel_2);
    horizontalPanel_2.setSize("100%", "100%");

    fileUpload = new FileUpload();
    fileUpload.setName("file");
    horizontalPanel_2.add(fileUpload);

    clientKey = new Hidden("client");
    horizontalPanel_2.add(clientKey);
    filePanel.getFlexCellFormatter().setColSpan(0, 0, 1);

    Button button = new Button("Save Data...");
    filePanel.setWidget(1, 0, button);
    button.setText("Save File");

    Button button_1 = new Button("Load Data...");
    filePanel.setWidget(1, 1, button_1);
    button_1.setText("Load File");
    filePanel.getFlexCellFormatter().setColSpan(0, 0, 2);
    filePanel.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER);
    filePanel.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_CENTER);

    button_1.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            loadFile();

        }
    });

    button.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            saveFile();

        }
    });

    textPanel = new FlexTable();
    textPanel.setCellPadding(2);
    tabPanel.add(textPanel, "Copy/Paste", false);

    textArea = new TextArea();
    textArea.setText(
            "Paste previously saved form data here and click \"Restore.\" Or press \"Current\" to paste current Form data.");
    textArea.setVisibleLines(5);
    textPanel.setWidget(0, 0, textArea);
    textArea.setSize("100%", "");

    Button button_3 = new Button("Save Data...");
    button_3.setText("Current");
    textPanel.setWidget(1, 0, button_3);

    textArea.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            textArea.selectAll();
        }
    });

    nameField.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            nameField.selectAll();
        }
    });

    button_3.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {

            if (listener != null) {

                FormData data = listener.getFormData();

                JSONObject obj = JsonUtil.toJSONObject(data);
                textArea.setText(JsonUtil.formatJsonText(obj.toString()));
                textArea.selectAll();
            }

        }
    });

    Button button_4 = new Button("Load Data...");
    button_4.setText("Restore");

    button_4.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (listener != null) {
                String text = textArea.getText();

                FormData data = JsonUtil.parseFormData(text);

                listener.setFormData(data);
                textArea.setText("");
            }

        }
    });

    textPanel.setWidget(1, 1, button_4);
    textPanel.getFlexCellFormatter().setColSpan(0, 0, 2);
    textPanel.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER);
    textPanel.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_CENTER);

    flexTable_3.getFlexCellFormatter().setColSpan(0, 0, 1);

    storageList.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            int i = storageList.getSelectedIndex();

            if (i >= 0) {
                String name = storageList.getItemText(i);

                if (name != null)
                    nameField.setText(name);
            }

        }
    });
}

From source file:com.ephesoft.dcma.gwt.admin.bm.client.view.batch.ExportBatchClassView.java

License:Open Source License

/**
 * Constructor./*from   w ww  .ja v  a2 s  .  c  o m*/
 */
public ExportBatchClassView() {
    super();
    initWidget(BINDER.createAndBindUi(this));

    saveButton.setText(AdminConstants.SAVE_BUTTON);
    cancelButton.setText(AdminConstants.CANCEL_BUTTON);

    final Hidden exportIdentifierHidden = new Hidden("identifier");
    exportBatchClassViewPanel.add(exportIdentifierHidden);

    exportBatchClassViewPanel.setSpacing(BatchClassManagementConstants.TEN);

    exportFormPanel.setMethod(FormPanel.METHOD_POST);
    exportFormPanel.setAction("dcma-gwt-admin/exportBatchClassDownload");

    exportFormPanel.addSubmitHandler(new SubmitHandler() {

        @Override
        public void onSubmit(SubmitEvent event) {
            exportIdentifierHidden.setValue(getExportBatchClassIdentifier());

        }
    });

    exportFormPanel.addSubmitCompleteHandler(new SubmitCompleteHandler() {

        @Override
        public void onSubmitComplete(SubmitCompleteEvent event) {
            if (event.getResults().toLowerCase().indexOf(AdminConstants.ERROR_CODE_TEXT) > -1) {
                ConfirmationDialogUtil.showConfirmationDialogSuccess(MessageConstants.EXPORT_UNSUCCESSFUL);
                getDialogBox().hide(true);
                return;
            }
        }
    });

}

From source file:com.ephesoft.gxt.admin.client.view.batchclass.BatchClassMenuView.java

License:Open Source License

public void addFormPanelEvents(final boolean importLearned, final String identifier) {
    if (null != exportFormPanel) {
        gridViewMainPanel.add(exportFormPanel);
    }/* w w  w . j a  v  a  2s  .co m*/
    exportFormPanel.setMethod(FormPanel.METHOD_POST);

    exportFormPanel.addSubmitHandler(new SubmitHandler() {

        @Override
        public void onSubmit(SubmitEvent event) {
            StringBuilder action = new StringBuilder(GXT_ADMIN_EXPORT_BATCH_CLASS_DOWNLOAD);
            action.append(EXPORT_LEARNING);
            action.append(importLearned);
            exportFormPanel.setAction(action.toString());
            final Hidden exportIdentifierHidden = new Hidden(IDENTIFIER);
            exportIdentifierHidden.setValue(identifier);
            exportFormPanel.add(exportIdentifierHidden);
        }
    });

    exportFormPanel.addSubmitCompleteHandler(new SubmitCompleteHandler() {

        @Override
        public void onSubmitComplete(SubmitCompleteEvent event) {
            if (event.getResults().toLowerCase().indexOf(AdminConstants.ERROR_CODE_TEXT) > -1) {
                DialogUtil.showMessageDialog(LocaleDictionary.getConstantValue(BatchClassConstants.ERROR_TITLE),
                        LocaleDictionary.getMessageValue(BatchClassMessages.EXPORT_UNSUCCESSFUL),
                        DialogIcon.ERROR);
                return;
            }
        }
    });
}

From source file:com.ephesoft.gxt.admin.client.view.document.DocumentTypeMenuView.java

License:Open Source License

public void addFormPanelEvents(final String identifier) {

    if (null != exportFormPanel) {
        gridViewMainPanel.add(exportFormPanel);
    }// w ww . j  a v a2  s  .  c  o  m
    exportFormPanel.setMethod(FormPanel.METHOD_POST);

    exportFormPanel.addSubmitHandler(new SubmitHandler() {

        @Override
        public void onSubmit(SubmitEvent event) {

            exportFormPanel.setAction(EXPORT_DOCUMENT_TYPE_DOWNLOAD);
            final Hidden exportIdentifierHidden = new Hidden(DOCUMENT_IDENTIFIER);
            exportIdentifierHidden.setValue(identifier);
            exportFormPanel.add(exportIdentifierHidden);
        }
    });

    exportFormPanel.addSubmitCompleteHandler(new SubmitCompleteHandler() {

        @Override
        public void onSubmitComplete(SubmitCompleteEvent event) {

            if (event.getResults().toLowerCase().indexOf(AdminConstants.ERROR_CODE_TEXT) > -1) {

                return;
            }
        }
    });
}

From source file:com.ephesoft.gxt.admin.client.view.indexFields.IndexFieldsMenuView.java

License:Open Source License

public void addFormPanelEvents(final String identifier) {

    if (null != exportFormPanel) {
        gridViewMainPanel.add(exportFormPanel);
    }//from  w  w  w.  j a  v a 2 s. c  om
    exportFormPanel.setMethod(FormPanel.METHOD_POST);
    exportFormPanel.addSubmitHandler(new SubmitHandler() {

        @Override
        public void onSubmit(SubmitEvent event) {

            exportFormPanel.setAction(EXPORT_INDEX_FIELD_DOWNLOAD);
            final Hidden exportIdentifierHidden = new Hidden(INDEX_FIELD_IDENTIFIER);
            exportIdentifierHidden.setValue(identifier);
            exportFormPanel.add(exportIdentifierHidden);
        }
    });

    exportFormPanel.addSubmitCompleteHandler(new SubmitCompleteHandler() {

        @Override
        public void onSubmitComplete(SubmitCompleteEvent event) {
            if (event.getResults().toLowerCase().indexOf(AdminConstants.ERROR_CODE_TEXT) > -1) {
                return;
            }
        }
    });
}

From source file:com.ephesoft.gxt.batchinstance.client.presenter.TroubleshootPresenter.java

License:Open Source License

public void onDownloadClicked() {
    boolean atLeastOneChecked = view.checkSelectedOptions();

    if (!atLeastOneChecked) {
        // ConfirmationDialogUtil.showConfirmationDialogError(localeDictionary
        // .getMessageValue(BatchInstanceMessages.NO_OPTION_SELECTED_ERROR_MESSAGE));
        DialogUtil.showMessageDialog(/*from  www .  j  ava  2  s . c o  m*/
                LocaleDictionary.getConstantValue(BatchInstanceConstants.ERROR_TITLE), LocaleDictionary
                        .getMessageValue(BatchInstanceMessages.NO_ARTIFACTS_SELECTED_FOR_TROUBLESHOOTING),
                DialogIcon.ERROR);
    } else {
        hiddenFieldsContainer = new VerticalLayoutContainer();
        addSelectedBatchIDToContainer();
        addSelectedCheckboxToContainer();
        if (null != hiddenFieldsContainer) {
            selectedRadioButton = new Hidden("selectedRadioButton");
            selectedRadioButton.setValue(BatchInfoConstants.DOWNLOAD_RADIO);
            hiddenFieldsContainer.add(selectedRadioButton);
        }
        view.addAndSubmitForm(hiddenFieldsContainer);
    }
}

From source file:com.ephesoft.gxt.batchinstance.client.presenter.TroubleshootPresenter.java

License:Open Source License

/**
 * Handler for download button./*w  w  w . jav a2 s. com*/
 * 
 * @param clickEvent {@link ClickEvent}.
 */
public void onDownloadToClicked() {
    boolean atLeastOneChecked = view.checkSelectedOptions();

    String downloadToPath = view.getDownloadToValue();
    if (!atLeastOneChecked) {
        // ConfirmationDialogUtil.showConfirmationDialogError(localeDictionary
        // .getMessageValue(BatchInstanceMessages.NO_OPTION_SELECTED_ERROR_MESSAGE));
        DialogUtil.showMessageDialog(
                LocaleDictionary.getConstantValue(BatchInstanceConstants.ERROR_TITLE), LocaleDictionary
                        .getMessageValue(BatchInstanceMessages.NO_ARTIFACTS_SELECTED_FOR_TROUBLESHOOTING),
                DialogIcon.ERROR);
    } else if (StringUtil.isNullOrEmpty(downloadToPath)) {
        // ConfirmationDialogUtil.showConfirmationDialogError(localeDictionary
        // .getMessageValue(BatchInstanceMessages.BLANK_PATH_ERROR_MESSAGE));
        DialogUtil.showMessageDialog(
                LocaleDictionary.getConstantValue(BatchInstanceConstants.ERROR_TITLE), LocaleDictionary
                        .getMessageValue(BatchInstanceMessages.NO_NETWORK_PATH_ENTERED_FOR_TROUBLESHOOTING),
                DialogIcon.ERROR);
    } else if (!downloadToPath.startsWith(BatchInstanceConstants.DOUBLE_SLASH) && !isUnix) {
        // ConfirmationDialogUtil.showConfirmationDialogError(localeDictionary
        // .getMessageValue(BatchInstanceMessages.PATH_ENTERED_WITHOUT_SLASH_ERROR_MESSAGE));
        DialogUtil.showMessageDialog(
                LocaleDictionary.getConstantValue(BatchInstanceConstants.ERROR_TITLE), LocaleDictionary
                        .getMessageValue(BatchInstanceMessages.PATH_ENTERED_WITHOUT_SLASH_ERROR_MESSAGE),
                DialogIcon.ERROR);
    } else {
        hiddenFieldsContainer = new VerticalLayoutContainer();
        addSelectedBatchIDToContainer();
        addSelectedCheckboxToContainer();
        addDowloadToParametersToConainer();
        if (null != hiddenFieldsContainer) {
            selectedRadioButton = new Hidden("selectedRadioButton");
            selectedRadioButton.setValue(BatchInfoConstants.DOWNLOAD_TO_RADIO);
            hiddenFieldsContainer.add(selectedRadioButton);
        }
        view.addAndSubmitForm(hiddenFieldsContainer);
    }
}

From source file:com.ephesoft.gxt.batchinstance.client.presenter.TroubleshootPresenter.java

License:Open Source License

private void addDowloadToParametersToConainer() {
    if (null != hiddenFieldsContainer) {
        Hidden downloadToPathField = new Hidden(BatchInfoConstants.PATH_TEXT_BOX);
        final String downloadToPath = view.getDownloadToValue();
        if (!StringUtil.isNullOrEmpty(downloadToPath)) {
            downloadToPathField.setValue(downloadToPath);
        }/*from ww  w . ja  v  a 2 s  .  c o m*/
        hiddenFieldsContainer.add(downloadToPathField);
    }
}

From source file:com.ephesoft.gxt.batchinstance.client.presenter.TroubleshootPresenter.java

License:Open Source License

private void addSelectedBatchIDToContainer() {
    if (null != hiddenFieldsContainer) {
        final Hidden batchInstanceIdentifierField = new Hidden(BatchInfoConstants.BATCH_INSTANCE_IDENTIFIER);
        final String selectedIdentifier = view.getSelectedBatchInstanceIdentifier();
        batchInstanceIdentifierField.setValue(selectedIdentifier);
        hiddenFieldsContainer.add(batchInstanceIdentifierField);
    }/*w  w  w.  j  a  va 2  s . c o  m*/
}

From source file:com.ephesoft.gxt.batchinstance.client.presenter.TroubleshootPresenter.java

License:Open Source License

public void addSelectedCheckboxToContainer() {
    if (null != hiddenFieldsContainer) {
        List<TroubleshootDTO> selectedCheckboxList = view.getSelectedArtifacts();
        if (!CollectionUtil.isEmpty(selectedCheckboxList)) {
            Hidden selectedCheckbox = null;
            for (TroubleshootDTO checkbox : selectedCheckboxList) {
                selectedCheckbox = new Hidden(checkbox.getName());
                selectedCheckbox.setName(checkbox.getName());
                selectedCheckbox.setValue("true");
                hiddenFieldsContainer.add(selectedCheckbox);
            }//from  w w w .j a v a  2s . co  m
        }
    }
}