Пример #1
0
  private static void init() {
    showProfileSearches();

    searchInfos = RootPanel.get("profileSearches_searchInfos");
    clearSearches = RootPanel.get("profileSearches_clearSearches");
    clearSearches.addDomHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            DOM.setStyleAttribute(RootPanel.getBodyElement(), "cursor", "wait");

            if (clearSearches.getElement().getClassName().contains("disabled")) {
              return;
            }
            userService.clearSavedSearches(
                GWTClient.getCurrentUser().getId(),
                new AsyncCallback<Void>() {
                  @Override
                  public void onFailure(Throwable caught) {
                    DOM.setStyleAttribute(RootPanel.getBodyElement(), "cursor", "default");
                    Window.alert("There was an error while clearing your cart.");
                  }

                  @Override
                  public void onSuccess(Void result) {
                    DOM.setStyleAttribute(RootPanel.getBodyElement(), "cursor", "default");
                    refreshSearches();
                  }
                });
          }
        },
        ClickEvent.getType());
    setSearchInfos();
  }
Пример #2
0
  private ContentPanel buildConfigBloc(ConfigGroup configGroup, ImageResource icon) {
    final ContentPanel cPanel = new ContentPanel(new ColumnLayout());
    cPanel.setHeading(
        "<div class='config-title'>" + I18nUtils.getString(configGroup.key) + "</div>");
    cPanel.getHeader().addStyleName("config-header");
    cPanel.setCollapsible(true);
    cPanel.setAnimCollapse(false);
    cPanel.collapse();
    cPanel.setIcon(AbstractImagePrototype.create(icon));
    cPanel.addListener(
        Events.Expand,
        new Listener<ComponentEvent>() {

          @Override
          public void handleEvent(ComponentEvent be) {
            cPanel.layout(true);
          }
        });

    cPanel.getHeader().addDomHandler(this, ClickEvent.getType());
    mapConfigGroupPanel.put(configGroup, cPanel);
    mapHeaderGroup.put(cPanel.getHeader(), cPanel);

    return cPanel;
  }
Пример #3
0
  /**
   * @see
   *     com.google.gwt.event.dom.client.HasClickHandlers#addClickHandler(com.google.gwt.event.dom.client.ClickHandler)
   */
  public HandlerRegistration addClickHandler(ClickHandler handler) {

    HandlerRegistration registration = addDomHandler(handler, ClickEvent.getType());
    m_clickHandlerRegistrations.add(registration);
    m_clickHandlers.add(handler);
    return registration;
  }
Пример #4
0
  public TabBar(Callback callback) {
    this.callback = callback;

    Element div = DOM.createDiv();

    setElement(div);

    setStylePrimaryName("RibbonTab");

    clear = DOM.createDiv();
    clear.getStyle().setProperty("clear", "both");
    div.appendChild(clear);

    addDomHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            Element tgt = event.getNativeEvent().getEventTarget().cast();
            if (tgt.getParentElement() != getElement()) return;

            int index = DOM.getChildIndex(getElement(), tgt);
            if (index >= getTabCount()) return;

            selectTab(index);
          }
        },
        ClickEvent.getType());
  }
  public PlaceBookEntryPreview(final Entry entry) {
    initWidget(uiBinder.createAndBindUi(this));

    container
        .getElement()
        .getStyle()
        .setBackgroundImage(
            "url(" + Resources.IMAGES.placebook_open().getSafeUri().asString() + ")");

    title.setText(entry.getTitle());
    description.setText(entry.getDescription());
    author.setText(entry.getOwnerName());

    if (entry.getPreviewImage() != null) {
      image.setUrl(
          PlaceBooks.getServer().getHostURL()
              + "media?hash="
              + entry.getPreviewImage()
              + "&type=imageitem");
    } else {
      image.setVisible(false);
    }

    container.addDomHandler(
        new ClickHandler() {
          @Override
          public void onClick(final ClickEvent event) {
            PlaceBooks.goTo(new PlaceBookPage(entry.getKey()));
          }
        },
        ClickEvent.getType());
  }
  @Override
  protected void extend(ServerConnector target) {
    panel = (VPanel) ((ComponentConnector) target).getWidget();
    panel.addStyleName(CLASSNAME);

    captionToggle.addClassName(CLASSNAME + "-toggle");

    DOM.insertChild(panel.captionNode, captionToggle, 2);

    updateStyleName(panel);

    panel.addDomHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            EventTarget eventTarget = event.getNativeEvent().getEventTarget();

            if (eventTarget.cast() == panel.captionNode
                || eventTarget.cast() == panel.captionNode.getFirstChildElement()
                || eventTarget.cast() == captionToggle.getFirstChildElement()) {
              getState().setOpen(!getState().isOpen());
              refresh();
              rpc.setOpen(getState().isOpen());

              // fire toggle listener
              rpc.toggleClick();
            }
          }
        },
        ClickEvent.getType());
  }
