Ejemplo n.º 1
0
 public void add(
     final Widget child,
     ImageResource icon,
     String docId,
     final String text,
     String tooltip,
     Integer position) {
   if (closeableTabs_) {
     DocTab tab =
         new DocTab(
             icon,
             docId,
             text,
             tooltip,
             new TabCloseObserver() {
               public void onTabClose() {
                 int index = getWidgetIndex(child);
                 if (index >= 0) {
                   tryCloseTab(index, null);
                 }
               }
             });
     docTabs_.add(tab);
     if (position == null || position < 0) super.add(child, tab);
     else super.insert(child, tab, position);
   } else {
     if (position == null || position < 0) super.add(child, text);
     else super.insert(child, text, position);
   }
 }
Ejemplo n.º 2
0
  /**
   * Add a new tab with the provided name and content.
   *
   * <p>Wrapper function for {@link com.google.gwt.user.client.ui.TabLayoutPanel#add(Widget,
   * String)}
   *
   * @param tabContent the widget to add as a tab
   * @param tabName the name of the tab to display in the tabbar
   */
  public void add(E tabContent, String tabName) {

    tabContent.addStyleName(I_CmsLayoutBundle.INSTANCE.generalCss().cornerAll());
    m_tabPanel.add(tabContent, tabName);

    Element tabRootEl = m_tabPanel.getElement();
    // set an additional css class for the parent element of the .gwt-TabLayoutPanelTabs element
    List<Element> tabDivs =
        CmsDomUtil.getElementsByClass(
            I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().cmsTabLayoutPanelTab(),
            CmsDomUtil.Tag.div,
            tabRootEl);

    Iterator<Element> it = tabDivs.iterator();
    boolean first = true;
    while (it.hasNext()) {

      Element e = it.next();
      e.removeClassName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().cornerLeft());
      e.removeClassName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().cornerRight());
      if (first) {
        e.addClassName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().cornerLeft());
        first = false;
      }
      if (!it.hasNext()) {
        e.addClassName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().cornerRight());
      }
    }
  }
Ejemplo n.º 3
0
 private void chooseTab(String token) {
   if (NameTokens.SUMMARY.equals(token)) {
     mainTabPanel.selectTab(0);
   } else if (NameTokens.TRENDS.equals(token)) {
     mainTabPanel.selectTab(1);
   } else {
     mainTabPanel.selectTab(2);
   }
 }
  @UiHandler("cotizanteSolicitante")
  public void cotizanteSolicitante(ClickEvent event) {

    if (cotizanteSolicitante.getValue()) {
      tab.getTabWidget(1).getParent().setVisible(false);
    } else {
      tab.getTabWidget(1).getParent().setVisible(true);
    }
  }
Ejemplo n.º 5
0
  /**
   * Add a new tab with the provided name and content and additional left margin.
   *
   * <p>
   *
   * @param tabContent the widget to add as a tab
   * @param tabName the name of the tab to display in the tabbar
   */
  public void addWithLeftMargin(E tabContent, String tabName) {

    tabContent.addStyleName(I_CmsLayoutBundle.INSTANCE.generalCss().cornerAll());
    m_tabPanel.add(tabContent, tabName);

    int tabIndex = m_tabPanel.getWidgetIndex(tabContent);
    Element tabElement = getTabElement(tabIndex);
    if (tabElement != null) {
      tabElement.addClassName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().tabLeftMargin());
      if (!m_panelStyle.equals(CmsTabbedPanelStyle.classicTabs)) {
        tabElement.addClassName(I_CmsLayoutBundle.INSTANCE.generalCss().buttonCornerAll());
        tabElement.addClassName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().borderAll());
      }
    }
  }
