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

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

Introduction

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

Prototype

public void setAnimationEnabled(boolean enable) 

Source Link

Usage

From source file:com.anzsoft.client.ui.LoginForm.java

License:Open Source License

private Widget createAdvancedForm() {
    iJabConstants constants = (iJabConstants) GWT.create(iJabConstants.class);
    // Create a table to layout the form options
    FlexTable layout = new FlexTable();
    layout.setCellSpacing(6);//from  w w  w.  j av a  2  s.co m
    layout.setWidth("300px");
    FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();

    // Add a title to the form
    /*
    layout.setHTML(0, 0,constants.iJabLogin());
    cellFormatter.setColSpan(0, 0, 2);
    cellFormatter.setHorizontalAlignment(0, 0,
        HasHorizontalAlignment.ALIGN_CENTER);
    */
    // Add some standard form options
    final TextBox userBox = new TextBox();
    userBox.setText("imdev");
    layout.setHTML(0, 0, constants.user());
    layout.setWidget(0, 1, userBox);
    final PasswordTextBox passBox = new PasswordTextBox();
    passBox.setText("imdev631");

    layout.setHTML(1, 0, constants.password());
    layout.setWidget(1, 1, passBox);

    // Create some advanced options
    Grid advancedOptions = new Grid(5, 2);
    advancedOptions.setCellSpacing(6);

    final TextBox hostBox = new TextBox();
    final TextBox portBox = new TextBox();
    final TextBox domainBox = new TextBox();
    final CheckBox authCheck = new CheckBox("SASL");
    authCheck.setChecked(false);

    hostBox.setEnabled(false);
    portBox.setEnabled(false);
    domainBox.setEnabled(false);
    authCheck.setEnabled(false);

    final CheckBox serverConfig = new CheckBox(constants.defineServerConfig());
    advancedOptions.setWidget(0, 0, serverConfig);
    serverConfig.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            if (serverConfig.isChecked()) {
                hostBox.setEnabled(true);
                portBox.setEnabled(true);
                domainBox.setEnabled(true);
                authCheck.setEnabled(true);
            } else {
                hostBox.setEnabled(false);
                portBox.setEnabled(false);
                domainBox.setEnabled(false);
                authCheck.setEnabled(false);
            }

        }

    });

    serverConfig.setChecked(false);

    advancedOptions.setHTML(1, 0, constants.domain());
    advancedOptions.setWidget(1, 1, hostBox);

    advancedOptions.setHTML(2, 0, constants.host());
    advancedOptions.setWidget(2, 1, portBox);

    advancedOptions.setHTML(3, 0, constants.port());
    advancedOptions.setWidget(3, 1, domainBox);

    advancedOptions.setWidget(4, 0, authCheck);

    // Add advanced options to form in a disclosure panel
    DisclosurePanel advancedDisclosure = new DisclosurePanel(constants.moreOptions());
    advancedDisclosure.setAnimationEnabled(true);
    advancedDisclosure.ensureDebugId("cwDisclosurePanel");
    advancedDisclosure.setContent(advancedOptions);
    layout.setWidget(2, 0, advancedDisclosure);

    Button loginButton = new Button(constants.login());

    layout.setWidget(3, 0, loginButton);
    loginButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
        public void componentSelected(ButtonEvent ce) {
            String user = userBox.getText();
            String pass = passBox.getText();
            String domain = domainBox.getText();
            String host = domainBox.getText();
            boolean sasl = authCheck.isChecked();
            if (serverConfig.isChecked()) {
                int port = Integer.parseInt(portBox.getText());
                //JabberApp.instance().onLogin(host, port, domain, sasl, user, pass);
            } else {
                //JabberApp.instance().onLogin(user, pass);
            }
        }

    });

    cellFormatter.setHorizontalAlignment(3, 0, HasHorizontalAlignment.ALIGN_CENTER);

    cellFormatter.setColSpan(3, 0, 2);

    return layout;
}

From source file:com.bramosystems.oss.player.core.client.ui.Logger.java

