private void populate(HTML html) {
   if (getWidth() != null) {
     html.setWidth(getWidth());
   }
   if (getHeight() != null) {
     html.setHeight(getHeight());
   }
 }
  private VerticalPanel createForm() {

    final VerticalPanel form = new VerticalPanel();
    form.setStyleName("formPanel");

    final HorizontalPanel titleLine = new HorizontalPanel();
    final HTML textNoteTitle = new HTML("Title: ");
    textNoteTitle.setWidth("50px");
    titleLine.add(textNoteTitle);
    titleLine.add(inputNoteTitle);

    final HorizontalPanel textLine = new HorizontalPanel();
    final HTML textNoteText = new HTML("Note: ");
    textNoteText.setWidth("50px");
    textLine.add(textNoteText);
    textLine.add(inputNoteText);

    form.add(titleLine);
    form.add(textLine);
    form.add(createButtons());

    return form;
  }
 public ProgressBar(String text) {
   FlowPanel pane = new FlowPanel();
   pane.getElement().getStyle().setPosition(Position.RELATIVE);
   initWidget(pane);
   progress = new HTML();
   HTML content = new HTML(text);
   content.setStyleName("progress-text");
   pane.add(progress);
   pane.add(content);
   content.setWidth("100%");
   setStyleName("progress-bar");
   progress.setStyleName("progress");
   progress.setHeight("100%");
 }
    BarcodeDialogBox(String projectName, String appInstallUrl) {
      super(false, true);
      setStylePrimaryName("ode-DialogBox");
      setText(MESSAGES.barcodeTitle(projectName));

      ClickHandler buttonHandler =
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              hide();
            }
          };

      Button cancelButton = new Button(MESSAGES.cancelButton());
      cancelButton.addClickHandler(buttonHandler);
      Button okButton = new Button(MESSAGES.okButton());
      okButton.addClickHandler(buttonHandler);
      Image barcodeImage = new Image(appInstallUrl);
      HorizontalPanel buttonPanel = new HorizontalPanel();
      buttonPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
      HTML warningLabel =
          new HTML(
              MESSAGES.barcodeWarning(
                  Ode.getInstance().getUser().getUserEmail(),
                  "<a href=\""
                      + Ode.APP_INVENTOR_DOCS_URL
                      + "/learn/userfaq.html\" target=\"_blank\">",
                  "</a>"));
      warningLabel.setWordWrap(true);
      warningLabel.setWidth("200px"); // set width to get the text to wrap
      HorizontalPanel warningPanel = new HorizontalPanel();
      warningPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
      warningPanel.add(warningLabel);

      // The cancel button is removed from the panel since it has no meaning in this
      // context.  But the logic is still here in case we want to restore it, and as
      // an example of how to code this stuff in GWT.
      // buttonPanel.add(cancelButton);
      buttonPanel.add(okButton);
      buttonPanel.setSize("100%", "24px");
      VerticalPanel contentPanel = new VerticalPanel();
      contentPanel.add(barcodeImage);
      contentPanel.add(buttonPanel);
      contentPanel.add(warningPanel);
      //      contentPanel.setSize("320px", "100%");
      add(contentPanel);
    }
  public SettingsMTout(
      int exp,
      String path,
      String ss,
      String mts,
      String mtt,
      String mtos,
      String mtot,
      String asrl,
      int w) {
    // store experimentId
    expId = exp;
    mediapath = path;
    ssLang = ss;
    mtSrc = mts;
    mtTrg = mtt;
    mtoSrc = mtos;
    mtoTrg = mtot;
    asrLang = asrl;
    wiz = w;

    compList.setStyleName("drp");

    srcLangList.clear();
    srcLangList.setStyleName("drp");
    srcLangList.addItem("de", "de");
    srcLangList.addItem("en", "en");
    srcLangList.addItem("es", "es");
    srcLangList.addItem("fr", "fr");
    srcLangList.addItem("it", "it");

    trgLangList.clear();
    trgLangList.setStyleName("drp");
    trgLangList.addItem("de", "de");
    trgLangList.addItem("en", "en");
    trgLangList.addItem("es", "es");
    trgLangList.addItem("fr", "fr");
    trgLangList.addItem("it", "it");

    // build layout
    heading.setWidth("30px");
    settingsPanel.clear();
    settingsPanel.add(heading);
    settingsPanel.add(compList);
    settingsPanel.add(srcLangList);
    settingsPanel.add(srcLangLabel);
    settingsPanel.add(trgLangList);
    settingsPanel.add(trgLangLabel);
    layoutPanel.clear();
    layoutPanel.add(settingsPanel);
    layoutPanel.addStyleName("compSet");

    // list of components
    compList.clear();
    compList.addItem("Off", "0");
    compList.addItem("Bing Translate", "1");
    // stop Google translate support
    // compList.addItem("Google Translate", "2");

    // get settings
    getSettings();

    // component handler
    compList.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            changeComponent(Integer.parseInt(compList.getValue(compList.getSelectedIndex())));
          }
        });

    srcLangList.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            changeLang(1);
          }
        });

    trgLangList.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            changeLang(2);
          }
        });
  }
