Example usage for com.google.gwt.user.client.ui VerticalPanel setCellHeight

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

Introduction

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

Prototype

public void setCellHeight(IsWidget w, String height) 

Source Link

Document

Overloaded version for IsWidget.

Usage

From source file:com.audata.client.record.RecordListPanel.java

License:Open Source License

public RecordListPanel(String subtitle, JSONArray records, String method, JSONArray params, String uuid,
        String criteria) {/*from   w w  w  . j a  v a2 s  . c  o  m*/
    this.main = new VerticalPanel();
    this.count = 0;
    this.subtitle = subtitle;
    this.method = method;
    this.params = params;
    this.uuid = uuid;
    this.setSize("100%", "100%");
    this.main.setSize("100%", "100%");
    this.main.setSpacing(4);
    HorizontalPanel title = new HorizontalPanel();
    title.setSpacing(4);
    title.setWidth("100%");
    Label l = new Label(LANG.records_Text());
    l.addStyleName("audoc-sectionTitle");
    title.add(l);
    title.setCellHorizontalAlignment(l, HasAlignment.ALIGN_LEFT);
    this.countLabel = new Label(this.subtitle + "\n " + LANG.rec_count_Text() + ": " + this.count);
    this.countLabel.addStyleName("audoc-sectionSubTitle");
    title.add(this.countLabel);
    title.setCellHorizontalAlignment(this.countLabel, HasAlignment.ALIGN_RIGHT);
    this.main.add(title);
    this.getCount();

    if (criteria != null) {
        Label critLabel = new Label(LANG.criteria_Text() + ": [" + criteria + "]");
        critLabel.setWidth("100%");
        critLabel.addStyleName("audoc-criteria");
        this.main.add(critLabel);
    }
    HorizontalPanel hp = new HorizontalPanel();
    this.main.add(hp);

    hp.setVerticalAlignment(HasAlignment.ALIGN_TOP);
    hp.setSize("100%", "100%");
    hp.setSpacing(4);

    VerticalPanel vp = new VerticalPanel();
    //vp.setSpacing(4);
    vp.setSize("100%", "100%");
    vp.add(this.buildMenu());
    String template = "<span class=\"audoc-record-title\">#0 [#1]</span><br/>"
            + "<span class=\"audoc-record-class\">#2</span><br/>" + "<span class=\"audoc-record-cot\">"
            + LANG.with_Text() + ": #3<span>";
    this.rList = new HTMLButtonList("images/48x48/rectypes.gif", template, true);
    this.rList.addStyleName("audoc-recList");
    vp.add(this.rList);
    this.rList.setSize("100%", "90%");
    vp.setCellHeight(this.rList, "100%");
    hp.add(vp);
    this.addRecords(records);

    Panel cPanel = this.buildCommands();

    hp.add(cPanel);
    //cPanel.setWidth("150px");
    hp.setCellWidth(cPanel, "250px");
    hp.setCellWidth(this.rList, "100%");
    this.add(main);
    this.addKeyboardListener(this);
}

From source file:com.choicetrax.client.display.panels.decorators.BoxTabPanel.java

License:Apache License

/**
 * Creates an empty tab panel.//from   w w  w  .  j ava2  s  .  c  om
 */
public BoxTabPanel() {
    boxPanel = new BoxDecoratorPanel(deck);

    VerticalPanel panel = new VerticalPanel();
    panel.add(tabBar);
    panel.add(boxPanel);

    panel.setCellHeight(boxPanel, "100%");
    tabBar.setWidth("100%");

    tabBar.addTabListener(this);
    initWidget(panel);
    setStyleName("gwt-TabPanel");
    deck.setStyleName("gwt-TabPanelBottom");
    // Add a11y role "tabpanel"
    Accessibility.setRole(boxPanel.getElement(), Accessibility.ROLE_TABPANEL);
}

From source file:com.edgenius.wiki.gwt.client.portal.PortletListDialogue.java

License:Open Source License