License:Apache License

/**
 * Constructs a Logger object/*from   w  w w.j  a  v a  2 s  .c  o m*/
 */
public Logger() {
    impl = GWT.create(LoggerConsoleImpl.class);

    // build the indicator...
    DisclosurePanel dp = new DisclosurePanel(imgpack.disclosurePanelOpen(), imgpack.disclosurePanelClosed(),
            "");
    dp.setAnimationEnabled(true);
    dp.setStyleName("");
    dp.add(impl.getConsole());
    initWidget(dp);
    setWidth("100%");
}

From source file:com.google.gwt.gwtai.demo.client.CounterAppletTab.java

License:Apache License

public CounterAppletTab() {
    VerticalPanel panelMain = new VerticalPanel();
    panelMain.setWidth("100%");
    panelMain.setSpacing(4);/* ww  w.jav a 2s.c o  m*/

    Button buttonInc = new Button("Increment");
    Button buttonDec = new Button("Decrement");
    Button buttonGet = new Button("Get current count");

    final CounterApplet counterApplet = (CounterApplet) GWT.create(CounterApplet.class);

    buttonInc.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            counterApplet.increment();
        }
    });

    buttonDec.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            counterApplet.decrement();
        }
    });

    buttonGet.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            Object value = counterApplet.getCurrentValue();

            DialogBox dialogBox = createDialogBox(value);
            dialogBox.center();
            dialogBox.show();
        }
    });

    HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.setSpacing(4);
    buttonPanel.add(buttonInc);
    buttonPanel.add(buttonDec);
    buttonPanel.add(buttonGet);

    Widget widgetApplet = AppletJSUtil.createAppletWidget(counterApplet);
    Label labelTitle = new Label(
            "To call a method on an applet object from within your GWT code - a piece of cake!");
    DisclosurePanel panelCode = new DisclosurePanel("View code");
    panelCode.setWidth("100%");
    panelCode.setAnimationEnabled(true);
    panelCode.setContent(createCodeHTML());

    panelMain.add(labelTitle);
    panelMain.add(widgetApplet);
    panelMain.add(buttonPanel);
    panelMain.add(panelCode);

    panelMain.setCellHorizontalAlignment(labelTitle, VerticalPanel.ALIGN_CENTER);
    panelMain.setCellHorizontalAlignment(widgetApplet, VerticalPanel.ALIGN_CENTER);
    panelMain.setCellHorizontalAlignment(buttonPanel, VerticalPanel.ALIGN_CENTER);

    initWidget(panelMain);
}

From source file:com.google.gwt.gwtai.demo.client.JavaFXDemo.java

License:Apache License

public void onModuleLoad() {
    DecoratedTabPanel tabPanel = new DecoratedTabPanel();
    tabPanel.setWidth("800px");

    tabPanel.getDeckPanel().setAnimationEnabled(true);

    VerticalPanel panelMain = new VerticalPanel();
    panelMain.setWidth("100%");
    panelMain.setSpacing(4);/*from w w w  .  ja v  a 2 s  .  c  o  m*/

    JavaFXApplet javaFxApplet = (JavaFXApplet) GWT.create(JavaFXApplet.class);

    Widget widgetApplet = AppletJSUtil.createAppletWidget(javaFxApplet);

    panelMain.add(new HTML(
            "This demo is featuring a " + "<a href=\"http://www.sun.com/software/javafx/\">JavaFX</a> applet "
                    + "integrated into a <a href=\"http://code.google.com/webtoolkit/\">Goolge Web"
                    + " Toolkit</a> application using the "
                    + "<a href=\"http://code.google.com/p/gwtai/\">gwtai project</a>."));
    panelMain.add(widgetApplet);
    panelMain.setCellHorizontalAlignment(widgetApplet, VerticalPanel.ALIGN_CENTER);

    DisclosurePanel panelCode = new DisclosurePanel("View code");
    panelCode.setWidth("100%");
    panelCode.setAnimationEnabled(true);
    panelCode.setContent(createCodeHTML());

    panelMain.add(panelCode);

    tabPanel.add(panelMain, "JavaFXDemo");

    tabPanel.selectTab(0);

    RootPanel.get().add(tabPanel);
}