Пример #7
0
  public void setAlgebraView(final AlgebraViewW av) {
    if (av != aview) {
      if (aview != null && simplep != null) {
        simplep.remove(aview);
        algebrap.remove(simplep);
      }

      simplep = new SimplePanel(aview = av);
      algebrap.add(simplep);
      simplep.addStyleName("algebraSimpleP");
      algebrap.addStyleName("algebraPanel");
      algebrap.addDomHandler(
          new ClickHandler() {

            public void onClick(ClickEvent event) {
              int bt = simplep.getAbsoluteTop() + simplep.getOffsetHeight();
              if (event.getClientY() > bt) {
                app.getSelectionManager().clearSelectedGeos();
                av.resetItems(true);
              }
              ;
            }
          },
          ClickEvent.getType());
    }
  }
Пример #8
0
 public ClickableLabel(String text, ClickHandler clickHandler) {
   super(text, true);
   addDomHandler(clickHandler, ClickEvent.getType());
   addMouseOverHandler(this);
   addMouseOutHandler(this);
   setEnabled(true);
 }
 public DataSetFilterEditor() {
   initWidget(uiBinder.createAndBindUi(this));
   filterDeleteIcon.addDomHandler(
       new ClickHandler() {
         public void onClick(ClickEvent event) {
           onNewFilterClosed(event);
         }
       },
       ClickEvent.getType());
 }
Пример #10
0
  private void verifyClickEvent() {
    runnerWidget.update(runner);
    reset(itemWidget);

    verify(imagePanel).addDomHandler(clickCaptor.capture(), eq(ClickEvent.getType()));

    clickCaptor.getValue().onClick(clickEvent);

    verify(delegate).removeRunnerWidget(runner);
  }
Пример #11
0
 public MenuChoice(Widget aChoiceContent, Command aCommand) {
   super();
   myChoiceOuterPanel = new FlowPanel();
   myChoiceOuterPanel.setStyleName("menu_choice");
   myChoiceOuterPanel.add(aChoiceContent);
   myCommand = aCommand;
   enabled = true;
   addDomHandler(this, ClickEvent.getType());
   this.initWidget(myChoiceOuterPanel);
 }
Пример #12
0
  /**
   * A player can only select certain pits for their move. That's why some have to be enabled and
   * some have to be disabled before a player's turn.
   */
  @Override
  public void setPitEnabled(PlayerColor side, int col, boolean enabled) {
    AbsolutePanel pnl;
    if (col < 6) {
      if (side.isNorth()) {
        pnl = (AbsolutePanel) gameGrid.getWidget(0, State.getMirrorIndex(col, 5));
      } else if (side.isSouth()) {
        pnl = (AbsolutePanel) gameGrid.getWidget(1, col);
      } else throw new IllegalMoveException();

      final int colB = col;
      int row = side.isNorth() ? 0 : 1;

      if (enabled) {
        // the handerRegs keeps track of all click handlers of the pits
        // by removing it from this array the handler is removed from
        // the pit (absolutePanel) as well
        handlerRegs[row][col].removeHandler();
        handlerRegs[row][col] =
            pnl.addDomHandler(
                new ClickHandler() {
                  @Override
                  public void onClick(ClickEvent event) {
                    presenter.makeMove(colB);
                  }
                },
                ClickEvent.getType());
      } else {
        handlerRegs[row][col].removeHandler();
        handlerRegs[row][col] =
            pnl.addDomHandler(
                new ClickHandler() {
                  @Override
                  public void onClick(ClickEvent event) {
                    setWarnLabelText(messages.warnMessage());
                  }
                },
                ClickEvent.getType());
      }
    }
  }