public PortletListDialogue(boolean anonymousLogin) {

    this.setText(Msg.consts.more_space_dialog_title());
    this.setIcon(new Image(IconBundle.I.get().application_add()));

    FlexTable topPanel = new FlexTable();
    Label label1 = new Label(Msg.consts.search_space_widget());
    label1.setStyleName(Css.FORM_LABEL);
    topPanel.setWidget(0, 0, label1);/*from www .  jav  a  2  s . c  o  m*/
    label1.setWordWrap(false);

    filter.setStyleName(Css.SEARCH_INPUT);
    topPanel.setWidget(0, 1, filter);

    filter.setTitle(Msg.consts.input_keyword());
    filter.addKeyDownHandler(new KeyDownHandler() {
        public void onKeyDown(KeyDownEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
                keyword = filter.getText();
                if (keyword == null || keyword.trim().length() == 0)
                    return;

                searchBusyImg.setVisible(true);
                SearchControllerAsync action = ControllerFactory.getSearchController();
                //first page, return 10
                action.searchWidgetSpace(keyword, 0, SPACE_LIST_SIZE, new SpaceSearchAsync());
                tabPanel.selectTab(TAB_SEARCH);
            }
        }
    });

    topPanel.getFlexCellFormatter().setWidth(0, 0, "1%");
    topPanel.getFlexCellFormatter().setWordWrap(0, 0, false);
    topPanel.getFlexCellFormatter().setWidth(0, 1, "97%");
    int topPanelColume = 2;

    if (!anonymousLogin) {
        //so far, don't allow anonyomus to create widgets
        ClickLink newWidgetLn = new ClickLink(Msg.consts.create_widget());
        newWidgetLn.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                PortletCreateDialog dia = new PortletCreateDialog(null);
                //inherent all listener from parent, so that new portlet can add to dashboard
                for (ListDialogueListener listener : listeners) {
                    dia.addListDialogueListener(listener);
                }
                //close PortletListDialog -- don't ask 2 dialog open at same time
                hidebox();
                dia.showbox();
            }
        });
        topPanel.setWidget(0, 2, new Image(IconBundle.I.get().star()));
        topPanel.setWidget(0, 3, newWidgetLn);
        topPanel.getFlexCellFormatter().setWidth(0, 2, "1%");
        topPanel.getFlexCellFormatter().setWidth(0, 3, "1%");
        topPanel.getFlexCellFormatter().setWordWrap(0, 3, false);
        topPanelColume = 4;
    }

    //candidate list after user chooses
    topPanel.setWidget(1, 0, candidatePanel);
    topPanel.getFlexCellFormatter().setColSpan(1, 0, topPanelColume);

    Button okBtn = new Button(Msg.consts.ok(), ButtonIconBundle.tickImage());
    okBtn.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            hidebox();
            //collect data(PortletModel) from candidate panel 
            List values = candidatePanel.getCandidates();

            //reverse value: because the portlet insert before the one which has same row number, 
            //so far all portlets row are all 0. So, reverse them, so that first chosen portlet will display ahead others
            List portlets = new ArrayList();
            int size = values.size();
            for (int idx = size - 1; idx >= 0; idx--) {
                portlets.add(values.get(idx));
            }
            //fire event, tell observer to update portlet
            for (Iterator<ListDialogueListener> iter = listeners.iterator(); iter.hasNext();) {
                ListDialogueListener lis = iter.next();
                lis.dialogClosed(PortletListDialogue.this, portlets);
            }
        }
    });
    Button cancelBtn = new Button(Msg.consts.cancel(), ButtonIconBundle.crossImage());
    cancelBtn.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            PortletListDialogue.this.hidebox();
        }
    });

    getButtonBar().add(cancelBtn);
    getButtonBar().add(okBtn);

    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //               Popular Tab
    VerticalPanel pPanel = new VerticalPanel();
    pPanel.add(popularBusyImg);
    popularBusyImg.setVisible(true);
    pPanel.add(popularTable);
    initTable(popularTable, false);

    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //               Search Tab
    VerticalPanel rPanel = new VerticalPanel();
    HorizontalPanel h1 = new HorizontalPanel();
    pagination.addPaginationListener(new SearchPaginationCallback());
    pagination.setPageSize(SPACE_LIST_SIZE);
    h1.add(pagination);
    h1.add(summary);
    h1.setSpacing(5);

    rPanel.add(searchBusyImg);
    searchBusyImg.setVisible(false);
    rPanel.add(searchRsTable);
    rPanel.add(rsMessage);
    rPanel.add(h1);
    initTable(widgetTable, true);

    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //               Widget Tab
    VerticalPanel wPanel = new VerticalPanel();
    widgetBusyImg.setVisible(false);
    wPanel.add(widgetBusyImg);
    wPanel.add(widgetTable);
    initTable(widgetTable, false);

    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //               Tab panel
    tabPanel.add(pPanel, Msg.consts.popular_spaces());
    tabPanel.add(wPanel, Msg.consts.widgets());
    tabPanel.add(rPanel, Msg.consts.search_result());
    tabPanel.selectTab(TAB_POPULAR);

    VerticalPanel panel = new VerticalPanel();
    panel.add(message);
    panel.add(topPanel);
    panel.add(tabPanel);

    pPanel.setHeight("1%");
    wPanel.setHeight("1%");
    rPanel.setHeight("1%");
    tabPanel.setWidth("100%");
    panel.setSize("100%", "98%");
    panel.setCellHeight(tabPanel, "100%");

    topPanel.setStyleName(Css.BOX);
    tabPanel.addSelectionHandler(this);
    panel.setSpacing(5);

    this.addStyleName(Css.PORTLET_DIALOG_BOX);

    this.setWidget(panel);

    SpaceControllerAsync spaceController = ControllerFactory.getSpaceController();
    spaceController.getSpacesInfo(null, SPACE_LIST_SIZE, null, new PopularCallback());

}