Exemple #6
0
  @Override
  protected void onRender(Element parent, int index) {
    super.onRender(parent, index);

    final Stock stock = TestData.getStocks().get(0);

    HorizontalPanel hp = new HorizontalPanel();
    hp.setSpacing(10);

    StringBuffer sb = new StringBuffer();
    sb.append("<div class=text style='line-height: 1.5em'>");
    sb.append("<b>Name:</b> {name}<br>");
    sb.append("<b>Symbol:</b> {symbol}<br>");
    sb.append("<b>Last:</b> {last}<br>");
    sb.append("<b>Change:</b> {[new Number(values.change).toFixed(2)]}<br>");
    sb.append("<b>Updated:</b> {date:date(\"MM/dd/y\")}<br>");
    sb.append("</div>");

    final XTemplate template = XTemplate.create(sb.toString());
    final HTML html = new HTML();
    html.setWidth("160px");
    template.overwrite(html.getElement(), Util.getJsObject(stock));
    hp.add(html);
    // update template when model changes
    stock.addChangeListener(
        new ChangeListener() {
          public void modelChanged(ChangeEvent event) {
            template.overwrite(html.getElement(), Util.getJsObject(stock));
          }
        });

    FormPanel panel = new FormPanel();
    panel.setHeaderVisible(false);
    panel.setWidth(350);

    TextField<String> name = new TextField<String>();
    name.setName("nameField");
    name.setFieldLabel("Name");
    panel.add(name);

    TextField<String> symbol = new TextField<String>();
    symbol.setName("symbol");
    symbol.setFieldLabel("Symbol");
    panel.add(symbol);

    NumberField open = new NumberField();
    open.setName("last");
    open.setFieldLabel("Last");
    panel.add(open);

    NumberField change = new NumberField();
    change.setName("change");
    change.setFieldLabel("Change");
    change.setFormat(NumberFormat.getDecimalFormat());
    panel.add(change);

    DateField last = new DateField();
    last.setName("date");
    last.setFieldLabel("Updated");
    panel.add(last);

    SimpleComboBox<String> scb = new SimpleComboBox<String>();
    for (Stock s : TestData.getStocks()) {
      scb.add(s.getName());
    }
    scb.setFieldLabel("Name");
    scb.setForceSelection(true);
    scb.setTypeAhead(true);
    scb.setName("company");
    scb.setTriggerAction(TriggerAction.ALL);
    panel.add(scb);

    hp.add(panel);

    FormBinding binding = new FormBinding(panel);
    // manually add bindings
    binding.addFieldBinding(new FieldBinding(name, "name"));
    binding.addFieldBinding(new FieldBinding(symbol, "symbol"));
    binding.addFieldBinding(new SimpleComboBoxFieldBinding(scb, "name"));

    // auto bind remaining fields, field name must match model property name
    binding.autoBind();
    binding.bind(stock);

    add(hp);
  }
 public void testWidth() {
   html.setWidth("126px");
   String expected = ComputedStyle.getStyleProperty(html.getElement(), "width");
   System.out.println("width1=" + expected + " = " + "126px");
   assertEquals(expected, "126px");
 }
  public FindFolderSelectPopup() {
    // Establishes auto-close when click outside
    super(false, true);

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

    vPanel = new VerticalPanel();
    vPanel.setWidth("700");
    vPanel.setHeight("350");
    hPanel = new HorizontalPanel();

    scrollFolderPanel = new ScrollPanel();
    scrollFolderPanel.setStyleName("okm-Popup-text");

    cancelButton =
        new Button(
            Main.i18n("button.close"),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                hide();
              }
            });

    actionButton =
        new Button(
            Main.i18n("search.result.menu.go.folder"),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                CommonUI.openPath(folderTable.getText(selectedRow, 1), "");
                hide();
              }
            });

    keyword = new TextBox();
    keyword.setWidth("692");
    keyword.addKeyUpHandler(
        new KeyUpHandler() {
          @Override
          public void onKeyUp(KeyUpEvent event) {
            if (keyword.getText().length() >= 3) {
              GWTQueryParams gwtParams = new GWTQueryParams();
              int actualView = Main.get().mainPanel.desktop.navigator.stackPanel.getStackIndex();

              switch (actualView) {
                case UIDesktopConstants.NAVIGATOR_TAXONOMY:
                  gwtParams.setPath(Main.get().taxonomyRootFolder.getPath());
                  break;
                case UIDesktopConstants.NAVIGATOR_TEMPLATES:
                  gwtParams.setPath(Main.get().templatesRootFolder.getPath());
                  break;
                case UIDesktopConstants.NAVIGATOR_PERSONAL:
                  gwtParams.setPath(Main.get().personalRootFolder.getPath());
                  break;
                case UIDesktopConstants.NAVIGATOR_MAIL:
                  gwtParams.setPath(Main.get().mailRootFolder.getPath());
                  break;
                case UIDesktopConstants.NAVIGATOR_TRASH:
                  gwtParams.setPath(Main.get().trashRootFolder.getPath());
                  break;
              }

              gwtParams.setMimeType("");
              gwtParams.setKeywords("");
              gwtParams.setMimeType("");
              gwtParams.setName(keyword.getText() + "*"); // add wildcard at ends
              gwtParams.setAuthor("");
              gwtParams.setMailFrom("");
              gwtParams.setMailTo("");
              gwtParams.setMailSubject("");
              gwtParams.setOperator(GWTQueryParams.OPERATOR_AND);
              gwtParams.setLastModifiedFrom(null);
              gwtParams.setLastModifiedTo(null);
              gwtParams.setDomain(GWTQueryParams.FOLDER);
              gwtParams.setProperties(new HashMap<String, GWTPropertyParams>());
              find(gwtParams);
            } else {
              removeAllRows();
            }
          }
        });

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

    folderTable.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            markSelectedRow(folderTable.getCellForEvent(event).getRowIndex());
            evaluateEnableAction();
          }
        });

    folderTable.addDoubleClickHandler(
        new DoubleClickHandler() {
          @Override
          public void onDoubleClick(DoubleClickEvent event) {
            CommonUI.openPath(folderTable.getText(selectedRow, 1), "");
            hide();
          }
        });

    scrollFolderPanel.add(folderTable);
    scrollFolderPanel.setPixelSize(690, 300);

    vPanel.add(keyword);
    vPanel.add(scrollFolderPanel);
    vPanel.add(new HTML("<br>"));
    hPanel.add(cancelButton);
    HTML space = new HTML();
    space.setWidth("50");
    hPanel.add(space);
    hPanel.add(actionButton);
    vPanel.add(hPanel);
    vPanel.add(new HTML("<br>"));

    vPanel.setCellHorizontalAlignment(keyword, HasAlignment.ALIGN_CENTER);
    vPanel.setCellVerticalAlignment(keyword, HasAlignment.ALIGN_MIDDLE);
    vPanel.setCellHorizontalAlignment(scrollFolderPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(hPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHeight(keyword, "25");
    vPanel.setCellHeight(scrollFolderPanel, "300");

    cancelButton.setStyleName("okm-NoButton");
    actionButton.setStyleName("okm-YesButton");
    folderTable.setStyleName("okm-NoWrap");
    folderTable.addStyleName("okm-Table-Row");
    keyword.setStyleName("okm-Input");

    super.hide();
    setWidget(vPanel);
  }
Exemple #9
0
  public void init() {
    TotalBudget.getInstance();

    Integer height = null;
    Integer width = null;
    Map<String, List<String>> parameters = Window.Location.getParameterMap();
    if (parameters.containsKey("w") && parameters.containsKey("h")) {
      height = Integer.parseInt(parameters.get("h").get(0));
      width = Integer.parseInt(parameters.get("w").get(0));
    }

    mResultsGrid = new ResultGrid();
    mResultsGrid.setWidth("100%");

    Integer pieWidth = width == null ? 485 : width;
    Integer pieHeight = height == null ? 400 : height;
    mPieCharter = new PieCharter(this, mEmbedded, pieWidth, pieHeight);
    mPieCharter.setWidth(pieWidth + "px");
    mPieCharter.setHeight(pieHeight + "px");

    Integer timeWidth = width == null ? 686 : width;
    Integer timeHeight = height == null ? 400 : height;
    mTimeLineCharter = new TimeLineCharter(this, mEmbedded, timeWidth, timeHeight);
    mTimeLineCharter.setWidth(timeWidth + "px");
    mTimeLineCharter.setHeight(timeHeight + "px");

    mBreadcrumbs = new HTML("");
    mBreadcrumbs.setHeight("20px");
    mBreadcrumbs.setWidth("100%");

    mYearSelection = new ListBox();
    mYearSelection.addChangeHandler(
        new ChangeHandler() {
          @Override
          public void onChange(ChangeEvent event) {
            Integer index = mYearSelection.getSelectedIndex();
            String yearStr = mYearSelection.getItemText(index);
            Integer year;
            try {
              year = Integer.parseInt(yearStr);
            } catch (Exception e) {
              yearStr = yearStr.split(" ")[0];
              year = Integer.parseInt(yearStr);
            }
            selectYear(year);
          }
        });

    mSearchBox = new SuggestBox(new BudgetSuggestionOracle());
    mSearchBox.setWidth("300px");
    mSearchBox.setAutoSelectEnabled(false);
    mSearchBox.addSelectionHandler(
        new SelectionHandler<Suggestion>() {
          @Override
          public void onSelection(SelectionEvent<Suggestion> event) {
            final BudgetSuggestion bs = (BudgetSuggestion) event.getSelectedItem();

            BudgetAPICaller api = new BudgetAPICaller();
            api.setCode(bs.getCode());
            api.setParameter("depth", "0");
            api.setParameter("text", bs.getTitle());

            api.go(
                new BudgetAPICallback() {

                  @Override
                  public void onSuccess(JSONArray data) {
                    if (data.size() > 0) {
                      Integer year =
                          (int) data.get(0).isObject().get("year").isNumber().doubleValue();
                      newCodeAndYear(bs.getCode(), year);
                    }
                  }
                });
          }
        });

    mSummary1 = new Label();
    mSummary2 = new Label();
    mSummary2_1 = new Label();
    mSummary3 = new HTML();
    mSummary3_1 = new HTML();

    try {
      mBudgetNews = new BudgetNews();
    } catch (Exception e) {
      Log.error("Failed to init mBudgetNews", e);
    }

    mCheatSheet = new HTML("(הסברים)");
    final DecoratedPopupPanel simplePopup = new DecoratedPopupPanel(true);
    simplePopup.setWidth("450px");
    HTML simplePopupContents =
        new HTML(
            "<h4>מונחון מקוצר</h4>"
                + "<lu>"
                + "<li><b>נטו</b>: <u>תקציב הוצאה נטו</u> – הסכום המותר להוצאה בשנה כלשהי כפי שמפורט בחוק התקציב. תקציב זה מכונה גם \"תקציב המזומנים\".</li>"
                + "<li><b>ברוטו</b>: <u>תקציב ההוצאה נטו</u> בתוספת <u>תקציב ההוצאה המותנית בהכנסה</u> – תקציב נוסף המותר בהוצאה, ובלבד שיתקבלו תקבולים למימון ההוצאה מגורמים חוץ-ממשלתיים. תקבולים אלו אינם כוללים אגרה המשולמת לאוצר המדינה שהוטלה על-פי חיקוק שנחקק אחרי תחילת שנת הכספים 1992, ואינה כוללת הכנסה שמקורה במלווה (חוץ מתקציבי פיתוח וחשבון הון).</li>"
                + "<li><b>הקצאה</b>: <u>תקציב מקורי</u> – התקציב שאושר בכנסת במסגרת חוק התקציב. ייתכנו הבדלים בין הצעת התקציב לבין התקציב שיאושר בכנסת בסופו של דבר.</li>"
                + "<li><b>הקצאה מעודכנת</b>: <u>תקציב על שינוייו</u> – תקציב המדינה עשוי להשתנות במהלך השנה. שינויים אלו כוללים תוספות, הפחתות והעברות תקציביות בין סעיפי תקציב (באישור ועדת הכספים של הכנסת). נוסף על כך, פעמים רבות מועברים עודפים מחויבים משנה קודמת הנכללים בתקציב זה. רוב השינויים בתקציב דורשים את אישורה של ועדת הכספים של הכנסת. התקציב בסוף השנה הכולל את השינויים שנעשו בו במהלך השנה נקרא התקציב על שינוייו או התקציב המאושר.</li>"
                + "<li><b>שימוש</b>:  <u>ביצוע</u> – התקציב שכבר נוצל ושולם בפועל על-ידי החשב.</li>"
                + "<li><b>ערך ריאלי ונומינלי</b>:  ראו הסבר ב<a href='http://he.wikipedia.org/wiki/%D7%A2%D7%A8%D7%9A_%D7%A8%D7%99%D7%90%D7%9C%D7%99_%D7%95%D7%A2%D7%A8%D7%9A_%D7%A0%D7%95%D7%9E%D7%99%D7%A0%D7%9C%D7%99' target ='_blank'>ויקיפדיה</a>.</li>"
                + "<li><b>ערך יחסי</b>:  האחוז היחסי של סעיף זה מכלל תקציב המדינה</li>"
                + "</lu>"
                + "<br/>"
                + "<i>לחץ מחוץ לחלונית זו לסגירתה</i>"
                + "<br/>"
                + "מקור: <a href='http://www.knesset.gov.il/mmm/data/docs/m02217.doc' target='_blank'>מסמך Word ממחלקת המחקר של הכנסת</a>"
                + "<p><b>התקציב הפתוח הוא פרויקט התנדבותי של עמותת 'הסדנא לידע ציבורי'. הנתונים המופיעים"
                + " בתקציב הפתוח נסמכים על פרסומי המדינה ואינם באים לשקף כל דעה שהיא. אין לסדנא לידע ציבורי"
                + " כל אחריות על השימוש בפרויקט וראוי לבדוק את הנתונים לגופם במקורותיהם לפני הסתמכות עליהם.</b></p>");
    simplePopupContents.setStyleName("obudget-cheatsheet-popup");
    simplePopup.setWidget(simplePopupContents);
    mCheatSheet.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            Widget source = (Widget) event.getSource();
            int left = source.getAbsoluteLeft() + 10;
            int top = source.getAbsoluteTop() + 10;
            simplePopup.setPopupPosition(left, top);
            simplePopup.show();
          }
        });

    History.addValueChangeHandler(this);
  }
 /*
  * (non-Javadoc)
  * @see ch.unifr.pai.twice.mousecontrol.client.TouchPadWidget#updateScreenDimensions()
  */
 @Override
 protected void updateScreenDimensions() {
   spacer.setWidth((scroller.getOffsetWidth() + screenWidth) + "px");
   spacer.setHeight((scroller.getOffsetHeight() + screenHeight) + "px");
 }
