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

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

Introduction

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

Prototype

public FlexTable() 

Source Link

Usage

From source file:com.phideltcmu.recruiter.client.ui.popup.PersonDetails.java

License:Creative Commons License

public PersonDetails(final Person person) {
    final FlexTable ft = new FlexTable();
    String notes = person.getNotes();
    String referrals = person.getRecommencedBy();
    String addedBy = person.getOriginalReferrer();

    Button editNotes = new Button("Edit Notes");
    editNotes.setWidth("100%");

    ft.setWidget(0, 0, new HTML("<b>Details of " + person.getFullName() + "</b><br><hr>"));

    ft.setWidget(1, 0, new HTML("<b>Notes:</b>"));
    ft.setWidget(1, 1, notes == null ? new HTML("NONE") : new HTML(notes));
    ft.setWidget(2, 1, editNotes);//  w  w w.  ja v  a 2s . c  o  m

    ft.setWidget(3, 0, new HTML("<b>Referrals: </b>"));
    ft.setText(4, 1, referrals.length() == 0 ? "None" : "Loading...");
    ft.setWidget(5, 0, new HTML("<b>Added By: </b>"));
    ft.setText(6, 1, addedBy == null ? "ERROR" : "Loading...");

    editNotes.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent clickEvent) {
            NotesAdder adder = new NotesAdder(person, new StringCallback() {
                @Override
                public void onStringReturned(String result) {
                    ft.setWidget(1, 1, result == null ? new HTML("NONE") : new HTML(result));
                    person.setNotes(result);
                }
            });
            adder.center();
        }
    });

    this.bindWidget(ft);

    String[] delim = referrals.split(",");
    List<String> list = new ArrayList<String>(delim.length);

    for (String s : delim) {
        list.add(s);
    }

    if (referrals.length() > 0) {
        DynamicRecruiter.RECRUIT_SERVICE.internalIDsToNames(list, new AsyncCallback<List<String>>() {
            @Override
            public void onFailure(Throwable throwable) {
                throwable.printStackTrace();
            }

            @Override
            public void onSuccess(List<String> strings) {
                //TODO SHOW REFERRER NAMES
                StringBuilder builder = new StringBuilder();
                for (String s : strings) {
                    builder.append(s + "<br>");
                }
                ft.setWidget(4, 1, new HTML(builder.toString()));
            }
        });
    }
    if (addedBy != null) {
        List<String> singletonUser = new ArrayList<String>(1);
        singletonUser.add(addedBy);
        DynamicRecruiter.RECRUIT_SERVICE.internalIDsToNames(singletonUser, new AsyncCallback<List<String>>() {
            @Override
            public void onFailure(Throwable throwable) {
                throwable.printStackTrace();
            }

            @Override
            public void onSuccess(List<String> strings) {
                ft.setText(6, 1, strings.get(0));
            }
        });
    }
}

From source file:com.phideltcmu.recruiter.client.ui.SearchPanel.java

License:Creative Commons License

public SearchPanel() {
    privateEventBus.addHandler(SearchCompletedEvent.TYPE, this);
    this.setHeight("100%");
    this.setWidth("100%");
    this.setStyleName("cent");
    this.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);

    this.add(new InlineHTML("<br>"));

    FlexTable layout = new FlexTable();
    layout.setCellSpacing(6);//w w w  . j a va  2 s  .co m
    FlexTable.FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();

    layout.setHTML(0, 0, "Find a person");
    cellFormatter.setColSpan(0, 0, 2);
    cellFormatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);

    layout.setHTML(1, 0, "Search Text");
    layout.setWidget(1, 1, searchField);

    layout.setWidget(2, 0, searchButton);
    cellFormatter.setColSpan(2, 0, 2);
    cellFormatter.setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_CENTER);

    searchButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent clickEvent) {
            searchingPopup.center();
            DynamicRecruiter.RECRUIT_SERVICE.search(searchField.getText(),
                    new SearchDirectoryHandler(privateEventBus));
            noResults.setVisible(false);
        }
    });

    DecoratorPanel infoPanel = new DecoratorPanel();
    infoPanel.setWidget(layout);
    this.add(infoPanel);
    this.add(new InlineHTML("<br>"));
    this.add(addConfirmation);
    this.add(new InlineHTML("<br><br>"));
    this.add(table);

    noResults.setStyleName("gwt-Label-red");
    this.add(noResults);
    this.table.setVisible(false);
    this.noResults.setVisible(false);
    this.searchField.addKeyPressHandler(new SearchSubmitHandler());
}

