2013年10月30日星期三

GWT tabPanel layout problems

Want to achieve vertical and label styles of tabPanel how to implement a custom , online GWT 's little information, did not find the method , help !!
------ Solution ------- -------------------------------------
official documents do not provide ?
recommend Quguan network demo
------ Solution ----------------------------- ---------------
/**
 * This is a demonstration of all stand alone widgets in the cobogw framework.
 * Each widget demo is accessible via the history token.
 */
public class WidgetsDemo implements EntryPoint {

  private VerticalTabPanel panel;

  private HashMap tabMap = new HashMap();
  private HashMap mapTab = new HashMap();

  /**
   * This is the entry point method.
   */
  public void onModuleLoad() {
    panel = new VerticalTabPanel();
    RootPanel.get("content").add(panel);
    panel.add(RoundedPanelDemo.getLazy(), rt("RoundedPanel"));
    panel.add(ButtonDemo.getLazy(), rt("Button"));
    panel.add(ButtonConfigurator.getLazy(), rt("Button CSS generator", "ButtonConfigurator"));
    panel.add(RatingDemo.getLazy(), rt("Rating"));
    panel.add(VerticalTabPanelDemo.getLazy(), rt("VerticalTabPanel"));
    panel.add(MiscDemo.getLazy(), rt("Misc"));
    panel.addSelectionHandler(new SelectionHandler() {
      public void onSelection(SelectionEvent event) {
        History.newItem(mapTab.get(event.getSelectedItem()), false);
      }
    });
    History.addValueChangeHandler(new ValueChangeHandler() {
      public void onValueChange(ValueChangeEvent event) {
        onHistoryChange(event.getValue());
      }
    });
    String initToken = History.getToken();

    if (initToken.length() > 0) {
      onHistoryChange(initToken);
    } else {
      onHistoryChange("RoundedPanel");
    }
  }
  private Widget rt(String tab) {
    return rt(tab, tab);
  }

  private Widget rt(String tab, String token) {
    tabMap.put(token, panel.getWidgetCount());
    mapTab.put(panel.getWidgetCount(), token);
    return new RoundedPanel(new Label(tab), RoundedPanel.LEFT); 
  }

  private void onHistoryChange(String historyToken) {
    if ("RatingWidget".equals(historyToken) || "Rating".equals(historyToken)) {
      panel.selectTab(tabMap.get("Rating"));
    } else if ("Misc".equals(historyToken) || "Tags".equals(historyToken)) {
      panel.selectTab(tabMap.get("Misc"));
    } else if ("Button".equals(historyToken)) {
      panel.selectTab(tabMap.get("Button"));
    } else if ("ButtonConfigurator".equals(historyToken)) {
      panel.selectTab(tabMap.get("ButtonConfigurator"));
    } else if ("VerticalTabPanel".equals(historyToken)) {
      panel.selectTab(tabMap.get("VerticalTabPanel"));
    } else {
      panel.selectTab(tabMap.get("RoundedPanel"));
    }
  }
}

  public static LazyPanel getLazy() {
    return new LazyPanel() {
      public Widget createWidget() {
        final Widget w = new RatingDemo();
        w.setStyleName("demo-TP");
        return new RoundedPanel(w);
      }
    };
  }

------ For reference only ----------------- ----------------------


have provided official documents, but did not find the tabPanel customize the interface guess is to be defined in other places , but do not have the prompt does not know how to start
------ For reference only ---------------------------------------
top it == !
------ For reference only -------------------------------------- -
has concluded , GWT native components can not be achieved , the need for self- definition, but in smartGWT and ext-gwt components can be achieved in the presence of vertical labels feature

没有评论:

发表评论