Exemple #11
0
  public ColorPicker() {
    // UI Drawing
    // ------------------

    hue = 0;
    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.addClickHandler(this);
    rbSaturation = new RadioButton("color", "S:");
    rbSaturation.addClickHandler(this);
    rbBrightness = new RadioButton("color", "V:");
    rbBrightness.addClickHandler(this);
    rbRed = new RadioButton("color", "R:");
    rbRed.addClickHandler(this);
    rbGreen = new RadioButton("color", "G:");
    rbGreen.addClickHandler(this);
    rbBlue = new RadioButton("color", "B:");
    rbBlue.addClickHandler(this);

    // Textboxes
    tbHue = new TextBox();
    tbHue.setText(new Integer(hue).toString());
    tbHue.setMaxLength(3);
    tbHue.setVisibleLength(4);
    tbHue.addKeyPressHandler(this);
    tbHue.addChangeHandler(this);
    tbSaturation = new TextBox();
    tbSaturation.setText(new Integer(saturation).toString());
    tbSaturation.setMaxLength(3);
    tbSaturation.setVisibleLength(4);
    tbSaturation.addKeyPressHandler(this);
    tbSaturation.addChangeHandler(this);
    tbBrightness = new TextBox();
    tbBrightness.setText(new Integer(brightness).toString());
    tbBrightness.setMaxLength(3);
    tbBrightness.setVisibleLength(4);
    tbBrightness.addKeyPressHandler(this);
    tbBrightness.addChangeHandler(this);
    tbRed = new TextBox();
    tbRed.setText(new Integer(red).toString());
    tbRed.setMaxLength(3);
    tbRed.setVisibleLength(4);
    tbRed.addKeyPressHandler(this);
    tbRed.addChangeHandler(this);
    tbGreen = new TextBox();
    tbGreen.setText(new Integer(green).toString());
    tbGreen.setMaxLength(3);
    tbGreen.setVisibleLength(4);
    tbGreen.addKeyPressHandler(this);
    tbGreen.addChangeHandler(this);
    tbBlue = new TextBox();
    tbBlue.setText(new Integer(blue).toString());
    tbBlue.setMaxLength(3);
    tbBlue.setVisibleLength(4);
    tbBlue.addKeyPressHandler(this);
    tbBlue.addChangeHandler(this);
    tbHexColor = new TextBox();
    tbHexColor.setText("ff0000");
    tbHexColor.setMaxLength(6);
    tbHexColor.setVisibleLength(6);
    tbHexColor.addKeyPressHandler(this);
    tbHexColor.addChangeHandler(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.setValue(true);
    setPreview("ff0000");
    DOM.setStyleAttribute(colorpreview.getElement(), "cursor", "default");

    // First event
    onClick(rbSaturation);

    initWidget(panel);
  }
  public void initQuestionButtonPanel() {
    questionButtonPanel.setWidth("435px");
    questionButtonPanel.setHeight("30px");

    btnPrev = new Button("Prev");
    btnPrev.setHTML("<img src='images/icon16/back.png' />Prev");
    btnPrev.setSize("75px", "28px");
    btnPrev.setEnabled(false);

    btnNext = new Button("Next");
    btnNext.setHTML("<img src='images/icon16/right.png' />Next");
    btnNext.setSize("75px", "28px");

    html = new HTML("<center><span class='app-title3'>" + controller.getTitle() + "</></center>");
    html.setWidth("285px");

    questionButtonPanel.add(btnPrev, 0, 2);
    questionButtonPanel.add(html, 75, 0);
    questionButtonPanel.add(btnNext, 360, 2);

    btnPrev.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            if (questionIndex > 0) {
              questionIndex--;
              controller = questionList.get(questionIndex);

              String str =
                  "<center><span class='app-title3'>" + controller.getTitle() + "</span></center>";
              html.setHTML(str);

              if (questionIndex == 0) btnPrev.setEnabled(false);
              else btnPrev.setEnabled(true);
              if (questionIndex == questionList.size() - 1) btnNext.setEnabled(false);
              else btnNext.setEnabled(true);
              base.remove(panel);
              panel = controller.getQuestionPanel();
              base.add(panel);
              controller.syncDiagram();
            }
          }
        });

    btnNext.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            if (questionIndex < questionList.size() - 1) {
              questionIndex++;
              controller = questionList.get(questionIndex);

              String str =
                  "<center><span class='app-title3'>" + controller.getTitle() + "</span></center>";
              html.setHTML(str);

              if (questionIndex == questionList.size() - 1) btnNext.setEnabled(false);
              else btnNext.setEnabled(true);
              if (questionIndex == 0) btnPrev.setEnabled(false);
              else btnPrev.setEnabled(true);
              base.remove(panel);
              panel = controller.getQuestionPanel();
              base.add(panel);
              controller.syncDiagram();
            }
          }
        });
  }