From source file:com.plr.hanzi.client.view.definition.DefinitionPanel.java

License:Apache License

public void setCharater(ZhongWenCharacter zwChar) {

    if (zwChar != null) {

        FlexTable definitionTable = new FlexTable();
        int row = 0;
        for (int j = 0; j < zwChar.definitionCount(); j++) {
            CharDefinition charDefinition = zwChar.getDefinition(j);

            Label lp = new Label(charDefinition.getPinyin());
            lp.addStyleName(AppResources.INSTANCE.style().pinyin());

            int tone = charDefinition.getTone();

            String toneStyle = Tone.getTone(tone).getCssClass();

            lp.addStyleName(toneStyle);/*  w ww  .  ja v a 2  s  .  c  o m*/

            definitionTable.setWidget(row, 0, lp);

            for (int k = 0; k < charDefinition.getDefinition().length(); k++) {
                String definition = charDefinition.getDefinition().get(k);

                definition = printDefinition(definition);

                definitionTable.setHTML(row++, 1, definition);
            }

            simplePanel.clear();
            simplePanel.add(definitionTable);
        }
    }
}

From source file:com.ponysdk.core.terminal.ui.PTFlexTable.java

License:Apache License

@Override
protected FlexTable createUIObject() {
    return new FlexTable();
}

From source file:com.ponysdk.ui.terminal.ui.PTFlexTable.java

License:Apache License

@Override
public void create(final PTInstruction create, final UIService uiService) {
    init(create, uiService, new FlexTable());
}

From source file:com.qqtem.LoginManager.client.QqTem.java

License:Open Source License

public void onModuleLoad() {
    RootPanel rootPanel = RootPanel.get();
    rootPanel.setSize("100%", "100%");

    Window.setTitle("qqTem - Login");

    FlexTable flexTable = new FlexTable();
    rootPanel.add(flexTable, 0, 0);/*from   w w w.  ja  v a  2  s  . co  m*/
    flexTable.setWidth("100%");

    Image logo = new Image("logo.png");
    flexTable.setWidget(0, 0, logo);

    logout = new Hyperlink("Logout", false, "newHistoryToken");
    logout.setVisible(false);
    logout.setWidth("45px");

    logout.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            QqTem.realizaLogout();
        }
    });
    flexTable.setWidget(1, 0, logout);

    verticalPanel = new VerticalPanel();
    flexTable.setWidget(2, 0, verticalPanel);
    verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
    verticalPanel.setSize("100px", "100px");

    horizontalPanel = new HorizontalPanel();
    verticalPanel.add(horizontalPanel);

    Login login = new Login();
    horizontalPanel.add(login);

    flexTable.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);
    flexTable.getRowFormatter().setVerticalAlign(0, HasVerticalAlignment.ALIGN_TOP);
    flexTable.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    flexTable.getCellFormatter().setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_CENTER);
    flexTable.getCellFormatter().setVerticalAlignment(2, 0, HasVerticalAlignment.ALIGN_TOP);
}

From source file:com.qualogy.qafe.gwt.client.component.LabeledTextFieldWidget.java

License:Apache License

