Пример #1
0
    @Override
    public Object generateCell(Table source, Object itemId, Object columnId) {
      final ExampleQuery eQ = (ExampleQuery) itemId;
      Panel p = new Panel();
      p.addStyleName(ChameleonTheme.PANEL_BORDERLESS);
      HorizontalLayout l = new HorizontalLayout();
      Button btn = new Button();
      btn.setDescription("show corpus browser for " + eQ.getCorpusName());
      btn.addStyleName(BaseTheme.BUTTON_LINK);
      btn.setIcon(SEARCH_ICON);
      btn.setDescription(
          "show results for \"" + eQ.getExampleQuery() + "\" in " + eQ.getCorpusName());
      p.setContent(l);

      btn.addClickListener(
          new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
              ControlPanel controlPanel = ui.getControlPanel();
              QueryPanel queryPanel;
              QueryController qController;

              if (controlPanel == null) {
                log.error("controlPanel is not initialized");
                return;
              }

              queryPanel = controlPanel.getQueryPanel();
              if (queryPanel == null) {
                log.error("queryPanel is not initialized");
                return;
              }

              Set<String> corpusNameSet = new HashSet<String>();
              corpusNameSet.add(eQ.getCorpusName());
              QueryController controller = ui.getQueryController();
              if (controller != null) {
                controller.setQuery(new Query(eQ.getExampleQuery(), corpusNameSet));
                controller.executeQuery();
              }
            }
          });
      l.addComponent(btn);
      return p;
    }
Пример #2
0
 @Override
 public Object generateCell(Table source, Object itemId, Object columnId) {
   ExampleQuery eQ = (ExampleQuery) itemId;
   return getOpenCorpusPanel(eQ.getCorpusName());
 }