Пример #13
0
  @Test
  public void clickEventShouldBePerformedWhenRunnerStatusIsNotFailedOrStopped() throws Exception {
    when(runner.getStatus()).thenReturn(DONE);
    runnerWidget.update(runner);
    reset(itemWidget);

    verify(imagePanel).addDomHandler(clickCaptor.capture(), eq(ClickEvent.getType()));

    clickCaptor.getValue().onClick(clickEvent);

    verify(delegate, never()).removeRunnerWidget(runner);
  }
Пример #14
0
  private void init() {
    initWidget(picker);
    picker.sinkEvents(Event.ONCLICK);
    picker.addHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {

            listener.setValue(value);
          }
        },
        ClickEvent.getType());
  }
  public PropertyEditorColorPicker() {
    initWidget(uiBinder.createAndBindUi(this));

    editIcon.addDomHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            openColorPickerDialog();
          }
        },
        ClickEvent.getType());

    colorAddOn.addAppendWidget(editIcon);
  }
Пример #16
0
  private void initUI() {
    History.addValueChangeHandler(this);
    addDomHandler(this, ClickEvent.getType());
    GWTUtils.setUidToElement(UID_CAPTION_CLICK, elCaption);
    GWTUtils.setUidToElement(UID_LOGIN, elLogin);
    GWTUtils.setUidToElement(UID_LOGOUT, elLogout);

    JSONObject json = JSONHelper.getJsonFromElement(Actions.JSON_DATA_EL_ID);
    String loggedInUser = null;
    if (json != null) {
      loggedInUser = JSONHelper.getString(json, "user");
    }
    setCurrentUser(loggedInUser);
  }
Пример #17
0
  @Override
  protected void init() {
    handlerRegistration =
        argumentLabel.addDomHandler(
            new ClickHandler() {

              @Override
              public void onClick(ClickEvent event) {
                InfoEditor.this.fireEvent(new ArgumentSelectedEvent(model));
              }
            },
            ClickEvent.getType());
    initWidget(argumentLabel);
  }
  public TreeSelectionEditor(
      AppTemplateWizardAppearance appearance, SelectionItemProperties props) {
    TreeStore<SelectionItem> store = new TreeStore<SelectionItem>(props.id());

    tree = new SelectionItemTree(store, props.display());
    //        if (presenter.isEditingMode()) {
    //            /*
    //             * KLUDGE CORE-4653 JDS Set selection model to locked. This is to prevent the user
    // from
    //             * making any selections due to the issue described in CORE-4653.
    //             */
    //            tree.getSelectionModel().setLocked(true);
    //            tree.setCore4653Kludge();
    //        }
    tree.setHeight(appearance.getDefaultTreeSelectionHeight());

    tree.addValueChangeHandler(new TreeValueChangeHandler());
    selectionItemsEditor = new MyTreeStoreEditor(store, this);

    // This handler must be added after the store is added to the tree, since the tree adds its own
    // handlers that must trigger before this one.
    // Restore the tree's Checked state from each item's isDefault field after it's filtered.
    store.addStoreFilterHandler(new MyStoreFilterHandler());

    VerticalLayoutContainer vlc = new VerticalLayoutContainer();
    vlc.add(buildFilter(store), new VerticalLayoutData(1, -1));
    vlc.add(tree);

    argumentLabel = new FieldLabel(vlc);
    argumentLabel.setLabelAlign(TOP);
    argumentLabel.addDomHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            TreeSelectionEditor.this.fireEvent(new ArgumentSelectedEvent(model));
          }
        },
        ClickEvent.getType());

    labelLeafEditor = new LabelLeafEditor<String>(argumentLabel, this, appearance);
    idEditor = SimpleEditor.<String>of();
    typeEditor = SimpleEditor.<ArgumentType>of();
    requiredEditor = new LabelLeafEditor<Boolean>(argumentLabel, this, appearance);
    descriptionEditor = new LabelLeafEditor<String>(argumentLabel, this, appearance);

    initWidget(argumentLabel);
    visibilityEditor = new VisibilityEditor(this);
  }
