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

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

Introduction

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

Prototype

public FlexCellFormatter getFlexCellFormatter() 

Source Link

Document

Explicitly gets the FlexCellFormatter .

Usage

From source file:edu.iastate.airl.semtus.client.SEMTUSWEBAPP.java

License:Open Source License

/**
 * This is the entry point method./*w  w w  .  j  av a2  s.  c  om*/
 */
public void onModuleLoad() {

    MenuBar menu = (MenuBar) createMenu();

    sendButton = new Button("Send");
    inputField = new TextArea();
    inputField.setText(
            "Input some text based on the uploaded ontology for analysis.\n\n [PS: Remember to upload an ontology model for your domain to get relevant results.");
    final Label errorLabel = new Label();

    // We can add style names to widgets
    sendButton.addStyleName("sendButton");
    inputField.setSize("590px", "200px");

    // Create a table to layout the form options
    FlexTable layout = new FlexTable();
    layout.setCellSpacing(6);
    FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();

    // Add a title to the form
    cellFormatter.setColSpan(0, 0, 3);
    cellFormatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);

    // Add some standard form options
    layout.setWidget(1, 1, inputField);
    layout.setWidget(2, 1, sendButton);

    DecoratorPanel panel = new DecoratorPanel();

    // Add the nameField and sendButton to the RootPanel
    panel.add(layout);

    // Focus the cursor on the name field when the app loads
    inputField.setFocus(true);
    inputField.selectAll();

    // Create the popup dialog box
    dialogBox = new DialogBox();
    dialogBox.setText(
            "<p align=\"center\"><font color=\"#000000\" face=\"verdana\" size=\"2\">Visualize Complete RDF Graph</font></p>");
    dialogBox.setAnimationEnabled(true);
    closeButton = new Button("Close");
    // We can set the id of a widget by accessing its Element
    closeButton.getElement().setId("closeButton");
    final Label textToServerLabel = new Label();
    serverResponseLabel = new HTML();

    dialogBoxLoadingBar = new DialogBox();
    dialogBoxLoadingBar.setAnimationEnabled(true);
    final VerticalPanel dialogVPanelLoadingBar = new VerticalPanel();
    dialogVPanelLoadingBar.setWidth("200");
    dialogVPanelLoadingBar
            .add(new Label("---------------------------------- Processing --------------------------------"));
    dialogVPanelLoadingBar.add(new Image("http://sushain.com/profile/images/con-bar3.gif"));
    dialogBoxLoadingBar.setWidget(dialogVPanelLoadingBar);

    dialogVPanel = new VerticalPanel();
    dialogVPanel.addStyleName("dialogVPanel");
    // dialogVPanel.add(textToServerLabel);
    // dialogVPanel.add(new HTML("<br><b>Server replies:</b>"));
    dialogVPanel.add(serverResponseLabel);
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    dialogVPanel.add(closeButton);
    dialogBox.setWidget(dialogVPanel);

    announcementBox = new DialogBox();
    announcementBox.setHTML(
            "<p align=\"center\"><font color=\"#000000\" face=\"verdana\" size=\"2\">SEMANTIXS Analysis Complexity Level Setting</font></p>");
    announcementCloseButton = new Button("Close");
    announcementDialogVPanel = new VerticalPanel();
    announcementLabel = new HTML();
    announcementDialogVPanel.addStyleName("announcementDialogVPanel");
    announcementDialogVPanel.add(announcementLabel);
    announcementDialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    announcementDialogVPanel.add(announcementCloseButton);
    announcementBox.setWidget(announcementDialogVPanel);

    // Create a tab panel
    tabPanel = new DecoratedTabPanel();
    tabPanel.setWidth("645px");
    tabPanel.setHeight("100px");
    tabPanel.setAnimationEnabled(true);

    // Add a home tab
    String[] tabTitles = new String[] { "Workspace View", "Input Ontology-based Text Here",
            "View Extracted Semantic Data" };
    HTML homeText = new HTML("<p align=\"center\"><font color=\"#e0c190\" face=\"Times\" size=\"6\">"
            + "<b>SEMANTIXS</b></font>"
            + "<br/><font color=\"#e0c190\" face=\"Times\" size=\"3\">version 1.0.1</font><br/>" + "</p>");

    tabPanel.add(homeText, tabTitles[0]);

    // Add a tab
    VerticalPanel vPanel = new VerticalPanel();
    vPanel.add(panel);
    tabPanel.add(vPanel, tabTitles[1]);

    // Create a table to layout the form options
    FlexTable layout1 = new FlexTable();
    layout1.setCellSpacing(6);
    FlexCellFormatter cellFormatter1 = layout1.getFlexCellFormatter();

    // Add a title to the form
    cellFormatter1.setColSpan(0, 0, 3);
    cellFormatter1.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);

    resultField = new TextArea();
    resultField.setText("Send some text for processing before trying to view the results in this tab.");
    resultField.setSize("590px", "225px");

    // Add some standard form options
    layout1.setWidget(1, 1, resultField);
    DecoratorPanel panel1 = new DecoratorPanel();

    // Add the nameField and sendButton to the RootPanel
    panel1.add(layout1);
    VerticalPanel vPanel1 = new VerticalPanel();
    vPanel1.add(panel1);
    tabPanel.add(vPanel1, tabTitles[2]);

    tabPanel.selectTab(0);
    tabPanel.ensureDebugId("cwTabPanel");

    panelHoldingTabPanel = new DecoratorPanel();
    panelHoldingTabPanel.setHeight("450px");
    panelHoldingTabPanel.setWidth("650px");
    panelHoldingTabPanel.setWidget(tabPanel);
    panelHoldingTabPanel.setVisible(false);

    panelHoldingTabPanel.setStyleName("panelHoldingTabPanel");

    RootPanel.get("nameFieldContainer").add(menu);
    RootPanel.get("sendButtonContainer").add(panelHoldingTabPanel);
    // RootPanel.get("errorLabelContainer").add(errorLabel);

    RootPanel.getBodyElement().setId("main");

    FormPanel uploadForm = upload();
    uploadBox = new DialogBox();
    uploadBox.setText("Ontology Upload");
    uploadBox.setAnimationEnabled(true);
    uploadBox.setWidget(uploadForm);
    uploadBox.hide();

    // Set default analysis level for SEMANTIXS as 1
    level = LEVEL_ONE;

    // Add a handler to close the DialogBox
    closeButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {

            dialogBox.hide();
            tabPanel.selectTab(2);
            sendButton.setEnabled(true);
            sendButton.setFocus(false);
        }
    });

    // Add a handler to close the AnnouncementBox
    announcementCloseButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {

            announcementBox.hide();
        }
    });

    // Create a handler for the sendButton and nameField
    class MyHandler implements ClickHandler, KeyUpHandler {
        /**
         * Fired when the user clicks on the sendButton.
         */
        public void onClick(ClickEvent event) {
            sendTextToServer();
        }

        /**
         * Fired when the user types in the nameField.
         */
        public void onKeyUp(KeyUpEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
                sendTextToServer();
            }
        }

        /**
         * Send the name from the nameField to the server and wait for a
         * response.
         */
        private void sendTextToServer() {
            // First, we validate the input.
            errorLabel.setText("");
            String textToServer = inputField.getText();

            if (!FieldVerifier.isValidName(textToServer)) {
                errorLabel.setText(
                        "Please enter a long enough sentence for SEMANTIXS to be able to map it to the ontology definitions");
                return;
            }

            dialogBoxLoadingBar.center();

            // Then, we send the input to the server.
            sendButton.setEnabled(false);

            textToServerLabel.setText(textToServer);
            serverResponseLabel.setText("");

            greetingService.handleInput(textToServer, level, new AsyncCallback<String>() {
                public void onFailure(Throwable caught) {
                    // Show the RPC error message to the user

                    dialogBoxLoadingBar.hide();
                    sendButton.setEnabled(false);
                    dialogBox.setText("Remote Procedure Call - Failure");
                    serverResponseLabel.addStyleName("serverResponseLabelError");
                    serverResponseLabel.setHTML(SERVER_ERROR);
                    dialogBox.center();
                    closeButton.setFocus(true);
                }

                public void onSuccess(String result) {

                    dialogBoxLoadingBar.hide();
                    sendButton.setEnabled(false);
                    dialogBox.setText("SEMANTIXS response:");
                    serverResponseLabel.removeStyleName("serverResponseLabelError");

                    serverResponseLabel.setHTML(
                            "<b>SEMANTIXS has finished processing the text. Please view the extracted results under - \"View Extracted Semantic Data\" tab.</b>");
                    resultField.setText(result);
                    dialogBox.center();
                    closeButton.setFocus(true);
                }
            });
        }
    }

    // Add a handler to send the name to the server
    MyHandler handler = new MyHandler();
    sendButton.addClickHandler(handler);
    inputField.addKeyUpHandler(handler);
}