public LabeledTextFieldWidget(TextFieldGVO gvo, String labelText, String orientation, String type,
        String format) {/*from  w w  w .  j a  v a2  s .c  o  m*/
    if (type != null) {
        if (TextFieldGVO.TYPE_DATE.equals(type)) {
            textbox = new QDatePicker(format);
        } else if (TextFieldGVO.TYPE_SPINNER.equals(type)) {
            int minValue = 0;
            int maxValue = 20;
            if (gvo.getMinValue() != null) {
                minValue = Integer.parseInt(gvo.getMinValue());
            }
            if (gvo.getMaxValue() != null) {
                maxValue = Integer.parseInt(gvo.getMaxValue());
            }
            long initialValue = Long.parseLong(minValue + "");
            textbox = new QValueSpinner(initialValue, minValue, maxValue);
        } else {
            textbox = new QTextField(gvo);
            handleTypeAttribute(textbox, gvo.getRegExp(), gvo.getValidationMessage(), gvo.getValidationTitle());
        }
    } else {
        textbox = new QTextField(gvo);
    }
    label.setText(labelText);
    String height = TextFieldGVO.DEFAULT_HEIGHT;
    String width = TextFieldGVO.DEFAULT_WIDTH;
    if (gvo.getHeight() != null) {
        height = gvo.getHeight();
    }
    if (gvo.getWidth() != null) {
        width = gvo.getWidth();
    }

    FlexTable flexTable = new FlexTable();
    RendererHelper.setStyleForElement(textbox.getElement(), "width", width);
    RendererHelper.setStyleForElement(textbox.getElement(), "height", height);
    RendererHelper.setStyleForElement(label.getElement(), "width", "auto");

    if (textbox instanceof QValueSpinner) {
        TextBox spinnerTextBox = ((QValueSpinner) textbox).getTextBox();
        //spinnerTextBox.setStylePrimaryName(gvo.getStyleClassName());
        flexTable.setWidget(0, 1, (Widget) textbox);
    } else {
        if (ORIENTATION_LEFTRIGHT.equals(orientation)) {
            RendererHelper.setStyleForElement(textbox.getElement(), "marginRight", "20px");
            flexTable.setWidget(0, 1, (Widget) textbox);
        } else if (ORIENTATION_UPDOWN.equals(orientation)) {
            RendererHelper.setStyleForElement(textbox.getElement(), "marginTop", "20px");
            flexTable.setWidget(1, 0, (Widget) textbox);
        }
    }
    flexTable.setWidget(0, 0, label);
    add(flexTable);
}

From source file:com.qualogy.qafe.gwt.client.component.QPagingScrollTableOperation.java

License:Apache License

/**
 * Constructor./* w  w w.j  a  v a 2s .  co m*/
 *
 * @param table
 *            the table being affected
 * @param images
 *            the images to use
 */