Ejemplo n.º 6
0
  /**
   * The constructor for an empty tabbed panel.
   *
   * <p>
   *
   * @param tabbedPanelStyle the pre-defined height of the tabbar, can be "small" or "standard"
   */
  public CmsTabbedPanel(CmsTabbedPanelStyle tabbedPanelStyle) {

    m_tabPanel = new TabLayoutPanel(tabbedPanelStyle.getBarHeight(), Unit.PX);
    m_panelStyle = tabbedPanelStyle;

    // All composites must call initWidget() in their constructors.
    initWidget(m_tabPanel);

    Element tabRootEl = m_tabPanel.getElement();
    // set an additional css class for the parent element of the .gwt-TabLayoutPanelTabs element
    List<Element> tabBarDivs =
        CmsDomUtil.getElementsByClass(
            I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().cmsTabLayoutPanelTabs(),
            CmsDomUtil.Tag.div,
            tabRootEl);
    if (tabBarDivs.size() == 1) {
      tabBarDivs
          .get(0)
          .getParentElement()
          .setClassName(
              I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().cmsTabLayoutPanelTabBar()
                  + " "
                  + I_CmsLayoutBundle.INSTANCE.generalCss().cornerAll());
      if (m_panelStyle.getTabColorClass() != null) {
        tabBarDivs.get(0).getParentElement().addClassName(m_panelStyle.getTabColorClass());
      }
    }

    m_tabPanel.setStyleName(m_panelStyle.getStyleClass());
    m_tabPanel.addStyleName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().cmsTabLayoutPanel());
    m_tabPanel.addStyleName(
        I_CmsLayoutBundle.INSTANCE.generalCss().cornerAll()
            + " "
            + I_CmsLayoutBundle.INSTANCE.generalCss().textMedium());

    m_tabPanel.addAttachHandler(
        new AttachEvent.Handler() {

          /**
           * @see
           *     com.google.gwt.event.logical.shared.AttachEvent.Handler#onAttachOrDetach(com.google.gwt.event.logical.shared.AttachEvent)
           */
          public void onAttachOrDetach(AttachEvent event) {

            setOverflowVisibleToContent();
          }
        });
  }
Ejemplo n.º 7
0
  private void initialize() {

    HorizontalPanel controler = new HorizontalPanel();

    this.addNorth(controler, 30);

    Button okBt =
        new Button(
            "OK",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                updateSettings();
                closePanel();
              }
            });
    controler.add(okBt);

    Button cancelBt =
        new Button(
            "Cancel",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                doCancel();
              }
            });
    controler.add(cancelBt);

    // main
    TabLayoutPanel tab = new TabLayoutPanel(25, Unit.PX);
    // tab.setSize("100%","100%");
    this.add(tab);

    ScrollPanel scroll = new ScrollPanel();
    // scroll.setSize("100%","100%");
    // creaate gif-anime panel
    // tab.add(scroll,"GifAnime");//stop support gif-anime
    scroll.add(createGifPanel());

    ScrollPanel scroll2 = new ScrollPanel();
    // scroll.setSize("100%","100%");
    // creaate gif-anime panel
    tab.add(scroll2, "Screenshot");
    scroll2.add(createScreenshotPanel());
  }
  public LOpenTrialsDocumentCardPanel(IDomeo domeo) {
    _domeo = domeo;

    initWidget(binder.createAndBindUi(this));
    body.setHeight("100%");
    tabToolsPanel.setHeight(Window.getClientHeight() - 45 + "px");
    // tabToolsPanel.addStyleName(style.tabLayoutPanel());
    urlImage.setVisible(false);
  }
Ejemplo n.º 9
0
  /**
   * Enables the tab with the given index.
   *
   * <p>
   *
   * @param tabContent the content of the tab that should be enabled
   */
  public void enableTab(E tabContent) {

    Integer index = new Integer(m_tabPanel.getWidgetIndex(tabContent));
    Element tab = getTabElement(index.intValue());
    if ((tab != null) && m_disabledTabIndexes.containsKey(index)) {
      tab.removeClassName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().tabDisabled());
      tab.setTitle(m_disabledTabIndexes.get(index));
      m_disabledTabIndexes.remove(index);
    }
  }
  public SolicitudTitularEditorWorkFlow() {

    titulo = "Nueva Solicitud";
    tablaTiempoServicioDeclarado = new TablaTiempoServicioDeclarado();
    solicitudTitularEditor = new SolicitudTitularEditor();
    initWidget(GWT.<Binder>create(Binder.class).createAndBindUi(this));

    tab.getTabWidget(1).getParent().setVisible(false);
    cotizanteSolicitante.setValue(true);
  }