From source file:edu.kit.ipd.sonar.client.LoginScreen.java

License:Open Source License

/** Constructor. Registers independently for events. */
public LoginScreen() {
    // Set up structure
    FlexTable loginMenu = new FlexTable();
    loginMenu.setStyleName("loginMenu");
    loginMenu.setWidget(0, 0, new Label(messages.userNameLabel()));
    loginMenu.setWidget(0, 1, userNameBox);
    userNameBox.setStyleName("loginBox");
    loginMenu.setWidget(0, 2, adminButton);
    adminButton.setStyleName("adminButton");
    loginMenu.setWidget(1, 0, new Label(messages.passwordLabel()));
    loginMenu.setWidget(1, 1, passwordBox);
    passwordBox.setStyleName("loginPasswordBox");
    Button loginButton = new Button(messages.loginButtonText());
    loginMenu.setWidget(2, 1, loginButton);
    loginMenu.getCellFormatter().setHorizontalAlignment(2, 1, HasHorizontalAlignment.ALIGN_RIGHT);
    loginMenu.getFlexCellFormatter().setColSpan(1, 1, 2);
    loginMenu.getFlexCellFormatter().setColSpan(2, 1, 2);

    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setStyleName("loginScreen");
    hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hPanel.add(loginMenu);//  ww w  .  j  a va2s. c o m
    Image loginLogo = new Image(GWT.getModuleBaseURL() + "images/logo_login.png");
    loginLogo.setStyleName("loginLogo");
    hPanel.add(loginLogo);

    SimplePanel workaround = new SimplePanel();
    workaround.add(hPanel);
    initWidget(workaround);

    // Set various stuff
    int index = 1;
    userNameBox.setTabIndex(index++);
    passwordBox.setTabIndex(index++);
    loginButton.setTabIndex(index++);

    DeferredCommand.addCommand(setFocusCommand);

    // Event Handlers
    userNameBox.addKeyDownHandler(new KeyDownHandler() {
        public void onKeyDown(final KeyDownEvent e) {
            if (e.getNativeKeyCode() == KEY_ENTER) {
                passwordBox.setFocus(true);
                passwordBox.selectAll();
            }
        }
    });

    passwordBox.addKeyDownHandler(new KeyDownHandler() {
        public void onKeyDown(final KeyDownEvent e) {
            if (e.getNativeKeyCode() == KEY_ENTER) {
                attemptAuth();
            }
        }
    });

    loginButton.addClickHandler(new ClickHandler() {
        public void onClick(final ClickEvent e) {
            attemptAuth();
        }
    });

    adminButton.addClickHandler(new ClickHandler() {
        public void onClick(final ClickEvent e) {
            if (adminButton.isDown()) {
                userNameBox.setText(messages.administratorName());
                userNameBox.setEnabled(false);
            } else {
                userNameBox.setText("");
                userNameBox.setEnabled(true);
            }
            passwordBox.setText("");
            DeferredCommand.addCommand(setFocusCommand);
        }
    });

    EventBus.getHandlerManager().addHandler(FailedAuthenticationEvent.TYPE,
            new FailedAuthenticationEventHandler() {
                public void onFailedAuthentication(final FailedAuthenticationEvent e) {
                    failedAuth();
                }
            });

    EventBus.getHandlerManager().addHandler(SuccessfulAuthenticationEvent.TYPE,
            new SuccessfulAuthenticationEventHandler() {
                public void onSuccessfulAuthentication(final SuccessfulAuthenticationEvent e) {
                    successfulAuth();
                }
            });

    EventBus.getHandlerManager().addHandler(SuccessfulLogoutEvent.TYPE, new SuccessfulLogoutEventHandler() {
        public void onSuccessfulLogout(final SuccessfulLogoutEvent e) {
            DeferredCommand.addCommand(setFocusCommand);
        }
    });
}