From source file:com.google.gwt.gwtai.demo.client.StopWatchAppletTab.java

License:Apache License

public StopWatchAppletTab() {
    VerticalPanel panelMain = new VerticalPanel();
    panelMain.setWidth("100%");
    panelMain.setSpacing(4);//from   ww w.  j  a  v  a 2  s.  c  o  m

    VerticalPanel panelLaps = new VerticalPanel();
    panelLaps.setWidth("100%");
    panelLaps.setSpacing(4);

    Button buttonStart = new Button("Start");
    Button buttonStop = new Button("Stop");

    final StopWatchApplet stopWatchApplet = (StopWatchApplet) GWT.create(StopWatchApplet.class);

    buttonStart.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            stopWatchApplet.startWatch();
        }
    });

    buttonStop.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            stopWatchApplet.stopWatch();
        }
    });

    HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.setSpacing(4);
    buttonPanel.add(buttonStart);
    buttonPanel.add(buttonStop);

    Widget widgetApplet = AppletJSUtil.createAppletWidget(stopWatchApplet);
    AppletJSUtil.registerAppletCallback(stopWatchApplet, new StopWatchCallback(panelLaps));

    Label labelTitle = new Label(
            "Register a callback object to notify GWT of changes from within the Applet code.");
    DisclosurePanel panelCode = new DisclosurePanel("View code");
    panelCode.setWidth("100%");
    panelCode.setAnimationEnabled(true);
    panelCode.setContent(createCodeHTML());

    panelMain.add(labelTitle);
    panelMain.add(widgetApplet);
    panelMain.add(buttonPanel);
    panelMain.add(panelLaps);
    panelMain.add(panelCode);

    panelMain.setCellHorizontalAlignment(labelTitle, VerticalPanel.ALIGN_CENTER);
    panelMain.setCellHorizontalAlignment(widgetApplet, VerticalPanel.ALIGN_CENTER);
    panelMain.setCellHorizontalAlignment(panelLaps, VerticalPanel.ALIGN_CENTER);
    panelMain.setCellHorizontalAlignment(buttonPanel, VerticalPanel.ALIGN_CENTER);

    initWidget(panelMain);
}

From source file:com.google.gwt.gwtai.demo.client.TrayIconAppletTab.java

License:Apache License

public TrayIconAppletTab() {
    VerticalPanel panelMain = new VerticalPanel();
    panelMain.setWidth("100%");
    panelMain.setSpacing(4);/*from  w  w  w.j a v a 2 s.c om*/

    _trayIconApplet = (TrayIconApplet) GWT.create(TrayIconApplet.class);

    Widget widgetApplet = AppletJSUtil.createAppletWidget(_trayIconApplet);

    Label labelTitle = new Label(
            "Hook into the desktop tray from a GWT application. This is a 'Proof of Concept', the feature is not finished yet.");
    DisclosurePanel panelCode = new DisclosurePanel("View code");
    panelCode.setWidth("100%");
    panelCode.setAnimationEnabled(true);
    panelCode.setContent(createCodeHTML());

    HorizontalPanel panelItems = new HorizontalPanel();
    panelItems.setSpacing(4);

    final TextBox boxCaption = new TextBox();

    final ListBox boxItemType = new ListBox();
    boxItemType.addItem("Text");
    boxItemType.addItem("CheckBox");
    boxItemType.setSelectedIndex(0);

    Button buttonAdd = new Button("Add menu item");

    buttonAdd.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            String caption = boxCaption.getText();

            if (null == caption || caption.length() < 1) {
                Window.alert("Caption can not be empty");
            } else {
                String itemType = boxItemType.getItemText(boxItemType.getSelectedIndex());

                if (itemType.equals("CheckBox")) {
                    _trayIconApplet.addCheckBoxItem(caption);
                } else {
                    _trayIconApplet.addTextItem(caption);
                }
            }
        }
    });

    Button buttonSeparator = new Button("Add separator");
    buttonSeparator.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            _trayIconApplet.addSeparator();
        }
    });

    panelItems.add(boxCaption);
    panelItems.add(boxItemType);
    panelItems.add(buttonAdd);
    panelItems.add(buttonSeparator);

    panelMain.add(labelTitle);
    panelMain.add(widgetApplet);
    panelMain.add(panelItems);
    panelMain.add(panelCode);

    panelMain.setCellHorizontalAlignment(labelTitle, VerticalPanel.ALIGN_CENTER);
    panelMain.setCellHorizontalAlignment(widgetApplet, VerticalPanel.ALIGN_CENTER);

    initWidget(panelMain);
}