From source file:com.edgenius.wiki.gwt.client.widgets.HelpDialog.java

License:Open Source License

public HelpDialog() {
    this.setText(Msg.consts.help() + " - " + Msg.consts.press() + " F1");
    this.setIcon(new Image(IconBundle.I.get().help()));
    Frame syntax = new Frame(showHtmlPage("static/syntax.html"));
    Frame key = new Frame(showHtmlPage("static/keys.html"));

    DOM.setElementAttribute(syntax.getElement(), "frameborder", "0");
    DOM.setElementAttribute(key.getElement(), "frameborder", "0");

    FlowPanel sbar = new FlowPanel();
    Image sImg1 = new Image(IconBundle.I.get().home_link());
    sbar.add(sImg1);/*  www.  ja  v  a 2s.  c  o  m*/
    HTML sHome = new HTML(
            "<a href='http://geniuswiki.com/page/GeniusWiki+document/GeniusWiki+document' target='_blank'> "
                    + Msg.consts.online_help() + "</a>");
    sbar.add(sHome);
    //the latter one display first!
    sbar.add(sPop);
    sbar.add(sImg);

    sbar.setWidth("100%");
    sImg1.setStyleName(Css.LEFT);
    sHome.setStyleName(Css.LEFT);
    sImg.setStyleName(Css.RIGHT);
    sPop.setStyleName(Css.RIGHT);
    sImg.addClickHandler(this);
    sPop.addClickHandler(this);

    FlowPanel kbar = new FlowPanel();
    Image kImg1 = new Image(IconBundle.I.get().home_link());
    HTML kHome = new HTML(
            "<a href='http://geniuswiki.com/page/GeniusWiki+document/GeniusWiki+document' target='_blank'> "
                    + Msg.consts.online_help() + "</a>");
    kbar.add(kImg1);
    kbar.add(kHome);

    //the latter one display first!
    kbar.add(kPop);
    kbar.add(kImg);
    kbar.setWidth("100%");

    kImg1.setStyleName(Css.LEFT);
    kHome.setStyleName(Css.LEFT);
    kImg.setStyleName(Css.RIGHT);
    kPop.setStyleName(Css.RIGHT);
    kImg.addClickHandler(this);
    kPop.addClickHandler(this);

    VerticalPanel syntaxPanel = new VerticalPanel();
    syntaxPanel.add(sbar);
    syntaxPanel.add(syntax);
    syntaxPanel.setCellHeight(sbar, "30px");
    syntaxPanel.setCellHeight(syntax, "100%");

    VerticalPanel keyPanel = new VerticalPanel();
    keyPanel.add(kbar);
    keyPanel.add(key);
    keyPanel.setCellHeight(kbar, "30px");
    keyPanel.setCellHeight(key, "100%");

    DecoratedTabPanel deck = new DecoratedTabPanel();
    deck.add(syntaxPanel, Msg.consts.markup());
    deck.add(keyPanel, Msg.consts.keyboard());

    //show markup panel
    deck.selectTab(0);
    this.setWidget(deck);

    syntax.setSize("100%", "100%");
    key.setSize("100%", "100%");
    deck.addStyleName(Css.DECK);
    this.addStyleName(Css.HELP_DIALOG_BOX);

}