From source file:edu.purdue.pivot.skwiki.client.sketch.colorpicker.ColorPicker.java

License:Artistic License

public ColorPicker() {
    // UI Drawing
    //------------------

    hue = 0;/*  ww  w .  j a v a  2s  .  c  om*/
    saturation = 100;
    brightness = 100;
    red = 255;
    green = 0;
    blue = 0;

    HorizontalPanel panel = new HorizontalPanel();
    FlexTable table = new FlexTable();

    // Add the large slider map
    slidermap = new SliderMap(this);
    panel.add(slidermap);
    panel.setCellWidth(slidermap, "258px");
    panel.setCellHeight(slidermap, "258px");

    // Add the small slider bar
    sliderbar = new SliderBar(this);
    panel.add(sliderbar);
    panel.setCellWidth(sliderbar, "40px");
    panel.setCellHeight(sliderbar, "258px");

    // Define the Flextable's content
    // Color preview at the top
    colorpreview = new HTML("");
    colorpreview.setWidth("50px");
    colorpreview.setHeight("50px");
    DOM.setStyleAttribute(colorpreview.getElement(), "border", "1px solid black");

    // Radio buttons
    rbHue = new RadioButton("color", "H:");
    rbHue.addClickListener(this);
    rbSaturation = new RadioButton("color", "S:");
    rbSaturation.addClickListener(this);
    rbBrightness = new RadioButton("color", "V:");
    rbBrightness.addClickListener(this);
    rbRed = new RadioButton("color", "R:");
    rbRed.addClickListener(this);
    rbGreen = new RadioButton("color", "G:");
    rbGreen.addClickListener(this);
    rbBlue = new RadioButton("color", "B:");
    rbBlue.addClickListener(this);

    // Textboxes
    tbHue = new TextBox();
    tbHue.setText(new Integer(hue).toString());
    tbHue.setMaxLength(3);
    tbHue.setVisibleLength(4);
    tbHue.addKeyboardListener(this);
    tbHue.addChangeListener(this);
    tbSaturation = new TextBox();
    tbSaturation.setText(new Integer(saturation).toString());
    tbSaturation.setMaxLength(3);
    tbSaturation.setVisibleLength(4);
    tbSaturation.addKeyboardListener(this);
    tbSaturation.addChangeListener(this);
    tbBrightness = new TextBox();
    tbBrightness.setText(new Integer(brightness).toString());
    tbBrightness.setMaxLength(3);
    tbBrightness.setVisibleLength(4);
    tbBrightness.addKeyboardListener(this);
    tbBrightness.addChangeListener(this);
    tbRed = new TextBox();
    tbRed.setText(new Integer(red).toString());
    tbRed.setMaxLength(3);
    tbRed.setVisibleLength(4);
    tbRed.addKeyboardListener(this);
    tbRed.addChangeListener(this);
    tbGreen = new TextBox();
    tbGreen.setText(new Integer(green).toString());
    tbGreen.setMaxLength(3);
    tbGreen.setVisibleLength(4);
    tbGreen.addKeyboardListener(this);
    tbGreen.addChangeListener(this);
    tbBlue = new TextBox();
    tbBlue.setText(new Integer(blue).toString());
    tbBlue.setMaxLength(3);
    tbBlue.setVisibleLength(4);
    tbBlue.addKeyboardListener(this);
    tbBlue.addChangeListener(this);
    tbHexColor = new TextBox();
    tbHexColor.setText("ff0000");
    tbHexColor.setMaxLength(6);
    tbHexColor.setVisibleLength(6);
    tbHexColor.addKeyboardListener(this);
    tbHexColor.addChangeListener(this);

    // Put together the FlexTable
    table.setWidget(0, 0, colorpreview);
    table.getFlexCellFormatter().setColSpan(0, 0, 3);
    table.setWidget(1, 0, rbHue);
    table.setWidget(1, 1, tbHue);
    table.setWidget(1, 2, new HTML("&deg;"));
    table.setWidget(2, 0, rbSaturation);
    table.setWidget(2, 1, tbSaturation);
    table.setText(2, 2, "%");
    table.setWidget(3, 0, rbBrightness);
    table.setWidget(3, 1, tbBrightness);
    table.setText(3, 2, "%");
    table.setWidget(4, 0, rbRed);
    table.setWidget(4, 1, tbRed);
    table.setWidget(5, 0, rbGreen);
    table.setWidget(5, 1, tbGreen);
    table.setWidget(6, 0, rbBlue);
    table.setWidget(6, 1, tbBlue);
    table.setText(7, 0, "#:");
    table.setWidget(7, 1, tbHexColor);
    table.getFlexCellFormatter().setColSpan(7, 1, 2);

    // Final setup
    panel.add(table);
    rbSaturation.setChecked(true);
    setPreview("ff0000");
    DOM.setStyleAttribute(colorpreview.getElement(), "cursor", "default");

    // First event
    onClick(rbSaturation);

    initWidget(panel);
}