Пример #19
0
  /**
   * Adds a mouse click handler to the icon panel.
   *
   * <p>
   *
   * @param handler the click handler
   * @return the handler registration
   */
  public HandlerRegistration addIconClickHandler(final ClickHandler handler) {

    final HandlerRegistration internalHandlerRegistration =
        m_iconPanel.addDomHandler(handler, ClickEvent.getType());
    m_iconClickHandlers.add(handler);
    HandlerRegistration result =
        new HandlerRegistration() {

          public void removeHandler() {

            internalHandlerRegistration.removeHandler();
            m_iconClickHandlers.remove(handler);
          }
        };
    return result;
  }
Пример #20
0
  @Override
  protected void endConstruct() {
    this.content.add(this.codeOutput);
    // Hook to replace Input by output on blur
    this.setTabIndex(0);
    this.compositeFocus = CompositeFocusHelper.createFocusHelper(this.codeInput, this.codeInput);

    this.addFocusHandler(this);
    // in IE, the focus is not set on click on the codeOutput
    this.codeOutput.asWidget().addDomHandler(this, ClickEvent.getType());
    this.compositeFocus.addBlurHandler(this);

    StyleUtils.removeStyle(this, AbstractInput.STYLE_CONTROL);
    StyleUtils.addStyle(this.codeInput.asWidget(), AbstractInput.STYLE_CONTROL);

    super.endConstruct();
  }
Пример #21
0
  /** Creates an empty hyperlink. */
  public ClickyLink() {
    setElement(DOM.createAnchor());
    getElement().setAttribute("href", "#");
    sinkEvents(Event.ONCLICK);

    addDomHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            if (popupText != null) {
              Window.alert(popupText);
            }
            event.preventDefault();
          }
        },
        ClickEvent.getType());
  }
Пример #22
0
    PageSelectorItem(final WizardPageInfo pageInfo, ClickHandler clickHandler) {
      WizardResources res = WizardResources.INSTANCE;
      WizardResources.Styles styles = res.styles();

      LayoutPanel layoutPanel = new LayoutPanel();
      layoutPanel.addStyleName(styles.wizardPageSelectorItem());

      ImageResource pageImageResource = pageInfo.getImage();
      Image image = null;
      if (pageImageResource != null) {
        image = new Image(pageImageResource);
        layoutPanel.add(image);
        layoutPanel.setWidgetLeftWidth(image, 10, Unit.PX, image.getWidth(), Unit.PX);
        layoutPanel.setWidgetTopHeight(
            image, 40 - (image.getHeight() / 2), Unit.PX, image.getHeight(), Unit.PX);
      }

      FlowPanel captionPanel = new FlowPanel();
      Label titleLabel = new Label(pageInfo.getTitle());
      titleLabel.addStyleName(styles.headerLabel());
      captionPanel.add(titleLabel);
      Label subTitleLabel = new Label(pageInfo.getSubTitle());
      subTitleLabel.addStyleName(styles.subcaptionLabel());
      captionPanel.add(subTitleLabel);
      layoutPanel.add(captionPanel);
      layoutPanel.setWidgetLeftWidth(
          captionPanel, 10 + (image == null ? 0 : image.getWidth()) + 12, Unit.PX, 450, Unit.PX);
      layoutPanel.setWidgetTopHeight(captionPanel, 19, Unit.PX, 55, Unit.PX);

      Image arrowImage = new Image(res.wizardDisclosureArrow());
      layoutPanel.add(arrowImage);
      layoutPanel.setWidgetRightWidth(arrowImage, 20, Unit.PX, arrowImage.getWidth(), Unit.PX);
      layoutPanel.setWidgetTopHeight(
          arrowImage, 40 - (arrowImage.getHeight() / 2), Unit.PX, arrowImage.getHeight(), Unit.PX);

      layoutPanel.addDomHandler(clickHandler, ClickEvent.getType());

      initWidget(layoutPanel);
    }
    NodeWidget(String nodeDesc, int index) {

      isSelected = false;
      Label lbl = new Label(nodeDesc);
      lbl.setStyleName("endpt-wdgt-lbl");

      mainPnl = new FlowPanel();
      mainPnl.setStyleName("endpt-wdgt-pnl-selected");
      // mainPnl.setStyleName("endpt-wdgt-pnl");
      mainPnl.add(lbl);

      mainPnl.addDomHandler(
          new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
              chngeNdeWdgtToEnable();
              slctdNode = ((Label) mainPnl.getWidget(0)).getText();
              if (!isSelected) {
                isSelected = true;
                // disableEndpoint();
                mainPnl.setStyleName("endpt-wdgt-pnl");

              } else {
                // enableEndpoint();
                mainPnl.setStyleName("endpt-wdgt-pnl-selected");
              }
            }
          },
          ClickEvent.getType());

      //			if(!this.isSelected){
      //				enableEndpoint();
      //			} else {
      //				disableEndpoint();
      //			}

      initWidget(mainPnl);
    }