Ejemplo n.º 11
0
  private void onMetricsTabSelected() {

    testsMetricsPanel.showWidget(1);
    mainTabPanel.forceLayout();
    for (String plotId : chosenPlots.keySet()) {
      if (plotPanel.getElementById(plotId) == null) {
        renderPlots(plotPanel, chosenPlots.get(plotId), plotId);
        scrollPanelMetrics.scrollToBottom();
      }
    }
  }
  private TelaInicialTopicoProfessor(MainView mainView) {

    this.mainView = mainView;

    TextConstants txtConstants = GWT.create(TextConstants.class);

    adicionarTopicoProfessor = new AdicionarTopicoProfessor(this);
    editarTopicoProfessor = new EditarTopicoProfessor(this);

    TabLayoutPanel tabLayoutPanel = new TabLayoutPanel(2.5, Unit.EM);
    //		stackPanel.setPixelSize(intWidthTable + 50, intHeightTable);
    tabLayoutPanel.setHeight(Integer.toString(intHeightTable) + "px");
    tabLayoutPanel.setAnimationDuration(500);
    tabLayoutPanel.setAnimationVertical(true);

    tabLayoutPanel.add(
        adicionarTopicoProfessor,
        new MpHeaderWidget(txtConstants.topicoAdicionar(), "images/plus-circle.png"));
    tabLayoutPanel.add(
        editarTopicoProfessor,
        new MpHeaderWidget(txtConstants.topicoEditar(), "images/comment_edit.png"));

    //		VerticalPanel verticalPanelPage = new VerticalPanel();
    //		verticalPanelPage.add(stackPanel);
    //		verticalPanelPage.add(new InlineHTML("&nbsp;"));

    initWidget(tabLayoutPanel);
  }
Ejemplo n.º 13
0
  /**
   * Disables the tab with the given index.
   *
   * <p>
   *
   * @param tabContent the content of the tab that should be disabled
   * @param reason the reason why the tab is disabled
   */
  public void disableTab(E tabContent, String reason) {

    Integer index = new Integer(m_tabPanel.getWidgetIndex(tabContent));
    Element tab = getTabElement(index.intValue());
    if ((tab != null) && !m_disabledTabIndexes.containsKey(index)) {
      if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(tab.getTitle())) {
        m_disabledTabIndexes.put(index, tab.getTitle());
      } else {
        m_disabledTabIndexes.put(index, "");
      }
      tab.addClassName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().tabDisabled());
      tab.setTitle(reason);
    }
  }
Ejemplo n.º 14
0
  /**
   * Returns the tab element for the given index.
   *
   * <p>
   *
   * @param tabIndex the tab index to get the tab element for
   * @return the tab element for the given index
   */
  private Element getTabElement(int tabIndex) {

    Element tabRootEl = m_tabPanel.getElement();
    // set an additional css class for the parent element of the .gwt-TabLayoutPanelTabs element
    List<Element> tabDivs =
        CmsDomUtil.getElementsByClass(
            I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().cmsTabLayoutPanelTab(),
            CmsDomUtil.Tag.div,
            tabRootEl);
    if ((tabDivs != null) && (tabDivs.size() > tabIndex)) {
      return tabDivs.get(tabIndex);
    }
    return null;
  }
Ejemplo n.º 15
0
 public MainAgenteLayout() {
   setStylePrimaryName(MaliceResources.INSTANCE.main().agenteLayout());
   add(toolbarsContainerPanel);
   add(maliceDisplayContainer);
   // MALICEDISPLAYCONTAINER
   maliceDisplayContainer.setAnimationDuration(0); // in millisec
   maliceDisplayContainer.add(benvenutoScrollPanel);
   maliceDisplayContainer.add(titoliScrollPanel);
   maliceDisplayContainer.add(incassiScrollPanel);
   maliceDisplayContainer.add(chiusureScrollPanel);
   maliceDisplayContainer.add(statisticheScrollPanel);
   maliceDisplayContainer.selectTab(BENVENUTO_TAB);
   setVisible(false);
 }
Ejemplo n.º 16
0
  /**
   * Sets the overflow of the tab layout content's parent to visible.
   *
   * <p>
   */
  protected void setOverflowVisibleToContent() {

    Element tabRoot = m_tabPanel.getElement();
    // set an additional css class for the parent element of the .gwt-TabLayoutPanelTabs element
    List<Element> tabContentDivs =
        CmsDomUtil.getElementsByClass(
            I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().cmsTabLayoutPanelContent(),
            CmsDomUtil.Tag.div,
            tabRoot);
    tabContentDivs.addAll(
        CmsDomUtil.getElementsByClass(
            "gwt-TabLayoutPanelContentContainer", CmsDomUtil.Tag.div, tabRoot));
    for (Element e : tabContentDivs) {
      e.getParentElement().getStyle().setOverflow(Overflow.VISIBLE);
    }
  }