From source file:edu.ucsb.eucalyptus.admin.client.extensions.store.FrameWidget.java

License:Open Source License

public FrameWidget(Widget content) {
    FlexTable table = new FlexTable();
    table.setWidget(0, 0, new Image(FRAME_TOP_URI));
    table.setWidget(1, 0, new Image(FRAME_LEFT_URI));
    table.setWidget(2, 0, new Image(FRAME_BOTTOM_URI));
    table.setWidget(1, 1, content);//w w w . j  av a2s .com
    table.setStyleName("istore-frame-widget");
    table.setCellSpacing(0);
    table.setCellPadding(0);
    FlexTable.FlexCellFormatter formatter = table.getFlexCellFormatter();
    formatter.setColSpan(0, 0, 2);
    formatter.setColSpan(2, 0, 2);
    formatter.setStyleName(0, 0, "istore-top-frame-image");
    formatter.setStyleName(1, 0, "istore-left-frame-image");
    formatter.setStyleName(2, 0, "istore-bottom-frame-image");
    formatter.getElement(1, 0).getStyle().setProperty("background", "url(" + FRAME_LEFT_URI + ") repeat-y");
    initWidget(table);
}

From source file:eu.europeana.uim.gui.cp.client.europeanawidgets.ImportResourcesWidget.java