Пример #24
0
  // timer for GeoGebraExam
  private FlowPanel getTimer() {
    final Label timer = new Label();
    timer.getElement().setClassName("timer");
    timer.getElement().setId("timer");
    timer.getElement().setPropertyBoolean("started", false);

    // https://groups.google.com/forum/#!msg/google-web-toolkit/VrF3KD1iLh4/-y4hkIDt5BUJ
    AnimationScheduler.get()
        .requestAnimationFrame(
            new AnimationCallback() {
              @Override
              public void execute(double timestamp) {

                if (app.getExam().isCheating()) {
                  makeRed(getElement());
                }

                timer.setText(app.getExam().timeToString(System.currentTimeMillis()));

                AnimationScheduler.get().requestAnimationFrame(this);
              }
            });
    visibilityEventMain();

    FlowPanel fp = new FlowPanel();
    fp.add(timer);
    Image info = new Image(GuiResourcesSimple.INSTANCE.dialog_info().getSafeUri());
    fp.add(info);
    info.getElement().getStyle().setMarginLeft(5, Unit.PX);
    fp.addDomHandler(
        new ClickHandler() {

          public void onClick(ClickEvent event) {
            app.showMessage(app.getExam().getLog(app.getLocalization()));
          }
        },
        ClickEvent.getType());
    return fp;
  }
Пример #25
0
  public Pelican(RootPanel rootPanel) {
    super();
    setSize(PEDIGREE_SIZE_STR, PEDIGREE_SIZE_STR);
    setStyleName("jsPX-canvas");

    makeMenus(rootPanel);

    history = new Vector<Vector<PelicanPerson>>();
    historyPosition = 0;
    matingList = new HashSet<String>();

    addDomHandler(this, ClickEvent.getType());

    exportMethods(this);

    Scheduler.get()
        .scheduleDeferred(
            new Command() {
              public void execute() {
                notifyHostpage();
              }
            });
  }