From source file:com.google.appinventor.client.output.OdeLog.java

License:Open Source License

/**
 * Creates a new output panel for displaying internal messages.
 *///from  ww w  .ja v  a  2  s. com
private OdeLog() {
    // Initialize UI
    Button clearButton = new Button(MESSAGES.clearButton());
    clearButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            clear();
        }
    });

    text = new HTML();
    text.setWidth("100%");

    VerticalPanel panel = new VerticalPanel();
    panel.add(clearButton);
    panel.add(text);
    panel.setSize("100%", "100%");
    panel.setCellHeight(text, "100%");
    panel.setCellWidth(text, "100%");

    initWidget(panel);
}

From source file:com.google.gwt.gears.sample.gwtnote.client.ui.RichTextWidget.java

License:Apache License

/**
 * Creates a new widget. This class needs access to certain fields and methods
 * on the application enclosing it.//from w w  w  .ja v a2  s  . c o m
 * 
 * @param parent the host application
 */
public RichTextWidget(final GWTNote parent) {
    super();

    VerticalPanel top = new VerticalPanel();
    top.setWidth("100%");
    HorizontalPanel header = new HorizontalPanel();
    top.add(header);
    header.setWidth("100%");

    header.add(new Label("GWT GearsNote"));

    header.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    status = new Label("Ready");
    header.add(status);

    this.bodyWidget = new RichTextArea();
    bodyWidget.addKeyboardListener(new KeyboardListenerAdapter() {
        @Override
        public void onKeyPress(Widget sender, char keyCode, int modifiers) {
            String newText = bodyWidget.getText();
            if (((newText == null) && (curText != null)) || ((newText != null) && !newText.equals(curText))) {
                curText = newText;
            }
        }
    });

    HorizontalPanel controls = new HorizontalPanel();
    RichTextToolbar tb = new RichTextToolbar(this.bodyWidget);
    name = new TextBox();
    name.setText("default");
    name.setEnabled(false);
    nameEdit = new PushButton("Edit");
    nameEdit.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            String curName = name.getText();
            boolean doNotify = !oldName.equals(curName);
            if (!nameEditable) { // if becoming editable, store off current value
                oldName = curName;
            }
            if (nameEditable && (curName == null || "".equals(curName))) {
                // if becoming un-editable, check to make sure it's valid
                Window.alert("The note name cannot be blank. Please try again.");
                nameEdit.setText(oldName);
                return;
            }
            // if all else is good, just flip the state
            nameEditable = !nameEditable;
            name.setEnabled(nameEditable);
            nameEdit.getUpFace().setText((nameEditable ? "Confirm" : "Edit"));
            if (doNotify) {
                notifyNameListeners();
            }
        }
    });
    nameEdit.addStyleName("edit-button");

    options = new ListBox();
    controls.add(tb);
    options.addItem("default");
    options.setSelectedIndex(0);
    options.addChangeListener(new ChangeListener() {
        public void onChange(Widget sender) {
            String newName = options.getItemText(options.getSelectedIndex());
            name.setText(newName);
            notifyNameListeners();
        }
    });
    HorizontalPanel tmp = new HorizontalPanel();
    tmp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    tmp.add(new Label("Note name:"));
    tmp.add(name);
    tmp.add(nameEdit);
    tmp.add(options);
    controls.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    controls.setWidth("100%");
    controls.add(tmp);
    top.add(controls);

    top.add(bodyWidget);
    this.bodyWidget.setWidth("100%");
    top.setCellHeight(bodyWidget, ((int) (Window.getClientHeight() * .75)) + "px");
    this.bodyWidget.setHeight("100%");

    initWidget(top);
}