From source file:com.google.gwt.sample.showcase.client.content.panels.CwDisclosurePanel.java

License:Apache License

/**
 * Create a form that contains undisclosed advanced options.
 *//*from ww  w. j  a va2 s. co  m*/
@ShowcaseSource
private Widget createAdvancedForm() {
    // Create a table to layout the form options
    FlexTable layout = new FlexTable();
    layout.setCellSpacing(6);
    layout.setWidth("300px");
    FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();

    // Add a title to the form
    layout.setHTML(0, 0, constants.cwDisclosurePanelFormTitle());
    cellFormatter.setColSpan(0, 0, 2);
    cellFormatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);

    // Add some standard form options
    layout.setHTML(1, 0, constants.cwDisclosurePanelFormName());
    layout.setWidget(1, 1, new TextBox());
    layout.setHTML(2, 0, constants.cwDisclosurePanelFormDescription());
    layout.setWidget(2, 1, new TextBox());

    // Create some advanced options
    HorizontalPanel genderPanel = new HorizontalPanel();
    String[] genderOptions = constants.cwDisclosurePanelFormGenderOptions();
    for (int i = 0; i < genderOptions.length; i++) {
        genderPanel.add(new RadioButton("gender", genderOptions[i]));
    }
    Grid advancedOptions = new Grid(2, 2);
    advancedOptions.setCellSpacing(6);
    advancedOptions.setHTML(0, 0, constants.cwDisclosurePanelFormLocation());
    advancedOptions.setWidget(0, 1, new TextBox());
    advancedOptions.setHTML(1, 0, constants.cwDisclosurePanelFormGender());
    advancedOptions.setWidget(1, 1, genderPanel);

    // Add advanced options to form in a disclosure panel
    DisclosurePanel advancedDisclosure = new DisclosurePanel(constants.cwDisclosurePanelFormAdvancedCriteria());
    advancedDisclosure.setAnimationEnabled(true);
    advancedDisclosure.ensureDebugId("cwDisclosurePanel");
    advancedDisclosure.setContent(advancedOptions);
    layout.setWidget(3, 0, advancedDisclosure);
    cellFormatter.setColSpan(3, 0, 2);

    // Wrap the contents in a DecoratorPanel
    DecoratorPanel decPanel = new DecoratorPanel();
    decPanel.setWidget(layout);
    return decPanel;
}

From source file:com.google.testing.testify.risk.frontend.client.view.impl.CapabilityDetailsViewImpl.java

License:Apache License