Ejemplo n.º 17
0
 private void onTrendsTabSelected() {
   testsMetricsPanel.showWidget(0);
   mainTabPanel.forceLayout();
   if (!chosenMetrics.isEmpty() && hasChanged) {
     plotTrendsPanel.clear();
     for (Map.Entry<String, MetricDto> entry : chosenMetrics.entrySet()) {
       renderPlots(
           plotTrendsPanel,
           Arrays.asList(entry.getValue().getPlotSeriesDto()),
           entry.getKey(),
           entry.getValue().getPlotSeriesDto().getYAxisMin(),
           true);
     }
     scrollPanelTrends.scrollToBottom();
     hasChanged = false;
   }
 }
Ejemplo n.º 18
0
 private void setupTabPanel() {
   mainTabPanel.addSelectionHandler(
       new SelectionHandler<Integer>() {
         @Override
         public void onSelection(SelectionEvent<Integer> event) {
           int selected = event.getSelectedItem();
           switch (selected) {
             case 0:
               onSummaryTabSelected();
               break;
             case 1:
               onTrendsTabSelected();
               break;
             case 2:
               onMetricsTabSelected();
             default:
           }
         }
       });
 }
Ejemplo n.º 19
0
  /**
   * Delegate method.
   *
   * <p>
   *
   * @see com.google.gwt.user.client.ui.TabLayoutPanel#selectTab(Widget index)
   * @param tabWidget the tab widget to select
   */
  public void selectTab(E tabWidget) {

    m_tabPanel.selectTab(tabWidget);
  }
Ejemplo n.º 20
0
 private void onSummaryTabSelected() {
   mainTabPanel.forceLayout();
   testsMetricsPanel.showWidget(0);
   // to make columns fit 100% width if grid created not on Summary Tab
   summaryPanel.getSessionComparisonPanel().refresh();
 }
Ejemplo n.º 21
0
  @UiHandler("getHyperlink")
  void getHyperlink(ClickEvent event) {
    MultiSelectionModel<SessionDataDto> sessionModel =
        (MultiSelectionModel) sessionsDataGrid.getSelectionModel();
    MultiSelectionModel<TaskDataDto> testModel =
        (MultiSelectionModel) testDataGrid.getSelectionModel();

    Set<SessionDataDto> sessions = sessionModel.getSelectedSet();

    Set<TaskDataDto> tests = testModel.getSelectedSet();

    Set<MetricNameDto> metrics = metricPanel.getSelected();

    TaskDataTreeViewModel taskDataTreeViewModel =
        (TaskDataTreeViewModel) taskDetailsTree.getTreeViewModel();
    Set<PlotNameDto> trends = taskDataTreeViewModel.getSelectionModel().getSelectedSet();

    HashSet<String> sessionsIds = new HashSet<String>();
    HashSet<TestsMetrics> testsMetricses = new HashSet<TestsMetrics>(tests.size());
    HashMap<String, TestsMetrics> map = new HashMap<String, TestsMetrics>(tests.size());

    for (SessionDataDto session : sessions) {
      sessionsIds.add(session.getSessionId());
    }

    for (TaskDataDto taskDataDto : tests) {
      TestsMetrics testsMetrics =
          new TestsMetrics(taskDataDto.getTaskName(), new HashSet<String>(), new HashSet<String>());
      testsMetricses.add(testsMetrics);
      map.put(taskDataDto.getTaskName(), testsMetrics);
    }

    for (MetricNameDto metricNameDto : metrics) {
      map.get(metricNameDto.getTests().getTaskName()).getMetrics().add(metricNameDto.getName());
    }

    for (PlotNameDto plotNameDto : trends) {
      map.get(plotNameDto.getTest().getTaskName()).getTrends().add(plotNameDto.getPlotName());
    }

    TrendsPlace newPlace =
        new TrendsPlace(
            mainTabPanel.getSelectedIndex() == 0
                ? NameTokens.SUMMARY
                : mainTabPanel.getSelectedIndex() == 1 ? NameTokens.TRENDS : NameTokens.METRICS);

    newPlace.setSelectedSessionIds(sessionsIds);
    newPlace.setSelectedTestsMetrics(testsMetricses);
    newPlace.setSessionTrends(sessionPlotPanel.getSelected());

    String linkText =
        Window.Location.getHost()
            + Window.Location.getPath()
            + Window.Location.getQueryString()
            + "#"
            + new JaggerPlaceHistoryMapper().getToken(newPlace);
    linkText = URL.encode(linkText);

    // create a dialog for copy link
    final DialogBox dialog = new DialogBox(false, true);
    dialog.setText("Share link");
    dialog.setModal(true);
    dialog.setAutoHideEnabled(true);
    dialog.setPopupPosition(event.getClientX(), event.getClientY());

    final TextArea textArea = new TextArea();
    textArea.setText(linkText);
    textArea.setWidth("300px");
    textArea.setHeight("40px");
    // select text
    Scheduler.get()
        .scheduleDeferred(
            new Scheduler.ScheduledCommand() {
              @Override
              public void execute() {
                textArea.setVisible(true);
                textArea.setFocus(true);
                textArea.selectAll();
              }
            });

    dialog.add(textArea);

    dialog.show();
  }