From source file:com.gwt.conn.client.Dashboard.java

/**
 * Called whenever a menu needs to be loaded. Parameter "message" is
 * displayed after loading.//from   w  w w  .  j  a  v a2  s .c  o m
 */
public static void loadMenu(final Menu menu, String message, boolean internet) {
    // this is used so that buttons don't do anything when clicked
    // if the contents that the button would load are already visible
    // need to use storage to save state of editor when interacting with
    // buttons
    storage.setItem("curDashPage", "vis"); // default to visual editor first

    // initialize panels for widgets to be placed in
    final VerticalPanel dashboardPan = new VerticalPanel();
    dashboardPan.addStyleName("marginlessPanel"); // interacts with Connfrontend.css

    dashboardPan.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    dashboardPan.setSize("100%", "100%");
    final HorizontalPanel buttonPan = new HorizontalPanel();
    buttonPan.addStyleName("marginPanel");

    // initialize buttons and put them into the button panel
    final Button visualButton = new Button("Visual Editor");
    final Button dataButton = new Button("Data Editor");
    visualButton.addStyleName("myButton");
    dataButton.addStyleName("myButton");
    buttonPan.add(visualButton);
    buttonPan.add(dataButton);

    // put the button panel in the dashboard panel
    dashboardPan.add(buttonPan);
    dashboardPan.setCellHeight(buttonPan, "0%");

    // get static instances of all possible editor app contents
    final Frame previewContent = Previewer.getPreviewer(menu);
    final HorizontalPanel visualContent = VisualEditor.getVisualEditor(menu, previewContent, internet);
    final HorizontalPanel dataContent = DataEditor.getDataEditor(menu);

    // put the dashboard panel in the root panel
    dashboardPan.add(visualContent); // load visual editor by default
    dashboardPan.setCellHeight(visualContent, "100%");
    RootPanel.get().add(dashboardPan, 0, 0);

    // handler for visualButton shows the visual editor
    class VisualHandler implements ClickHandler {
        public void onClick(ClickEvent event) {
            String cur = storage.getItem("curDashPage");
            if (cur.equals("dat")) {
                dashboardPan.remove(dataContent);
                storage.setItem("curDashPage", "vis");
                dashboardPan.add(visualContent);
                dashboardPan.setCellHeight(visualContent, "100%");
            }
        }
    }
    final VisualHandler visualHandler = new VisualHandler();
    visualButton.addClickHandler(visualHandler);

    // handler for dataButton shows the data editor
    class DataHandler implements ClickHandler {
        public void onClick(ClickEvent event) {
            String cur = storage.getItem("curDashPage");
            if (cur.equals("vis")) {
                dashboardPan.remove(visualContent);
                storage.setItem("curDashPage", "dat");
                dashboardPan.add(dataContent);
                dashboardPan.setCellHeight(dataContent, "100%");
            }
        }
    }

    final DataHandler dataHandler = new DataHandler();
    dataButton.addClickHandler(dataHandler);

    if (internet == false)
        showNoInternetError();
    // internet connection detected, so attach synchronize button to the dashboard
    else {
        // attach a push-to-server button
        final Button pushButton = new Button("Synchronize");
        pushButton.addStyleName("myButton");
        buttonPan.add(pushButton);
        class PushHandler implements ClickHandler {
            public void onClick(ClickEvent event) {

                boolean internetStill = Communicate.hasInternet();
                if (internetStill) {
                    // false because not authenticating
                    Communicate.sync(menu.getName(), storage.getItem("restID"), false);
                } else {
                    buttonPan.remove(pushButton);
                    showNoInternetError();
                }
            }
        }
        final PushHandler pushHandler = new PushHandler();
        pushButton.addClickHandler(pushHandler);

    }
}

From source file:com.gwttest.client.Demo.java