// CHECKSTYLE.OFF: CyclomaticComplexity
public QPagingScrollTableOperation(final QPagingScrollTable table, ScrollTableOperationImages images) {
    this.table = table;
    if (this.table instanceof QPagingScrollTable) {
        ((QPagingScrollTable) this.table).setScrollTableOperations(this);
    }

    // Create the main widget
    HorizontalPanel hPanel = new HorizontalPanel();
    initWidget(hPanel);
    hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    setStyleName(DEFAULT_STYLENAME);

    // Create the paging image buttons
    createPageButtons(images);

    // Create the error label
    errorLabel = new HTML();
    errorLabel.setStylePrimaryName("errorMessage");

    // Add the widgets to the panel
    hPanel.add(createSpacer());
    if (hasAddControl(table)) {
        hPanel.add(addImage);
        hPanel.add(createSpacer());
    }
    if (hasDeleteControl(table)) {
        hPanel.add(deleteImage);
        hPanel.add(createSpacer());
    }

    if (isEditableDatagrid(table) || hasDeleteControl(table) || hasAddControl(table)) {
        if (saveDatagrid(table)) {
            hPanel.add(saveImage);
            hPanel.add(createSpacer());
        }
        if (refreshDatagrid(table)) {
            hPanel.add(refreshImage);
            hPanel.add(createSpacer());
        }
        if (cancelDatagrid(table)) {
            hPanel.add(cancelImage);
            hPanel.add(createSpacer());
        }
    }

    hPanel.add(errorLabel);

    if (table.getSource().getImportEnabled() != null && table.getSource().getImportEnabled().booleanValue()) {
        final DisclosurePanel importPanel = new DisclosurePanel("Upload data");
        hPanel.add(importPanel);
        final FormPanel formPanel = new FormPanel();

        formPanel.setAction(GWT.getModuleBaseURL() + "/rpc.datagridupload");
        formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
        formPanel.setMethod(FormPanel.METHOD_POST);

        FileUpload fileUploadComponent = new FileUpload();
        fileUploadComponent.setName("uploadElement");

        Button uploadButtonComponent = new Button("Upload");
        uploadButtonComponent.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                formPanel.submit();
            }
        });

        CheckBox isFirstLineHeader = new CheckBox("Is first row header ?");
        isFirstLineHeader.setName("isFirstLineHeader");
        isFirstLineHeader.setTitle(
                "Check wheter or not the first line of the uploaded file is a header/column definition");
        HorizontalPanel hp = new HorizontalPanel();

        Label label = new Label("Delimeter");
        final TextBox delimiter = new TextBox();
        delimiter.setValue(",");
        delimiter.setTitle("Insert the delimeter (can be any value, as long it's length 1)");
        delimiter.setName("delimiter");
        delimiter.setWidth("15px");
        hp.setSpacing(10);
        hp.add(label);
        hp.add(delimiter);

        Grid gridPanel = new Grid(2, 4);
        gridPanel.setWidget(0, 0, fileUploadComponent);
        gridPanel.setWidget(0, 1, uploadButtonComponent);
        gridPanel.setWidget(1, 0, isFirstLineHeader);
        gridPanel.setWidget(1, 1, hp);

        formPanel.add(gridPanel);

        formPanel.addSubmitHandler(new FormPanel.SubmitHandler() {

            public void onSubmit(SubmitEvent event) {
                // This event is fired just before the form is submitted. We can
                // take
                // this opportunity to perform validation.
                if (delimiter.getText().length() == 0 || delimiter.getText().length() > 1) {
                    ClientApplicationContext.getInstance().log("Ooops...Delimeter invalid",
                            "Make sure there is valid delimeter value.One character only (current value ='"
                                    + delimiter.getText() + "'",
                            true);
                    event.cancel();
                }
            }

        });

        formPanel.addSubmitCompleteHandler(new SubmitCompleteHandler() {

            public void onSubmitComplete(SubmitCompleteEvent event) {
                String uuId = event.getResults();
                if (uuId != null && uuId.indexOf("=") > 0) {
                    uuId = uuId.substring(uuId.indexOf("=") + 1);
                    processData(uuId);
                    importPanel.setOpen(false);
                } else {
                    ClientApplicationContext.getInstance().log("Upload failed", event.getResults(), true);
                }
            }
        });
        importPanel.add(formPanel);
    }

    if (table.getSource() != null && table.getSource().getExport() != null
            && table.getSource().getExport().booleanValue()) {

        createExportLabelsAndImages();

        final DisclosurePanel exportPanel = new DisclosurePanel("Export");
        String[] labels = getExportLabels(table.getSource().getExportFormats());
        Image[] exportImages = getExportImages(labels);

        FlexTable gridExportPanel = new FlexTable();
        hPanel.add(exportPanel);
        exportPanel.add(gridExportPanel);
        final Frame frame = new Frame();
        frame.setHeight("0");
        frame.setWidth("0");
        frame.setVisible(false);
        final String moduleRelativeURL = GWT.getModuleBaseURL() + "/rpc.export";
        gridExportPanel.setWidget(0, 0, frame);

        final CheckBox generateColumnHeaderBox = new CheckBox("Generate Column Header");
        gridExportPanel.getFlexCellFormatter().setColSpan(1, 1, 7);
        gridExportPanel.setWidget(2, 1, generateColumnHeaderBox);
        gridExportPanel.getFlexCellFormatter().setColSpan(2, 1, 6);

        for (int i = 0; i < labels.length; i++) {

            exportImages[i].setStylePrimaryName("datagridexportlabel");
            exportImages[i].setTitle(labels[i]);
            gridExportPanel.setWidget(0, i + 1, exportImages[i]);

            exportImages[i].addClickHandler(new ClickHandler() {

                public void onClick(ClickEvent event) {
                    if (event.getSource() instanceof Image) {
                        Image image = (Image) (event.getSource());
                        final String exportCode = image.getTitle();
                        RPCServiceAsync service = MainFactoryActions.createService();
                        AsyncCallback<?> callback = new AsyncCallback<Object>() {
                            public void onSuccess(Object result) {
                                String uuid = (String) result;
                                // set frame
                                frame.setUrl(moduleRelativeURL + "?uuid=" + uuid);
                                ClientApplicationContext.getInstance().setBusy(false);
                            }

                            public void onFailure(Throwable caught) {

                                ClientApplicationContext.getInstance().log("Export failed",
                                        "Export failed for " + exportCode + " ", true, true, caught);
                                ClientApplicationContext.getInstance().setBusy(false);
                                FunctionsExecutor.setProcessedBuiltIn(true);
                            }
                        };
                        List<DataContainerGVO> dList = new ArrayList<DataContainerGVO>();
                        // following loop is to maintain the order of rows while exporting.
                        for (int i = 0; i < (table.getAbsoluteLastRowIndex() + 1); i++) {
                            dList.add(table.getRowValue(i));
                        }
                        service.prepareForExport(dList, exportCode, null,
                                generateColumnHeaderBox.getValue().booleanValue(), callback);
                    }
                }
            });
        }
    }
}