private Widget buildTestHeaderWidget(String header, String addText) {
    final ListBox options = new ListBox();
    for (TestCase test : otherTests) {
        options.addItem(test.getExternalId() + " " + test.getTitle(), String.valueOf(test.getInternalId()));
    }/*from   w  w  w.  j av  a2s  .c  o m*/
    VerticalPanel addForm = new VerticalPanel();
    addForm.add(options);

    final DisclosurePanel disclosure = new DisclosurePanel();
    Button button = new Button(" Add ", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            long id = Long.parseLong((options.getValue(options.getSelectedIndex())));
            presenter.assignTestCaseToCapability(capability.getCapabilityId(), id);
            disclosure.setOpen(false);
            TestCase test = getTestCaseById(id);
            test.setTargetCapabilityId(capability.getCapabilityId());
            refresh();
        }
    });
    addForm.add(button);
    disclosure.setAnimationEnabled(true);
    disclosure.setOpen(false);
    disclosure.setContent(addForm);

    HorizontalPanel title = new HorizontalPanel();
    title.add(new Label(header));
    addTestAnchor = new Anchor(addText);
    addTestAnchor.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            disclosure.setOpen(!disclosure.isOpen());
        }
    });
    addTestAnchor.setVisible(isEditable);
    title.add(addTestAnchor);

    VerticalPanel everything = new VerticalPanel();
    everything.add(title);
    everything.add(disclosure);
    return everything;
}

From source file:com.google.testing.testify.risk.frontend.client.view.impl.CapabilityDetailsViewImpl.java

License:Apache License

private Widget buildBugHeaderWidget(String header, String addText) {
    final ListBox options = new ListBox();
    for (Bug bug : otherBugs) {
        options.addItem(bug.getExternalId() + " " + bug.getTitle(), String.valueOf(bug.getInternalId()));
    }/*from  w w w  . java  2s  . co m*/
    VerticalPanel addForm = new VerticalPanel();
    addForm.add(options);

    final DisclosurePanel disclosure = new DisclosurePanel();
    Button button = new Button(" Add ", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            long id = Long.parseLong((options.getValue(options.getSelectedIndex())));
            presenter.assignBugToCapability(capability.getCapabilityId(), id);
            disclosure.setOpen(false);
            Bug bug = getBugById(id);
            bug.setTargetCapabilityId(capability.getCapabilityId());
            refresh();
        }
    });
    addForm.add(button);
    disclosure.setAnimationEnabled(true);
    disclosure.setOpen(false);
    disclosure.setContent(addForm);

    HorizontalPanel title = new HorizontalPanel();
    title.add(new Label(header));
    addBugAnchor = new Anchor(addText);
    addBugAnchor.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            disclosure.setOpen(!disclosure.isOpen());
        }
    });
    addBugAnchor.setVisible(isEditable);
    title.add(addBugAnchor);

    VerticalPanel everything = new VerticalPanel();
    everything.add(title);
    everything.add(disclosure);
    return everything;
}

From source file:com.google.testing.testify.risk.frontend.client.view.impl.CapabilityDetailsViewImpl.java

License:Apache License

private Widget buildCheckinHeaderWidget(String header, String addText) {
    final ListBox options = new ListBox();
    for (Checkin checkin : otherCheckins) {
        options.addItem(checkin.getExternalId() + " " + checkin.getSummary(),
                String.valueOf(checkin.getInternalId()));
    }/*from   w  w  w.  j a v  a  2  s .  co m*/
    VerticalPanel addForm = new VerticalPanel();
    addForm.add(options);

    final DisclosurePanel disclosure = new DisclosurePanel();
    Button button = new Button(" Add ", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            long id = Long.parseLong((options.getValue(options.getSelectedIndex())));
            presenter.assignCheckinToCapability(capability.getCapabilityId(), id);
            disclosure.setOpen(false);
            Checkin checkin = getCheckinById(id);
            checkin.setTargetCapabilityId(capability.getCapabilityId());
            refresh();
        }
    });
    addForm.add(button);
    disclosure.setAnimationEnabled(true);
    disclosure.setOpen(false);
    disclosure.setContent(addForm);

    HorizontalPanel title = new HorizontalPanel();
    title.add(new Label(header));
    addCheckinAnchor = new Anchor(addText);
    addCheckinAnchor.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            disclosure.setOpen(!disclosure.isOpen());
        }
    });
    addCheckinAnchor.setVisible(isEditable);
    title.add(addCheckinAnchor);

    VerticalPanel everything = new VerticalPanel();
    everything.add(title);
    everything.add(disclosure);
    return everything;
}