License:EUPL

/**
 * Creates the Search Criteria Section//from  w  w  w .j  a  va2 s.c o  m
 */
private Widget createAdvancedForm() {

    DockPanel dock = new DockPanel();

    // Create a table to layout the form options
    FlexTable layout = new FlexTable();
    layout.setCellSpacing(6);
    layout.setWidth("500px");
    FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();

    // Add a title to the form
    layout.setHTML(0, 2, "<b>Search Criteria</b>");
    cellFormatter.setColSpan(0, 0, 2);
    cellFormatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);

    // Add some standard form options

    TextBox dsnameSearchField = new TextBox();
    setDOMID(dsnameSearchField, "dsnameSearchField");

    final ListBox statusSearchField = new ListBox(false);
    statusSearchField.addItem("--", "");
    statusSearchField.addItem(RecordStates.OAI_PMH_TESTING.getDescription(),
            RecordStates.OAI_PMH_TESTING.getSysId());
    statusSearchField.addItem(RecordStates.OAI_PMH_SENT_TO_ORG.getDescription(),
            RecordStates.OAI_PMH_SENT_TO_ORG.getSysId());
    statusSearchField.addItem(RecordStates.READY_FOR_HARVESTING.getDescription(),
            RecordStates.READY_FOR_HARVESTING.getSysId());
    statusSearchField.addItem(RecordStates.MAPPING_AND_NORMALIZATION.getDescription(),
            RecordStates.MAPPING_AND_NORMALIZATION.getSysId());
    statusSearchField.addItem(RecordStates.READY_FOR_REPLICATION.getDescription(),
            RecordStates.READY_FOR_REPLICATION.getSysId());
    statusSearchField.addItem(RecordStates.ONGOING_SCHEDULED_UPDATES.getDescription(),
            RecordStates.ONGOING_SCHEDULED_UPDATES.getSysId());
    statusSearchField.addItem(RecordStates.INGESTION_COMPLETE.getDescription(),
            RecordStates.INGESTION_COMPLETE.getSysId());
    statusSearchField.addItem(RecordStates.DISABLED_AND_REPLACED.getDescription(),
            RecordStates.DISABLED_AND_REPLACED.getSysId());
    statusSearchField.addItem(RecordStates.HARVESTING_PENDING.getDescription(),
            RecordStates.HARVESTING_PENDING.getSysId());
    setDOMID(statusSearchField, "statusSearchField");

    importButton = new Button();
    importButton.setText(EuropeanaClientConstants.IMPORTBUTTONLABEL);
    importButton.setTitle(EuropeanaClientConstants.IMPORTBUTTONTITLE);

    importButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            importDialog.center();
            performImport();
        }
    });

    searchButton = new Button();
    searchButton.setText(EuropeanaClientConstants.SEARCHBUTTONLABEL);
    searchButton.setTitle(EuropeanaClientConstants.SEARCHBUTTONTITLE);

    searchButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            searchDialog.center();
            performSearch();
        }
    });

    layout.setHTML(1, 0, EuropeanaClientConstants.DSNAMESEARCHLABEL);
    layout.setWidget(1, 1, dsnameSearchField);

    layout.setHTML(1, 2, EuropeanaClientConstants.STATUSSEARCHLABEL);
    layout.setWidget(1, 3, statusSearchField);

    layout.setWidget(3, 0, searchButton);
    layout.setWidget(3, 1, importButton);

    //Put Legend here

    DisclosurePanel advancedDisclosure = new DisclosurePanel("Show legend");
    advancedDisclosure.setAnimationEnabled(true);
    advancedDisclosure.ensureDebugId("cwDisclosurePanel");

    FlexTable legendcontents = new FlexTable();

    legendcontents.setWidget(0, 0, new Image(EuropeanaClientConstants.SUCCESSIMAGELOC));
    legendcontents.setWidget(0, 1, new HTML(EuropeanaClientConstants.LEGENDSUCCESSLABEL));
    legendcontents.setWidget(1, 0, new Image(EuropeanaClientConstants.ERRORIMAGELOC));
    legendcontents.setWidget(1, 1, new HTML(EuropeanaClientConstants.LEGENDNALABEL));
    legendcontents.setWidget(2, 0, new Image(EuropeanaClientConstants.PROBLEMIMAGELOC));
    legendcontents.setWidget(2, 1, new HTML(EuropeanaClientConstants.LEGENDFAILURELABEL));
    advancedDisclosure.add(legendcontents);

    // Wrap the contents in a DecoratorPanel

    dock.add(layout, DockPanel.NORTH);

    dock.add(advancedDisclosure, DockPanel.NORTH);

    DecoratorPanel decPanel = new DecoratorPanel();
    decPanel.setWidget(dock);
    return decPanel;
}