Пример #26
0
 public HandlerRegistration addClickHandler(ClickHandler handler) {
   return addDomHandler(handler, ClickEvent.getType());
 }
  /** Construct a new {@link MobileWebAppShellMobile}. */
  public LoveLicenseShellMobile(
      final EventBus eventBus,
      OrientationHelper orientationHelper,
      MainView mainView,
      MyInfoView myInfoView,
      SajuViewView sajuViewView,
      CurrentSajuView currentSajuView,
      SearchFriendView searchFriendView,
      GuestBookListView guestBookListView,
      GuestBookDetailView guestBookDetailView,
      GuestBookWriteView guestBookWriteView,
      GuestBookEditView guestBookEditView,
      LoveLicenseConstants constants) {

    /*
    titleName = new Label();
    titleName.setText(constants.mainTitle());*/
    // System.out.println("##############"+constants.mainTitle());

    initWidget(uiBinder.createAndBindUi(this));

    /*
     * Add all views to the DeckLayoutPanel so we can animate between them.
     * Using a DeckLayoutPanel here works because we only have a few views, and
     * we always know that the task views should animate in from the right side
     * of the screen. A more complex app will require more complex logic to
     * figure out which direction to animate.
     */
    contentContainer.add(mainView);
    contentContainer.add(guestBookListView);
    contentContainer.add(guestBookDetailView);
    contentContainer.add(guestBookWriteView);
    contentContainer.add(guestBookEditView);
    contentContainer.add(myInfoView);
    contentContainer.add(sajuViewView);
    contentContainer.add(currentSajuView);
    contentContainer.add(searchFriendView);
    contentContainer.setAnimationDuration(500);

    orientationHelper.setCommands(
        this,
        new Command() {
          @Override
          public void execute() {
            onShiftToPortrait();
          }
        },
        new Command() {
          @Override
          public void execute() {
            onShiftToLandscape();
          }
        });

    // Return to the task list when the title is clicked.
    titleBar.addDomHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            ActionEvent.fire(eventBus, ActionNames.GO_HOME);
          }
        },
        ClickEvent.getType());
  }
Пример #28
0
  @Override
  public HandlerRegistration addClickHandler(ClickHandler clickHandler) {
    /*
     * When we directly subscribe to this widget's ClickEvent, sometimes the
     * click gets ignored (inconsistent repro but it happens enough to be
     * annoying). Doing it this way fixes it.
     */

    hasHandlers_.addHandler(ClickEvent.getType(), clickHandler);

    final HandlerRegistration mouseDown =
        addMouseDownHandler(
            new MouseDownHandler() {
              public void onMouseDown(MouseDownEvent event) {
                event.preventDefault();
                event.stopPropagation();

                addStyleName(styles_.toolbarButtonPushed());
                down_ = true;
              }
            });

    final HandlerRegistration mouseOut =
        addMouseOutHandler(
            new MouseOutHandler() {
              public void onMouseOut(MouseOutEvent event) {
                event.preventDefault();
                event.stopPropagation();

                removeStyleName(styles_.toolbarButtonPushed());
                down_ = false;
              }
            });

    final HandlerRegistration mouseUp =
        addMouseUpHandler(
            new MouseUpHandler() {
              public void onMouseUp(MouseUpEvent event) {
                event.preventDefault();
                event.stopPropagation();

                if (down_) {
                  down_ = false;
                  removeStyleName(styles_.toolbarButtonPushed());

                  NativeEvent clickEvent =
                      Document.get()
                          .createClickEvent(
                              1,
                              event.getScreenX(),
                              event.getScreenY(),
                              event.getClientX(),
                              event.getClientY(),
                              event.getNativeEvent().getCtrlKey(),
                              event.getNativeEvent().getAltKey(),
                              event.getNativeEvent().getShiftKey(),
                              event.getNativeEvent().getMetaKey());
                  DomEvent.fireNativeEvent(clickEvent, hasHandlers_);
                }
              }
            });

    return new HandlerRegistration() {
      public void removeHandler() {
        mouseDown.removeHandler();
        mouseOut.removeHandler();
        mouseUp.removeHandler();
      }
    };
  }