From source file:com.qualogy.qafe.gwt.client.factory.MainFactory.java

License:Apache License

public static void createTryMeWindow(String subwindow) {

    final WindowPanel w = new WindowPanel("Try me!");

    w.setResizable(true);//from  w w w  . j av a2 s .c  om

    w.setAnimationEnabled(true);
    w.setSize("800px", "500px");

    VerticalPanel verticalPanel = new VerticalPanel();
    final ScrollLayoutPanel vp = new ScrollLayoutPanel();
    vp.setAlwaysShowScrollBars(false);
    vp.setWidth("800px");
    vp.setHeight("500px");
    w.setWidget(verticalPanel);
    // vp.setSpacing(5);
    // vp.setWidth("100%");
    final TabPanel tabPanel = new TabPanel();
    tabPanel.setAnimationEnabled(true);
    tabPanel.setWidth("580px");
    tabPanel.setHeight("500px");

    DockPanel dockPanel = new DockPanel();
    dockPanel.setWidth("580px");
    dockPanel.setHeight("500px");
    tabPanel.add(dockPanel, "Insert code!");
    final TextArea textArea = new TextArea();
    textArea.setVisibleLines(30);
    textArea.setHeight("auto");
    textArea.setWidth("580px");
    DOM.setElementAttribute(textArea.getElement(), "font-size", "10pt");

    dockPanel.add(textArea, DockPanel.CENTER);
    final MenuBar menu = new MenuBar();
    MenuBar renderMenu = new MenuBar(true);
    w.addResizeHandler(new ResizeHandler() {

        public void onResize(ResizeEvent event) {
            int height = event.getHeight();
            int width = event.getWidth();

            if (w.getWidget() != null) {
                w.setHeight((height) + "px");
                w.setWidth((width) + "px");
                vp.setHeight((height - 20) + "px");
                vp.setWidth((width - 20) + "px");
                tabPanel.setHeight((height - 20) + "px");
                tabPanel.setWidth((width - 20) + "px");
                menu.setWidth((width) + "px");
                textArea.setWidth((width - 20) + "px");
            }

        }
    });

    MenuItem gwtMenuItem = new MenuItem("GWT output", new Command() {

        public void execute() {
            String xml = textArea.getText();
            if (xml == null || xml.length() == 0) {
                MessageBox.error("Try me:Error", "There is no input");
            } else {
                MainFactoryActions.processUIXml(xml);
            }

        }
    });
    MenuItem flexMenuItem = new MenuItem("Flex output", new Command() {

        public void execute() {
            String xml = textArea.getText();
            if (xml == null || xml.length() == 0) {
                MessageBox.error("Try me:Error", "There is no input");
            } else {
                MainFactoryActions.processUIXmlFlex(xml);
            }

        }
    });

    renderMenu.addItem(gwtMenuItem);
    renderMenu.addItem(flexMenuItem);

    MenuBar codeMenu = new MenuBar(true);

    MenuItem clearXmlInput = new MenuItem("Clear", new Command() {

        public void execute() {
            textArea.setText("");

        }
    });

    MenuItem createHeaderButton = new MenuItem("Create Header", new Command() {

        public void execute() {
            final String headerText = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n"
                    + "<application-mapping xmlns=\"http://qafe.com/schema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://qafe.com/schema http://www.qafe.com/schema/2.2/application-mapping.xsd\"> \n"
                    + "  <!-- PLEASE ENTER YOUR CODE HERE --> \n" + "</application-mapping> \n";

            textArea.setText(headerText);

        }
    });

    MenuItem createSampleAppButton = new MenuItem("Create Sample Application", new Command() {

        public void execute() {
            final String sampleText = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n"
                    + "<application-mapping xmlns=\"http://qafe.com/schema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://qafe.com/schema http://www.qafe.com/schema/2.2/application-mapping.xsd\"> \n"
                    + "<presentation-tier>\n" + "  <view>\n"
                    + "    <window id=\"window1\" displayname=\"Hello World\" width=\"200\" height=\"200\">\n"
                    + "      <rootpanel id=\"myRootPanel\">   \n" + "        <verticallayout>\n\n"
                    + "          <!-- PLEASE ENTER HERE YOUR CODE -->\n\n"
                    + "          <label id=\"mylabel\" displayname=\"Hello World\" />\n\n"
                    + "        </verticallayout>\n" + "      </rootpanel>\n" + "    </window>\n" + " </view>\n"
                    + "</presentation-tier>\n" +

                    "</application-mapping> \n";

            textArea.setText(sampleText);

        }
    });

    codeMenu.addItem(clearXmlInput);
    codeMenu.addItem(createHeaderButton);
    codeMenu.addItem(createSampleAppButton);

    menu.addItem("Render", renderMenu);
    menu.addItem("Code", codeMenu);

    if (menu != null) {
        verticalPanel.add(menu);
    }
    verticalPanel.add(vp);

    // w.setWidget(tabPanel);

    /*
     * FMB Upload
     */
    final FormPanel fmbForm = new FormPanel();
    fmbForm.setAction(GWT.getModuleBaseURL() + "/rpc.fmbupload");

    // 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.
    fmbForm.setEncoding(FormPanel.ENCODING_MULTIPART);
    fmbForm.setMethod(FormPanel.METHOD_POST);
    // Create a panel to hold all of the form widgets.
    VerticalPanel panelFmbUpload = new VerticalPanel();
    panelFmbUpload.setWidth("580px");
    panelFmbUpload.setHeight("500px");
    // panelFmbUpload.setHeight("100%");

    final FileUpload fmbFile = new FileUpload();
    final TextBox emailBox = new TextBox();
    final TextBox phoneBox = new TextBox();
    fmbFile.setName("fmbUploadElement");

    // Add an event handler to the form.
    fmbForm.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {

        public void onSubmitComplete(SubmitCompleteEvent event) {

            if (event.getResults() != null) {
                if (event.getResults().startsWith("Conversion failed")) {
                    ClientApplicationContext.getInstance().log("Conversion failed",
                            "The file doesn't seem to be a valid Oracle Forms file. If you still want it to be converted for demo purpose, you can also send it to info@qafe.com",
                            true);

                } else if (event.getResults().startsWith("UUID")) {

                    String[] split = event.getResults().split("=");
                    if (split.length == 2) {
                        String uuid = split[1];
                        MainFactoryActions.processUIByUUID(uuid, textArea);
                        MainFactoryActions.notify("FMB uploaded with filename [" + fmbFile.getFilename() + "]",
                                "The message was sent by " + emailBox.getText() + " with optional phonenr: "
                                        + phoneBox.getText());
                        tabPanel.selectTab(0);
                    }
                } else {
                    // firefox workaround
                    String[] split = event.getResults().split("=");
                    if (split.length == 2) {
                        String uuid = split[1];

                        uuid = uuid.replaceAll("</pre>", "");
                        MainFactoryActions.processUIByUUID(uuid, textArea);
                        MainFactoryActions.notify("FMB uploaded with filename [" + fmbFile.getFilename() + "]",
                                "The message was sent by " + emailBox.getText() + " with optional phonenr: "
                                        + phoneBox.getText());
                        tabPanel.selectTab(0);
                    } else {
                        ClientApplicationContext.getInstance().log(event.getResults());
                    }
                }

            } else {
                ClientApplicationContext.getInstance().log(
                        "The Forms Conversion process could not handle this file. Please check the file.",
                        "Check whether or not this file is an FMB (not an FMX)", true);
            }
        }
    });

    FlexTable tempFmbPanel = new FlexTable();
    tempFmbPanel.setWidget(0, 1, fmbFile);
    tempFmbPanel.setWidget(0, 0, new Label("Input for FMB"));

    tempFmbPanel.setWidget(1, 0, new HTML(
            "<p>Note: the FMB you are uploading is only for <span style=\"color:red;\">demo</span> purpose.</p>"
                    + "<p>FMB's can have external dependencies like <span style=\"color:red;\">PLL, OLB's, images</span>,etc. Since they are <span style=\"color:red;\">not</span> included in the upload, the output might not appear correct.</p>"
                    + "<p>For a more detailed conversion of your FMB's please contact us at <span style=\"color:red;\">info@qafe.com </span></p> <p/>"
                    + "<p>Please fill in the information below, so that we can contact you for more information</p> "));
    tempFmbPanel.getFlexCellFormatter().setColSpan(1, 0, 2);

    tempFmbPanel.setWidget(2, 0, new Label("E-mail: (required)"));

    emailBox.setName("fmbEmail");
    emailBox.addBlurHandler(new BlurHandler() {

        public void onBlur(BlurEvent event) {
            String textValue = ((TextBoxBase) event.getSource()).getText();
            if (textValue != null) {
                if (textValue.replaceFirst(TextFieldGVO.REGEXP_TYPE_EMAIL_VALUE, "").length() > 0) {
                    ClientApplicationContext.getInstance().log("Email validation error",
                            TextFieldGVO.TYPE_EMAIL_DEFAULT_MESSAGE, true);
                }
            }

        }
    });
    tempFmbPanel.setWidget(2, 1, emailBox);

    tempFmbPanel.setWidget(3, 0, new Label("Phonenr:"));

    phoneBox.setName("fmbPhone");
    phoneBox.addBlurHandler(new BlurHandler() {

        public void onBlur(BlurEvent event) {

        }
    });
    tempFmbPanel.setWidget(3, 1, phoneBox);

    fmbForm.add(tempFmbPanel);

    panelFmbUpload.add(fmbForm);
    // Add a 'submit' button.
    panelFmbUpload.add(new Button("Generate", new ClickHandler() {

        public void onClick(ClickEvent event) {
            fmbForm.submit();

        }
    }));
    // Add an event handler to the form.
    fmbForm.addSubmitHandler(new FormPanel.SubmitHandler() {
        public void onSubmit(SubmitEvent event) {
            // This event is fired just before the form is submitted. We can take
            // this opportunity to perform validation.
            if (emailBox.getText().length() == 0) {
                ClientApplicationContext.getInstance().log("Email validation error",
                        "Please fill in your email address", true);
                event.cancel();
            } else if (fmbFile.getFilename() == null || fmbFile.getFilename().length() == 0) {
                ClientApplicationContext.getInstance().log("Uploaded file validation error",
                        "There is no file selected. Please select one to continue", true);
                event.cancel();
            }
        }
    });

    tabPanel.add(panelFmbUpload, "Forms Conversion");

    vp.add(tabPanel);
    w.center();
    if (QAFEKeywordsGVO.SYSTEM_MENUITEM_TRYME_FORMS.equals(subwindow)) {
        tabPanel.selectTab(1);

    } else {
        tabPanel.selectTab(0);
    }
}