Ejemplo n.º 22
0
  /**
   * Delegate method.
   *
   * <p>
   *
   * @see com.google.gwt.user.client.ui.TabLayoutPanel#selectTab(int index)
   * @param tabIndex the index of the tab to be selected
   * @param fireEvent <code>true</code> to fire the tab event
   */
  public void selectTab(int tabIndex, boolean fireEvent) {

    m_tabPanel.selectTab(tabIndex, fireEvent);
  }
Ejemplo n.º 23
0
  /**
   * Sets the text of a given tab.
   *
   * <p>
   *
   * @param pos the index of the tab
   * @param text the new text for the tab
   */
  public void setTabText(int pos, String text) {

    m_tabPanel.setTabText(pos, text);
  }
Ejemplo n.º 24
0
  /**
   * Delegate method.
   *
   * <p>
   *
   * @see com.google.gwt.user.client.ui.TabLayoutPanel#selectTab(int index)
   * @param tabIndex the index of the tab to be selected
   */
  public void selectTab(int tabIndex) {

    m_tabPanel.selectTab(tabIndex);
  }
Ejemplo n.º 25
0
  /**
   * Gets the child widget at the specified index.
   *
   * <p>Wrapper function for {@link com.google.gwt.user.client.ui.TabLayoutPanel#getWidget(int)}
   *
   * @param tabIndex the child widget's index
   * @return the child widget
   */
  @SuppressWarnings("unchecked")
  public E getWidget(int tabIndex) {

    return (E) m_tabPanel.getWidget(tabIndex);
  }
Ejemplo n.º 26
0
  /**
   * Inserts a widget into the panel. If the Widget is already attached, it will be moved to the
   * requested index.
   *
   * <p>Wrapper function for {@link com.google.gwt.user.client.ui.TabLayoutPanel#insert(Widget,
   * String, int)}
   *
   * @param tabContent the widget to be added
   * @param tabName the text to be shown on its tab
   * @param beforeIndex the index before which it will be inserted
   */
  public void insert(E tabContent, String tabName, int beforeIndex) {

    m_tabPanel.insert(tabContent, tabName, beforeIndex);
  }
Ejemplo n.º 27
0
  /**
   * Removes the tab with the given index.
   *
   * <p>
   *
   * @param tabIndex the index of the tab which should be removed
   */
  public void removeTab(int tabIndex) {

    m_tabPanel.remove(tabIndex);
  }