License:Open Source License

public void onModuleLoad() {
    final ChartWidget chart = new ChartWidget();

    HorizontalPanel hp = new HorizontalPanel();
    hp.setSpacing(10);//from   www .j a  v  a  2s.c  om

    VerticalPanel vp = new VerticalPanel();
    vp.setSpacing(20);
    // add home page
    HTML homeText = new HTML("<h2>Welcome to OFCGWT</h2>"
            + "<i>....the OpenFlashChart GWT Library</i></br></br>"
            + "This demonstration site will showcase the many different types of charts that can be inserted into a GWT application.");
    vp.add(homeText);
    vp.setCellHeight(homeText, "100");

    createPopupDialog();
    Button popup = new Button("Show 2nd Chart in Dialog");
    popup.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            popupDb.center();
            popupDb.show();
        }
    });
    vp.add(popup);

    Button image = new Button("Show Image of Chart");
    image.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {

            ImageServiceAsync imgService = (ImageServiceAsync) GWT.create(ImageService.class);
            ServiceDefTarget target = (ServiceDefTarget) imgService;
            target.setServiceEntryPoint(GWT.getHostPageBaseURL() + "ImageService");

            imgService.getImageToken(chart.getImageData(), new AsyncCallback<String>() {
                public void onFailure(Throwable caught) {
                }

                public void onSuccess(String result) {
                    createImageDialog(GWT.getHostPageBaseURL() + "image?var=img_" + result);
                }
            });
        }
    });
    vp.add(image);

    vp.add(new HTML("Update Speed <i>(0-off, 4-max)</i>"));
    final SliderBar slider = new SliderBar(0.0, 4.0);
    slider.setStepSize(1.0);
    slider.setCurrentValue(1.0);
    slider.setNumTicks(4);
    slider.setNumLabels(4);
    slider.setWidth("100%");
    vp.add(slider);

    hp.add(vp);
    hp.setCellWidth(vp, "300");

    // add chart
    VerticalPanel vp2 = new VerticalPanel();
    DecoratorPanel dp = new DecoratorPanel();
    SimplePanel chartPanel = new SimplePanel();
    chartPanel.setStylePrimaryName("chartPanel");
    chart.setSize("500", "400");
    chart.setChartData(getPieChartData());
    chartPanel.add(chart);
    dp.add(chartPanel);
    vp2.add(dp);
    vp2.add(new HTML("Chart's JSON data:"));
    ta = new TextArea();
    ta.setWidth("400");
    ta.setHeight("100");
    ta.setText(chart.getJsonData());
    vp2.add(ta);
    hp.add(vp2);

    VerticalPanel chartlist = new VerticalPanel();
    chartlist.setSpacing(5);
    Command cmd = new Command() {
        public void execute() {
            chart.setChartData(getPieChartData());
            ta.setText(chart.getJsonData());
        }
    };
    RadioButton rb = createRadioButton("PieChart - No Labels", cmd);
    updateCmd = cmd;
    rb.setValue(true);
    chartlist.add(rb);

    chartlist.add(createRadioButton("PieChart - Animate", new Command() {
        public void execute() {
            chart.setChartData(getAniPieChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("BarChart - Transparent", new Command() {
        public void execute() {
            chart.setChartData(getBarChartTransparentData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("BarChart - Glass", new Command() {
        public void execute() {
            chart.setChartData(getBarChartGlassData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("3DBarChart + Line", new Command() {
        public void execute() {
            chart.setChartData(get3DBarLineChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("CylinderChart", new Command() {
        public void execute() {
            chart.setChartData(getCylinderChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("CylinderChart - RoundGlass", new Command() {
        public void execute() {
            chart.setChartData(getCylinderChartGlassData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("LineChart - 3 Dot Types", new Command() {
        public void execute() {
            chart.setChartData(getLineChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("ScatterChart - Star Dot", new Command() {
        public void execute() {
            chart.setChartData(getScatterPointChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("ScatterChart - Line", new Command() {
        public void execute() {
            chart.setChartData(getScatterLineChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("RadarChart", new Command() {
        public void execute() {
            chart.setChartData(getRadarChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("Horizontal-BarChart", new Command() {
        public void execute() {
            chart.setChartData(getHorizBarChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("AreaChart - Hollow", new Command() {
        public void execute() {
            chart.setChartData(getAreaHollowChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("AreaChart - Line", new Command() {
        public void execute() {
            chart.setChartData(getAreaLineChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("SketchChart", new Command() {
        public void execute() {
            chart.setChartData(getSketchChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("StackChart", new Command() {
        public void execute() {
            chart.setChartData(getStackChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("HorizontalStackChart", new Command() {
        public void execute() {
            chart.setChartData(getHorizontalStackChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    hp.add(chartlist);
    hp.setCellWidth(chartlist, "300");

    RootPanel.get().add(hp);

    final Timer updater = new Timer() {
        public void run() {
            updateCmd.execute();
        }
    };
    updater.scheduleRepeating(3000);

    slider.addChangeListener(new ChangeListener() {
        public void onChange(Widget sender) {
            switch ((int) (slider.getCurrentValue())) {
            case 0:
                updater.cancel();
                break;

            case 1:
                updater.scheduleRepeating(3000);
                break;

            case 2:
                updater.scheduleRepeating(1000);
                break;

            case 3:
                updater.scheduleRepeating(200);
                break;

            case 4:
                updater.scheduleRepeating(50);
                break;
            }
        }
    });
}

From source file:com.gwttest.client.Events.java

License:Open Source License

public void onModuleLoad() {
    SimplePanel main = new SimplePanel();
    main.setHeight("100%");
    main.setWidth("100%");

    HorizontalPanel hp = new HorizontalPanel();
    hp.setSpacing(10);/*  www.ja v  a2  s.  c  o  m*/

    VerticalPanel vp = new VerticalPanel();
    // add home page
    HTML homeText = new HTML(
            "<h2>Welcome to OFCGWT</h2>" + "<i>....the OpenFlashChart GWT Library</i></br></br>"
                    + "This demonstration showcases the events \"onClick\" feature with a drill-down effect.");
    vp.add(homeText);
    vp.setCellHeight(homeText, "300");

    hp.add(vp);
    hp.setCellWidth(vp, "300");

    // add chart
    DecoratorPanel dp = new DecoratorPanel();
    SimplePanel pieSp = new SimplePanel();
    chart = new ChartWidget();
    chart.setSize("400", "300");
    pieSp.add(chart);
    dp.add(pieSp);
    hp.add(dp);

    VerticalPanel chartlist = new VerticalPanel();
    chartlist.setSpacing(5);

    resetBut = new Button("Reset", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            chart.setChartData(getPieChartLayer1());
        }
    });
    chartlist.add(chartLabel);
    chartlist.add(resetBut);

    ChartData cd = getPieChartLayer1();
    chart.setChartData(cd);

    hp.add(chartlist);
    hp.setCellWidth(chartlist, "300");

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

From source file:com.ikon.frontend.client.widget.popup.KeywordsPopup.java

License:Open Source License

/**
 * KeywordsPopup/*from  ww  w  . ja v  a  2s.  c o  m*/
 */
public KeywordsPopup() {
    // Establishes auto-close when click outside
    super(false, true);
    setText(Main.i18n("keyword.add"));

    // Status
    status = new Status(this);
    status.setStyleName("okm-StatusPopup");

    table = new FlexTable();
    table.setWidth("100%");
    table.setCellPadding(0);
    table.setCellSpacing(2);

    cellFormatter = table.getCellFormatter(); // Gets the cell formatter

    docKeywords = new ArrayList<String>();
    keywordMap = new HashMap<String, Widget>();
    keyWordsListPending = new ArrayList<String>();
    keywordsCloud = new TagCloud();
    keywordsCloud.setWidth("350");

    keywordPanel = new HorizontalPanel();
    multiWordkSuggestKey = new MultiWordSuggestOracle();
    keywordList = new ArrayList<String>();
    suggestKey = new SuggestBox(multiWordkSuggestKey);
    suggestKey.setHeight("20");
    suggestKey.setText(Main.i18n("dashboard.keyword.suggest"));
    suggestKey.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent event) {
            if ((char) KeyCodes.KEY_ENTER == event.getNativeKeyCode() && keyWordsListPending.isEmpty()) {
                Main.get().mainPanel.enableKeyShorcuts(); // Enables general
                // keys
                // applications
                String keys[] = suggestKey.getText().split(" "); // Separates
                // keywords
                // by
                // space
                for (int i = 0; i < keys.length; i++) {
                    keyWordsListPending.add(keys[i]);
                }
                addPendingKeyWordsList();
                suggestKey.setText("");
            }
        }
    });
    suggestKey.getTextBox().addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (suggestKey.getText().equals(Main.i18n("dashboard.keyword.suggest"))) {
                suggestKey.setText("");
            }
            Main.get().mainPanel.disableKeyShorcuts(); // Disables key
            // shortcuts while
            // updating
        }
    });
    suggestKey.getTextBox().addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (suggestKey.getText().equals(Main.i18n("dashboard.keyword.suggest"))) {
                suggestKey.setText("");
            }

        }
    });

    suggestKey.getTextBox().addMouseOutHandler(new MouseOutHandler() {
        @Override
        public void onMouseOut(MouseOutEvent event) {
            if (!keyShortcutsEnabled) {
                Main.get().mainPanel.enableKeyShorcuts(); // Enables general
                // keys
                // applications
                keyShortcutsEnabled = true;
            }
        }
    });

    thesaurusImage = new Image(OKMBundleResources.INSTANCE.bookOpenIcon());
    thesaurusImage.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Main.get().mainPanel.desktop.navigator.thesaurusTree.thesaurusSelectPopup
                    .show(ThesaurusSelectPopup.MASSIVE);
        }
    });

    VerticalPanel vPanel = new VerticalPanel();
    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.add(suggestKey);
    hPanel.add(new HTML("&nbsp;"));
    hPanel.add(thesaurusImage);
    hKeyPanel = new FlowPanel();
    HTML space = new HTML("");
    vPanel.add(hPanel);
    vPanel.add(space);
    vPanel.add(hKeyPanel);

    close = new Button(Main.i18n("button.close"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (Main.get().mainPanel.desktop.browser.fileBrowser.isMassive()) {
                Main.get().mainPanel.topPanel.toolBar.executeRefresh();
                Main.get().mainPanel.dashboard.keyMapDashboard.refreshAll();
            }
            Main.get().mainPanel.enableKeyShorcuts();
            hide();
        }
    });
    close.setStyleName("okm-NoButton");

    hKeyPanel.setWidth("250");
    vPanel.setCellHeight(space, "5");

    keywordPanel.add(vPanel);

    table.setHTML(0, 0, "<b>" + Main.i18n("document.keywords") + "</b>");
    table.setWidget(0, 1, keywordPanel);
    cellFormatter.setVerticalAlignment(0, 0, HasAlignment.ALIGN_TOP);
    table.setHTML(1, 0, "");
    table.getFlexCellFormatter().setHeight(1, 0, "5");
    table.setHTML(2, 0, "<b>" + Main.i18n("document.keywords.cloud") + "</b>");
    table.getFlexCellFormatter().setColSpan(2, 0, 2);
    table.setWidget(3, 0, keywordsCloud);
    table.getFlexCellFormatter().setColSpan(3, 0, 2);
    cellFormatter.setHorizontalAlignment(3, 0, HasAlignment.ALIGN_LEFT);
    table.setWidget(4, 0, close);
    table.getFlexCellFormatter().setColSpan(4, 0, 2);
    cellFormatter.setHorizontalAlignment(4, 0, HasAlignment.ALIGN_CENTER);

    table.setStyleName("okm-DisableSelect");
    suggestKey.setStyleName("okm-KeyMap-Suggest");
    suggestKey.addStyleName("okm-Input");
    hKeyPanel.setStylePrimaryName("okm-cloudWrap");
    keywordsCloud.setStylePrimaryName("okm-cloudWrap");
    thesaurusImage.addStyleName("okm-Hyperlink");

    setWidget(table);
}