From source file:com.qualogy.qafe.gwt.client.factory.MainFactory.java

License:Apache License

public static void showActivationDialog(String activationSignature, final AsyncCallback<String> callback) {
    final ShowPanelComponent showPanel = new ShowPanelComponent(false, true, 0, 0) {
        @Override//from  w  w  w .j  a  v  a2  s  . com
        public void show() {
            super.show();
            DOM.setStyleAttribute(getElement(), "position", "fixed");
        }
    };

    String activationLink = "http://www.qafe.com/activation";
    VerticalPanel verticalPanel = new VerticalPanel();
    HTML html = new HTML("A valid activation file can not be found."
            + "<p>1) Please click <a target='_blank' href='" + activationLink + "?signature="
            + activationSignature + "&product=qafe-platform'>here</a> to acquire the activation key"
            + ", use the activation signature: " + activationSignature
            + "</br>2) Then fill in the activation key you have received in the field below<p>");
    verticalPanel.add(html);

    FlexTable panel = new FlexTable();
    verticalPanel.add(panel);

    Label label = new Label("Activation key");
    panel.setWidget(0, 0, label);
    final TextBox textBoxActivationCode = new TextBox();
    panel.setWidget(0, 1, textBoxActivationCode);

    Button buttonActivate = new Button("Activate");
    buttonActivate.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            String activationCode = textBoxActivationCode.getText();
            if (activationCode.isEmpty()) {
                ClientApplicationContext.getInstance().log("", "Activation key is required", true);
                return;
            }
            callback.onSuccess(activationCode);
            showPanel.clear();
            showPanel.hide(true);
        }
    });
    panel.setWidget(0, 2, buttonActivate);

    showPanel.setWidget(verticalPanel);
    showPanel.center();
}