Ejemplo n.º 28
0
  /**
   * Returns an iterator over all tabs.
   *
   * <p>
   *
   * @return the iterator
   */
  @SuppressWarnings("unchecked")
  public Iterator<E> iterator() {

    return (Iterator<E>) m_tabPanel.iterator();
  }
  @Override
  protected void onBind() {

    registerHandler(
        getDisplay()
            .getCitySelects()
            .addChangeHandler(
                new ChangeHandler() {

                  @Override
                  public void onChange(ChangeEvent event) {
                    eventBus.fireEvent(createRefreshEvent());
                  }
                }));

    registerHandler(
        getDisplay()
            .getOnlyTodayCheckBox()
            .addValueChangeHandler(
                new ValueChangeHandler<Boolean>() {

                  @Override
                  public void onValueChange(ValueChangeEvent<Boolean> event) {
                    eventBus.fireEvent(createRefreshEvent());
                  }
                }));

    registerHandler(
        getDisplay()
            .getCategoryTabPanel()
            .addSelectionHandler(
                new SelectionHandler<Integer>() {

                  @Override
                  public void onSelection(SelectionEvent<Integer> event) {
                    eventBus.fireEvent(createRefreshEvent());
                  }
                }));

    Collection<TabLayoutPanel> orderTypePanelList =
        getDisplay().getOrderTypeTabPanelList().values();
    for (TabLayoutPanel orderTab : orderTypePanelList) {
      registerHandler(
          orderTab.addSelectionHandler(
              new SelectionHandler<Integer>() {

                @Override
                public void onSelection(SelectionEvent<Integer> event) {
                  eventBus.fireEvent(createRefreshEvent());
                }
              }));
    }

    // previous page
    Collection<PageListWidget> pageListWidgetList = getDisplay().getPageListWidgetList().values();
    for (final PageListWidget page : pageListWidgetList) {
      // previous
      registerHandler(
          page.getPreviousPage()
              .addClickHandler(
                  new ClickHandler() {

                    @Override
                    public void onClick(ClickEvent event) {
                      page.previousPage();
                      eventBus.fireEvent(createRefreshEvent());
                    }
                  }));
      // next
      registerHandler(
          page.getNextPage()
              .addClickHandler(
                  new ClickHandler() {

                    @Override
                    public void onClick(ClickEvent event) {
                      page.nextPage();
                      eventBus.fireEvent(createRefreshEvent());
                    }
                  }));
    }

    // init load
    getDisplay()
        .getCategoryTabPanel()
        .addAttachHandler(
            new Handler() {

              @Override
              public void onAttachOrDetach(AttachEvent event) {
                RefreshSearchResultEvent refreshSearchResultEvent = new RefreshSearchResultEvent();
                refreshSearchResultEvent.setCategory(Category.getDisplayOrder()[0]);
                refreshSearchResultEvent.setOrderType(OrderType.getDisplayOrder()[0]);

                // No city select
                refreshSearchResultEvent.setCity("");
                refreshSearchResultEvent.setCurrentPage(1);
                refreshSearchResultEvent.setOnlyToday(false);
                eventBus.fireEvent(refreshSearchResultEvent);
              }
            });

    registerHandler(
        getDisplay()
            .getCitySelects()
            .addAttachHandler(
                new Handler() {

                  @Override
                  public void onAttachOrDetach(AttachEvent event) {
                    dispatch.execute(
                        new GetCityNames(),
                        new SimpleCallback<CityNames>() {

                          @Override
                          public void onSuccess(CityNames result) {
                            ArrayList<Item> cityList = result.getCityList();
                            getDisplay().getCitySelects().clear();
                            for (Item city : cityList) {
                              getDisplay()
                                  .getCitySelects()
                                  .addItem(city.getDisplayName(), city.getValue());
                            }
                          }
                        });
                  }
                }));

    // keyword search
    registerHandler(
        getDisplay()
            .getSearchButton()
            .addClickHandler(
                new ClickHandler() {

                  @Override
                  public void onClick(ClickEvent event) {
                    String value = getDisplay().getSearchTextBox().getText();
                    if (value == null || value.trim().isEmpty()) {
                      // TODO: validate check
                      return;
                    }
                    eventBus.fireEvent(createKeyworkSearchEvent());
                  }
                }));

    registerHandler(
        eventBus.addHandler(
            KeywordSearchEvent.getType(),
            new KeywordSearchHandler() {

              @Override
              public void onRefresh(KeywordSearchEvent event) {
                // select the first one.
                getDisplay().getCategoryTabPanel().selectTab(0);
                // hide and show
                getDisplay().getKeywordResultPanel().setVisible(true);

                getDisplay().getCategoryAllPanel().setVisible(false);
              }
            }));

    registerHandler(
        eventBus.addHandler(
            RefreshSearchResultEvent.getType(),
            new RefreshSearchResultHandler() {

              @Override
              public void onRefresh(RefreshSearchResultEvent event) {
                // hide and show
                getDisplay().getKeywordResultPanel().setVisible(false);
                getDisplay().getCategoryAllPanel().setVisible(true);
              }
            }));
  }
Ejemplo n.º 30
0
  /**
   * Delegate method.
   *
   * <p>
   *
   * @see com.google.gwt.user.client.ui.TabLayoutPanel#selectTab(Widget index)
   * @param tabWidget the tab widget to select
   * @param fireEvent <code>true</code> to fire the tab event
   */
  public void selectTab(E tabWidget, boolean fireEvent) {

    m_tabPanel.selectTab(tabWidget, fireEvent);
  }