From source file:fast.mediation.client.DataTransformationTool.java

License:Open Source License

private void rebuildOperatorTabs() {
    // remove old tabs
    int widgetCount = tabPanel.getWidgetCount();
    while (widgetCount > 1) {
        tabPanel.remove(widgetCount - 1);
        widgetCount = tabPanel.getWidgetCount();
    }//from  w w  w. j  ava  2 s  .  c  o m

    // general tab
    FlexTable generalInformationTable = new FlexTable();
    FlexCellFormatter generalInfoFormatter = generalInformationTable.getFlexCellFormatter();
    generalInformationTable.addStyleName("cw-FlexTable");
    generalInformationTable.setWidth("32em");
    generalInformationTable.setCellSpacing(5);
    generalInformationTable.setCellPadding(3);
    generalInfoFormatter.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT);
    generalInfoFormatter.setColSpan(0, 0, 2);

    int rowCount = generalInformationTable.getRowCount();

    // add label and nameTextBox
    Label nameLabel = new Label("Name:");
    generalInformationTable.setWidget(rowCount, 0, nameLabel);
    rowCount++;
    nameTextBox = CTextChangeHandler.createTextBox(trafoOperator, "name");
    generalInformationTable.setWidget(rowCount, 0, nameTextBox);
    rowCount++;

    // add form for input fact
    portGUI = new PortGUI(this, trafoOperator, true);
    Widget inputPortTable = portGUI.createInputPortTable();
    generalInformationTable.setWidget(rowCount, 0, inputPortTable);
    rowCount++;

    // add form for output fact
    portGUI = new PortGUI(this, trafoOperator, true);
    Widget outputPortTable = portGUI.createOutputPortTable();
    generalInformationTable.setWidget(rowCount, 0, outputPortTable);
    rowCount++;

    // add to tab panel
    tabPanel.add(generalInformationTable, new TabWidget("General"));

    refreshRuleAndCodeTab();
}

From source file:fast.mediation.client.DataTransformationTool.java

License:Open Source License

public void refreshRuleAndCodeTab() {
    // remove old tabs
    int widgetCount = tabPanel.getWidgetCount();
    while (widgetCount > 2) {
        tabPanel.remove(widgetCount - 1);
        widgetCount = tabPanel.getWidgetCount();
    }//from w w w .  jav  a2  s.co  m

    // transformation tab
    FlexTable transformationTable = new FlexTable();
    FlexCellFormatter transformationTableCellFormatter = transformationTable.getFlexCellFormatter();
    transformationTable.addStyleName("cw-FlexTable");
    transformationTable.setWidth("32em");
    transformationTable.setCellSpacing(5);
    transformationTable.setCellPadding(3);
    transformationTableCellFormatter.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT);
    transformationTableCellFormatter.setColSpan(0, 0, 2);

    int numRows = transformationTable.getRowCount();

    // Add rule GUI
    ruleGUI = new MediationRuleGUI(WrappingType.WRAP_JSON, trafoOperator, requestHandler);
    transformationTable.setWidget(numRows, 1, ruleGUI.createTranslationTable());

    // FTest.assertTrue(true, "createJsonTranslationTable succeeded");

    transformationTable.ensureDebugId("cwFlexTable");

    tabPanel.add(transformationTable, new TabWidget("exTransformation"));

    //Adding part three, just to test code generation, there is a show of selected rules, templates and the .js results
    codeGenViewer = new CodeGenViewer(trafoOperator, WrappingType.WRAP_JSON, ruleGUI);
    tabPanel.add(codeGenViewer.createCodeGenViewer(), new TabWidget("CodeGen Viewer"));
}