Пример #29
0
 @Override
 public HandlerRegistration addClickHandler(final ClickHandler pHandler) {
   return addDomHandler(pHandler, ClickEvent.getType());
 }
  /**
   * This method is used to set opended question data.
   *
   * @param result
   */
  void setOpenendedQuestionsData(ArrayList<UserDataDo> result) {

    int totalUserCount = collectionMetaData.getUserCount();

    final AdvancedFlexTable adTable = new AdvancedFlexTable();
    adTable.getElement().setAttribute("style", "background: #fff; width: 1000px;");

    adTable.setHeaderWidget(0, getHeaderLbl(i18n.GL3259(), 25));
    adTable.setHeaderWidget(1, getHeaderLbl(i18n.GL0308(), 35));
    adTable.setHeaderWidget(2, getHeaderLbl(i18n.GL3260(), 500));
    adTable.setHeaderWidget(3, getHeaderLbl(i18n.GL2084(), 70));
    adTable.setHeaderWidget(4, getHeaderLbl(i18n.GL3261(), 30));
    adTable.setHeaderWidget(5, getHeaderLbl(i18n.GL3273(), 80));

    if (result.size() != 0) {

      for (int i = 0; i < result.size(); i++) {
        adTable.setWidget(i, 0, new Label(String.valueOf(result.get(i).getItemSequence())));

        // Set Question Title
        Label questionTitle = new Label(AnalyticsUtil.html2text(result.get(i).getTitle()));
        questionTitle.setStyleName(res.css().alignCenterAndBackground());
        questionTitle.addStyleName(res.css().alignLeft());
        adTable.setWidget(i, 1, questionTitle);

        // Set completion
        HTMLPanel completionpnl = new HTMLPanel("");
        Label progressBar = new Label();
        progressBar.setStyleName(res.css().setProgressBar());
        completionpnl.add(progressBar);
        Label incompleteProgressBar = new Label();
        incompleteProgressBar.setStyleName(res.css().setIncorrectProgressBar());
        completionpnl.add(incompleteProgressBar);
        int attemptedCount = result.get(i).getTotalAttemptUserCount();
        float maxAvgVal = ((float) attemptedCount) / ((float) totalUserCount);
        progressBar.getElement().getStyle().setWidth(maxAvgVal * 100, Unit.PX);
        incompleteProgressBar.getElement().getStyle().setWidth((100 - maxAvgVal * 100), Unit.PX);
        Label studentTextlbl = new Label(attemptedCount + "/" + totalUserCount + " Students");
        studentTextlbl.setStyleName(res.css().alignCenterAndBackground());
        studentTextlbl.getElement().getStyle().setWidth(100, Unit.PX);
        completionpnl.add(studentTextlbl);
        adTable.setWidget(i, 2, completionpnl);

        // Set time spent
        adTable.setWidget(i, 3, AnalyticsUtil.getTimeStampLabel(result.get(i).getAvgTimeSpent()));

        // Set reactions
        int reaction = result.get(i).getAvgReaction();
        HTMLPanel reactionpnl = new HTMLPanel("");
        reactionpnl.add(new AnalyticsReactionWidget(reaction));
        Label reactioncount = new Label();
        reactionpnl.add(reactioncount);
        reactioncount.setText(reaction + "/5");
        reactioncount.setStyleName(res.css().alignCenterAndBackground());
        adTable.setWidget(i, 4, reactionpnl);

        // set View response label
        Label viewResponselbl = new Label(i18n.GL2286());
        viewResponselbl.setStyleName(res.css().viewResponseTextOpended());
        viewResponselbl
            .getElement()
            .setAttribute("resourceGooruId", result.get(i).getResourceGooruOId());
        viewResponselbl.getElement().setAttribute("questionType", result.get(i).getType());
        viewResponselbl.getElement().setAttribute("labelType", "View Response");
        adTable.setWidget(i, 5, viewResponselbl);
      }
    }

    adTable.getElement().setId("opendedData");
    teacherOpenendedData.add(adTable);
    if (result.size() == 0) {
      Label erroeMsg = new Label();
      erroeMsg.setStyleName(res.css().displayMessageTextForOEQuestions());
      erroeMsg.setText(i18n.GL3118());
      teacherOpenendedData.add(erroeMsg);
    }
    adTable.addDomHandler(new ClickOnTableCell(), ClickEvent.getType());
    adTable
        .getElement()
        .getFirstChildElement()
        .getFirstChildElement()
        .getFirstChildElement()
        .getStyle()
        .setProperty("width", "98% !important");
  }