Example usage for com.google.gwt.user.client.ui TabPanel setAnimationEnabled

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

Introduction

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

Prototype

public void setAnimationEnabled(boolean enable) 

Source Link

Usage

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  www .j a  v  a  2s .  c  o m

    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.ui.renderer.TabPanelRenderer.java

License:Apache License

public UIObject render(ComponentGVO component, String uuid, String parent, String context) {
    TabPanel uiObject = null;
    if (component != null) {
        if (component instanceof TabPanelGVO) {
            TabPanelGVO gvo = (TabPanelGVO) component;
            if (gvo.getMenu() != null) {
                final ComponentGVO finalComponentGVO = component;
                final String finalUuid = uuid;
                final String finalParent = parent;
                uiObject = new TabPanel() {

                    @Override/*ww  w . ja va 2s.  co  m*/
                    public void onBrowserEvent(Event event) {
                        if (event.getTypeInt() == Event.ONCONTEXTMENU) {
                            DOM.eventPreventDefault(event);
                            applyContextMenu(event, finalComponentGVO, finalUuid, finalParent);
                        }
                        super.onBrowserEvent(event);
                    }

                    @Override
                    protected void setElement(Element elem) {
                        super.setElement(elem);
                        sinkEvents(Event.ONCONTEXTMENU);
                    }
                };
            } else {
                uiObject = new TabPanel();
            }
            uiObject.setAnimationEnabled(gvo.isAnimationEnabled());
            RendererHelper.fillIn(component, uiObject, uuid, parent, context);

            TabGVO[] tabs = gvo.getTabs();
            if (tabs != null) {
                for (int i = 0; i < tabs.length; i++) {
                    TabGVO tabGVO = tabs[i];

                    // since the panel renderer is used, the title (not null) will create a titledPanel.
                    // The tab already has the title so that is overkill
                    String title = tabGVO.getTitle();
                    tabGVO.setTitle(null);
                    UIObject tabUI = renderChildComponent(tabGVO, uuid, parent, context);
                    tabGVO.setTitle(title);

                    if (tabUI instanceof Widget) {
                        uiObject.add((Widget) tabUI, title);
                        setTabVisibility(uiObject, i, tabGVO.getVisible(), tabUI);

                        int tabCount = uiObject.getTabBar().getTabCount();
                        UIObject tabComponent = (UIObject) uiObject.getTabBar().getTab(tabCount - 1);
                        RendererHelper.addAttributesRequiredByEventHandling(tabGVO, tabComponent, uuid, parent,
                                context);
                        RendererHelper.addEvents(tabGVO, tabComponent, uuid);
                    }
                }
            }

            if (uiObject.getWidgetCount() > 0) {
                uiObject.selectTab(0);
            }
        }
    }
    return uiObject;
}

From source file:org.dataconservancy.dcs.access.client.model.JsEvent.java

License:Apache License

public static void display(Panel panel, JsArray<JsEvent> array) {
    if (array.length() == 1) {
        Widget w = array.get(0).display();
        w.setStylePrimaryName("Entity");
        panel.add(w);//from  w  w  w.  j  a v a 2  s. c  o  m
        return;
    }

    TabPanel tabs = new DecoratedTabPanel();
    tabs.setAnimationEnabled(true);

    for (int i = 0; i < array.length(); i++) {
        JsEvent event = array.get(i);

        tabs.add(event.display(), event.getEventType());
    }

    if (array.length() > 0) {
        tabs.selectTab(0);
    }

    panel.add(tabs);
}

From source file:org.dataconservancy.dcs.access.client.model.JsFile.java

License:Apache License

public static void display(Panel panel, JsArray<JsFile> array) {
    if (array.length() == 1) {
        Widget w = array.get(0).display();
        w.setStylePrimaryName("Entity");
        panel.add(w);//www  .  j av  a 2  s  .  c  o m
        return;
    }

    TabPanel tabs = new DecoratedTabPanel();
    ScrollPanel top = new ScrollPanel(tabs);
    top.setStylePrimaryName("Entity");

    tabs.setAnimationEnabled(true);

    for (int i = 0; i < array.length(); i++) {
        JsFile file = array.get(i);

        tabs.add(file.display(), file.getName());
    }

    if (array.length() > 0) {
        tabs.selectTab(0);
    }

    panel.add(top);
}

From source file:org.dataconservancy.dcs.access.client.model.JsManifestation.java

License:Apache License

public static void display(Panel panel, JsArray<JsManifestation> array) {
    if (array.length() == 1) {
        Widget w = array.get(0).display();
        w.setStylePrimaryName("Entity");
        panel.add(w);// ww w  .jav a  2 s .  c o m
        return;
    }

    TabPanel tabs = new DecoratedTabPanel();
    ScrollPanel top = new ScrollPanel(tabs);
    top.setStylePrimaryName("Entity");
    tabs.setAnimationEnabled(true);

    for (int i = 0; i < array.length(); i++) {
        JsManifestation man = array.get(i);

        tabs.add(man.display(), man.summary());
    }

    if (array.length() > 0) {
        tabs.selectTab(0);
    }

    panel.add(top);
}

From source file:org.xwiki.gwt.wysiwyg.client.WysiwygEditor.java

License:Open Source License

/**
 * Build the editor tab panel. This panel contains two tabs, one for the WYSIWYG editor and one for the source
 * editor.//from  w w  w .  j  a v a2 s . c  o m
 * 
 * @return the newly created tab panel
 */
private TabPanel createTabPanel() {
    PlainTextEditor plainTextEditor = new PlainTextEditor(config.getHook());

    TabPanel tabs = new TabPanel();
    tabs.add(getRichTextEditor(), Strings.INSTANCE.wysiwyg());
    tabs.add(plainTextEditor, Strings.INSTANCE.source());
    tabs.setStyleName("xRichTextEditorTabPanel");
    tabs.setAnimationEnabled(false);
    tabs.selectTab(config.getSelectedTabIndex());

    // Enable the appropriate text area based on the type of input (source or HTML).
    boolean richTextAreaEnabled = config.isInputConverted();
    plainTextEditor.getTextArea().setEnabled(!richTextAreaEnabled);
    getRichTextEditor().getTextArea().setEnabled(richTextAreaEnabled);

    saveRegistration(tabs.addBeforeSelectionHandler(switcher));
    saveRegistration(tabs.addSelectionHandler(new SelectionHandler<Integer>() {
        public void onSelection(SelectionEvent<Integer> event) {
            // Cache the active text area.
            config.setSelectedTabIndex(event.getSelectedItem());
        }
    }));
    saveRegistration(tabs.addSelectionHandler(switcher));

    return tabs;
}

From source file:tv.dyndns.kishibe.qmaclone.client.chat.PanelChat.java

License:Open Source License

public PanelChat() {
    setWidth("800px");

    add(new Label("?(??ON/OFF?????)"));

    if (SharedData.get().isAdministoratorMode()) {
        final TabPanel panel = new TabPanel();
        panel.setAnimationEnabled(true);
        panel.add(new LazyPanel() {
            @Override//from   www.  j av  a2  s .c om
            protected Widget createWidget() {
                return new PanelRealtime();
            }
        }, "");
        panel.add(new LazyPanel() {
            @Override
            protected Widget createWidget() {
                return new PanelPast();
            }
        }, "?");
        panel.selectTab(0);
        add(panel);
    } else {
        add(new PanelRealtime());
    }
}