From source file:fast.servicescreen.client.gui.RequestGUI.java

License:Open Source License

public Widget createRequestTable() {
    FlexTable requestTable = new FlexTable();
    FlexCellFormatter requestTableCellFormatter = requestTable.getFlexCellFormatter();
    requestTable.addStyleName("cw-FlexTable");
    requestTable.setWidth("32em");
    requestTable.setCellSpacing(5);//from  w  w w . j  ava 2  s  .co m
    requestTable.setCellPadding(3);
    requestTableCellFormatter.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT);
    requestTableCellFormatter.setColSpan(0, 0, 2);

    int numRows = requestTable.getRowCount();

    // Add text boxes for the request template, url, the parameters and send button
    requestTable.setWidget(numRows, 0, new Label("Request URL: "));

    String textSize = "20cm";
    designer.templateBox = CTextChangeHandler.createWidthTextBox(designer.serviceScreen, textSize,
            "requestTemplate");
    templateBoxHandler = new TemplateBoxHandler();
    designer.serviceScreen.addPropertyChangeListener(ServiceScreen.PROPERTY_REQUEST_TEMPLATE,
            templateBoxHandler);
    // designer.templateBox.addChangeHandler(templateBoxHandler);
    requestTable.setWidget(numRows, 1, designer.templateBox);
    numRows++;

    if (templateGUI == null) {
        templateGUI = new TemplateGUI(designer);
    }

    updateAtWork = true;
    setTemplateTable(templateGUI.createTemplateTable());
    requestTable.setWidget(numRows, 1, getTemplateTable());
    updateAtWork = false;
    numRows++;

    designer.setResultText(new TextArea());
    designer.requestUrlBox = CTextChangeHandler.createWidthTextBox(designer.serviceScreen, textSize,
            "requestUrl");

    // Add request button with handler
    if (designer.requestHandler == null) {
        designer.requestHandler = new SendRequestHandler(designer);
    }

    //Add handler to change code gen & request type, if request type is changing.
    reqTypeHandler = new RequestTypeHandler(designer);
    requestTable.setWidget(numRows, 1, reqTypeHandler.getChooserPanel());
    numRows++;

    //Add header, body fields
    requestTable.setWidget(numRows, 1, reqTypeHandler.getHeaderBodyPanel());
    numRows++;

    //WSDL button
    Button wsdlButton = new Button("WSDL");
    wsdlButton.addClickHandler(new WSDLButtonHandler());
    wsdlButton.setStyleName("fastButton");

    designer.requestButton = new Button("Send Request", designer.requestHandler);
    designer.requestButton.setStyleName("fastButton");
    designer.requestButton.addStyleName("sc-FixedWidthButton");

    //the flow panel holds the "send request" and "WSDL" button 
    FlowPanel flowPanel = new FlowPanel();
    flowPanel.add(designer.requestButton);
    flowPanel.add(wsdlButton);
    requestTable.setWidget(numRows, 1, flowPanel);
    requestTable.setCellSpacing(15);

    numRows++;

    // Add textbox for actual request
    requestTable.setWidget(numRows, 0, new Label("Final URL: "));
    requestTable.setWidget(numRows, 1, designer.requestUrlBox);

    numRows++;
    numRows++;

    // Add textfield for result xml
    designer.resultText.setSize("20cm", "6cm");
    requestTable.setWidget(numRows, 1, new Label("Service Reply : "));
    requestTable.setWidget(numRows + 1, 1, designer.resultText);
    numRows++;
    numRows++;

    return requestTable;
}

From source file:fast.servicescreen.client.ServiceScreenDesignerWep.java

License:Open Source License

