public void onClick(ClickEvent e) {

    GPoint point = table.getIndexFromPixel(e.getClientX(), e.getClientY());
    if (editor.isEditing()) {
      String text = editor.getEditingValue();
      if (text.startsWith("=")) {
        point = table.getIndexFromPixel(e.getClientX(), e.getClientY());
        if (point != null) {
          int column = point.getX();
          int row = point.getY();
          GeoElement geo = RelativeCopy.getValue(app, column - 1, row - 1);
        }
      }
      selectedCellName = null;
      prefix0 = null;
      table.isDragging2 = false;
      table.repaint();
    } /*? else if (app.getMode() != EuclidianConstants.MODE_SELECTION_LISTENER) {
      	int row = point.y;//?//table.rowAtPoint(e.getPoint());
      	int col = point.x;//?//table.columnAtPoint(e.getPoint());
      	GeoElement geo = (GeoElement) model.getValueAt(row, col);
      	// let euclidianView know about the click
      	AbstractEvent event = geogebra.web.euclidian.event.MouseEvent
      			.wrapEvent(e);
      	app.getActiveEuclidianView().clickedGeo(geo, event);
      	event.release();
      }*/
  }
Пример #2
0
  /**
   * Determine if the given click was inside the boundaries of the given widget.
   *
   * @param pWidget the widget
   * @param pClickEvent the click
   * @return <code>true</code> if yes
   */
  public static boolean isInside(final Widget pWidget, final ClickEvent pClickEvent) {
    LOG.enter("isInside"); // $NON-NLS-1$

    boolean result = false;
    final int cx = pClickEvent.getClientX();
    final int cy = pClickEvent.getClientY();
    final int wleft = pWidget.getAbsoluteLeft();
    final int wtop = pWidget.getAbsoluteTop();

    if (LOG.isDetailEnabled()) {
      LOG.detail(
          "isInside", //$NON-NLS-1$
          "Click at ("
              + cx
              + ','
              + cy //$NON-NLS-1$
              + "), widget pos ("
              + wleft
              + ','
              + wtop //$NON-NLS-1$
              + "), widget dims ["
              + pWidget.getOffsetWidth()
              + ',' //$NON-NLS-1$
              + pWidget.getOffsetHeight()
              + ']');
    }
    if (cx >= wleft
        && cy >= wtop
        && cx < wleft + pWidget.getOffsetWidth()
        && cy < wtop + pWidget.getOffsetHeight()) {
      result = true;
    }

    LOG.exit("isInside", Boolean.valueOf(result)); // $NON-NLS-1$
    return result;
  }
Пример #3
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();
  }