private void rebuildOtherTabs() {
    // remove old tabs
    int widgetCount = tabPanel.getWidgetCount();
    while (widgetCount > 1) {
        tabPanel.remove(widgetCount - 1);
        widgetCount = tabPanel.getWidgetCount();
    }/*w w  w. j  a v  a 2  s  .  c  om*/

    // general tab
    FlexTable generalInformationTable = new FlexTable();
    FlexCellFormatter generalInfoFormatter = generalInformationTable.getFlexCellFormatter();
    generalInformationTable.addStyleName("cw-FlexTable");
    generalInformationTable.setWidth("32em");
    generalInformationTable.setCellSpacing(5);
    generalInformationTable.setCellPadding(3);
    generalInfoFormatter.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT);
    generalInfoFormatter.setColSpan(0, 0, 2);

    int rowCount = generalInformationTable.getRowCount();

    // add story board hint
    Label hintLabel;
    hintLabel = new Label("Step 1: define how this resource is connected to other building blocks.");
    generalInformationTable.setWidget(rowCount, 0, hintLabel);
    rowCount++;

    // add label and nameTextBox
    Label nameLabel = new Label("Give this resource a name:");
    generalInformationTable.setWidget(rowCount, 0, nameLabel);
    rowCount++;
    nameTextBox = CTextChangeHandler.createTextBox(serviceScreen, "name");
    generalInformationTable.setWidget(rowCount, 0, nameTextBox);
    rowCount++;

    // add input ports to general info with short example value
    portGUI = new PortGUI(serviceScreen, false);
    Widget inputPortTable = portGUI.createInputPortTable();
    generalInformationTable.setWidget(rowCount, 0, inputPortTable);
    rowCount++;

    // add output ports to general info
    portGUI = new PortGUI(serviceScreen, false);
    Widget outputPortTable = portGUI.createOutputPortTable();
    generalInformationTable.setWidget(rowCount, 0, outputPortTable);
    rowCount++;

    // add general tab 
    tabPanel.add(generalInformationTable, "General");
    //tabPanel.add(generalInformationTable, "<div>General</div>");
    tabPanel.add(generalInformationTable, new TabWidget("General"));

    // add request tab
    requestGui = new RequestGUI(this);
    Widget requestTable = requestGui.createRequestTable();
    tabPanel.add(requestTable, new TabWidget("Request"));
    //tabPanel.add(requestTable, "Request");

    // transformation tab
    transformationTable = new FlexTable();
    FlexCellFormatter transformationTableCellFormatter = transformationTable.getFlexCellFormatter();
    transformationTable.addStyleName("cw-FlexTable");
    transformationTable.setWidth("32em");
    transformationTable.setCellSpacing(5);
    transformationTable.setCellPadding(3);
    transformationTableCellFormatter.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT);
    transformationTableCellFormatter.setColSpan(0, 0, 2);

    int numRows = transformationTable.getRowCount();

    // Add translationtable
    ruleGUI = new RuleGUI(serviceScreen, requestHandler);
    ruleGUI_Panel = ruleGUI.createTranslationTable();
    transformationTable.setWidget(numRows, 1, ruleGUI_Panel);

    transformationTable.ensureDebugId("cwFlexTable");

    // Add into tabpanel
    //tabPanel.add(transformationTable, "Transformation");
    tabPanel.add(transformationTable, new TabWidget("Transformation"));

    // Add the Codegenerator and its UI (for XML at first)
    codeGenViewer = new CodeGenViewer(this, WrappingType.WRAP_AND_REQUEST_XML);
    codeGenViewer_Panel = codeGenViewer.createCodeGenViewer();

    //tabPanel.add(codeGenViewer_Panel, "CodeGen Viewer"); 
    tabPanel.add(codeGenViewer_Panel, new TabWidget("CodeGen Viewer"));
}

From source file:fr.aliasource.webmail.client.settings.VacationSetting.java

License:GNU General Public License

public VacationSetting(View ui) {
    // this.ui = ui;
    setWidth("100%");
    setStyleName("settingsTable");
    listeners = new ArrayList<ISettingChangeListener>();
    FlexTable hp = new FlexTable();
    vsb = new VacationStatusBox(listeners);
    hp.setWidget(1, 0, vsb);/* ww  w . jav  a  2 s  . c o m*/
    hp.getFlexCellFormatter().setColSpan(1, 0, 2);
    hp.setWidget(2, 0, new Label(I18N.strings.vacationText()));
    textArea = new TextArea();
    textArea.addKeyPressHandler(new KeyPressHandler() {
        @Override
        public void onKeyPress(KeyPressEvent event) {
            notifyChange();
        }
    });
    textArea.setWidth("400px");
    textArea.setHeight("100px");
    hp.setWidget(2, 1, textArea);
    hp.getCellFormatter().setAlignment(2, 0, HorizontalPanel.ALIGN_LEFT, VerticalPanel.ALIGN_TOP);
    add(hp);
}