Java Code Examples for com.google.gwt.event.dom.client.MouseDownEvent#getSource()
The following examples show how to use
com.google.gwt.event.dom.client.MouseDownEvent#getSource() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TableOrder.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void onMouseDown(MouseDownEvent event) { this.onMouseUp(null); Icon dragIcon = (Icon) event.getSource(); this.selectedRow = (TableRow<T>) dragIcon.getParent().getParent(); this.body = (TableEditorBody<T>) this.selectedRow.getParent(); this.overRegistration = new HandlerRegistrationCollection(); this.upRegistration = RootPanel.get().addDomHandler(this, MouseUpEvent.getType()); this.rows = Lists.newArrayList(this.body.getRows()); for (TableRow<T> row : this.rows) { this.overRegistration.add(row.addDomHandler(this, MouseOverEvent.getType())); } TableOrder.this.disableTextSelection(true); RootPanel.get().getElement().getStyle().setCursor(Style.Cursor.MOVE); StyleUtils.addStyle(this.selectedRow, TableOrder.STYLE_ROW_DRAGING); }
Example 2
Source File: DateCellContainer.java From calendar-component with Apache License 2.0 | 4 votes |
@Override public void onMouseDown(MouseDownEvent event) { clickTargetWidget = (Widget) event.getSource(); event.stopPropagation(); }
Example 3
Source File: ProjectList.java From appinventor-extensions with Apache License 2.0 | 4 votes |
/** * Adds the header row to the table. * */ private void setHeaderRow() { table.getRowFormatter().setStyleName(0, "ode-ProjectHeaderRow"); HorizontalPanel nameHeader = new HorizontalPanel(); final Label nameHeaderLabel = new Label(MESSAGES.projectNameHeader()); nameHeaderLabel.addStyleName("ode-ProjectHeaderLabel"); nameHeader.add(nameHeaderLabel); nameSortIndicator.addStyleName("ode-ProjectHeaderLabel"); nameHeader.add(nameSortIndicator); table.setWidget(0, 1, nameHeader); HorizontalPanel dateCreatedHeader = new HorizontalPanel(); final Label dateCreatedHeaderLabel = new Label(MESSAGES.projectDateCreatedHeader()); dateCreatedHeaderLabel.addStyleName("ode-ProjectHeaderLabel"); dateCreatedHeader.add(dateCreatedHeaderLabel); dateCreatedSortIndicator.addStyleName("ode-ProjectHeaderLabel"); dateCreatedHeader.add(dateCreatedSortIndicator); table.setWidget(0, 2, dateCreatedHeader); HorizontalPanel dateModifiedHeader = new HorizontalPanel(); final Label dateModifiedHeaderLabel = new Label(MESSAGES.projectDateModifiedHeader()); dateModifiedHeaderLabel.addStyleName("ode-ProjectHeaderLabel"); dateModifiedHeader.add(dateModifiedHeaderLabel); dateModifiedSortIndicator.addStyleName("ode-ProjectHeaderLabel"); dateModifiedHeader.add(dateModifiedSortIndicator); table.setWidget(0, 3, dateModifiedHeader); HorizontalPanel publishedHeader = new HorizontalPanel(); final Label publishedHeaderLabel = new Label(MESSAGES.projectPublishedHeader()); publishedHeaderLabel.addStyleName("ode-ProjectHeaderLabel"); publishedHeader.add(publishedHeaderLabel); publishedSortIndicator.addStyleName("ode-ProjectHeaderLabel"); publishedHeader.add(publishedSortIndicator); table.setWidget(0, 4, publishedHeader); MouseDownHandler mouseDownHandler = new MouseDownHandler() { @Override public void onMouseDown(MouseDownEvent e) { SortField clickedSortField; if (e.getSource() == nameHeaderLabel || e.getSource() == nameSortIndicator) { clickedSortField = SortField.NAME; } else if (e.getSource() == dateCreatedHeaderLabel || e.getSource() == dateCreatedSortIndicator) { clickedSortField = SortField.DATE_CREATED; } else if (e.getSource() == dateModifiedHeaderLabel || e.getSource() == dateModifiedSortIndicator){ clickedSortField = SortField.DATE_MODIFIED; }else{ clickedSortField = SortField.PUBLISHED; } changeSortOrder(clickedSortField); } }; nameHeaderLabel.addMouseDownHandler(mouseDownHandler); nameSortIndicator.addMouseDownHandler(mouseDownHandler); dateCreatedHeaderLabel.addMouseDownHandler(mouseDownHandler); dateCreatedSortIndicator.addMouseDownHandler(mouseDownHandler); dateModifiedHeaderLabel.addMouseDownHandler(mouseDownHandler); dateModifiedSortIndicator.addMouseDownHandler(mouseDownHandler); publishedHeaderLabel.addMouseDownHandler(mouseDownHandler); publishedSortIndicator.addMouseDownHandler(mouseDownHandler); }
Example 4
Source File: TrashProjectList.java From appinventor-extensions with Apache License 2.0 | 4 votes |
/** * Adds the header row to the table. * */ private void setHeaderRow() { table.getRowFormatter().setStyleName(0, "ode-ProjectHeaderRow"); HorizontalPanel nameHeader = new HorizontalPanel(); final Label nameHeaderLabel = new Label(MESSAGES.projectNameHeader()); nameHeaderLabel.addStyleName("ode-ProjectHeaderLabel"); nameHeader.add(nameHeaderLabel); nameSortIndicator.addStyleName("ode-ProjectHeaderLabel"); nameHeader.add(nameSortIndicator); table.setWidget(0, 1, nameHeader); HorizontalPanel dateCreatedHeader = new HorizontalPanel(); final Label dateCreatedHeaderLabel = new Label(MESSAGES.projectDateCreatedHeader()); dateCreatedHeaderLabel.addStyleName("ode-ProjectHeaderLabel"); dateCreatedHeader.add(dateCreatedHeaderLabel); dateCreatedSortIndicator.addStyleName("ode-ProjectHeaderLabel"); dateCreatedHeader.add(dateCreatedSortIndicator); table.setWidget(0, 2, dateCreatedHeader); HorizontalPanel dateModifiedHeader = new HorizontalPanel(); final Label dateModifiedHeaderLabel = new Label(MESSAGES.projectDateModifiedHeader()); dateModifiedHeaderLabel.addStyleName("ode-ProjectHeaderLabel"); dateModifiedHeader.add(dateModifiedHeaderLabel); dateModifiedSortIndicator.addStyleName("ode-ProjectHeaderLabel"); dateModifiedHeader.add(dateModifiedSortIndicator); table.setWidget(0, 3, dateModifiedHeader); HorizontalPanel publishedHeader = new HorizontalPanel(); final Label publishedHeaderLabel = new Label(MESSAGES.projectPublishedHeader()); publishedHeaderLabel.addStyleName("ode-ProjectHeaderLabel"); publishedHeader.add(publishedHeaderLabel); publishedSortIndicator.addStyleName("ode-ProjectHeaderLabel"); publishedHeader.add(publishedSortIndicator); table.setWidget(0, 4, publishedHeader); MouseDownHandler mouseDownHandler = new MouseDownHandler() { @Override public void onMouseDown(MouseDownEvent e) { SortField clickedSortField; if (e.getSource() == nameHeaderLabel || e.getSource() == nameSortIndicator) { clickedSortField = SortField.NAME; } else if (e.getSource() == dateCreatedHeaderLabel || e.getSource() == dateCreatedSortIndicator) { clickedSortField = SortField.DATE_CREATED; } else if (e.getSource() == dateModifiedHeaderLabel || e.getSource() == dateModifiedSortIndicator) { clickedSortField = SortField.DATE_MODIFIED; } else { clickedSortField = SortField.PUBLISHED; } changeSortOrder(clickedSortField); } }; nameHeaderLabel.addMouseDownHandler(mouseDownHandler); nameSortIndicator.addMouseDownHandler(mouseDownHandler); dateCreatedHeaderLabel.addMouseDownHandler(mouseDownHandler); dateCreatedSortIndicator.addMouseDownHandler(mouseDownHandler); dateModifiedHeaderLabel.addMouseDownHandler(mouseDownHandler); dateModifiedSortIndicator.addMouseDownHandler(mouseDownHandler); publishedHeaderLabel.addMouseDownHandler(mouseDownHandler); publishedSortIndicator.addMouseDownHandler(mouseDownHandler); }
Example 5
Source File: AdminUserList.java From appinventor-extensions with Apache License 2.0 | 4 votes |
/** * Adds the header row to the table. * */ private void setHeaderRow() { if (galleryEnabledHolder.enabled) { table.resizeColumns(5); // Number of columns varies based on whether or not // the Gallery is enabled } else { table.resizeColumns(4); } table.getRowFormatter().setStyleName(0, "ode-ProjectHeaderRow"); HorizontalPanel emailHeader = new HorizontalPanel(); final Label emailHeaderLabel = new Label("User Email"); int column = 0; emailHeaderLabel.addStyleName("ode-ProjectHeaderLabel"); emailHeader.add(emailHeaderLabel); emailHeader.add(nameSortIndicator); table.setWidget(0, column, emailHeader); column += 1; HorizontalPanel uidHeader = new HorizontalPanel(); final Label uidHeaderLabel = new Label("UID"); uidHeaderLabel.addStyleName("ode-ProjectHeaderLabel"); uidHeader.add(uidHeaderLabel); table.setWidget(0, column++, uidHeader); HorizontalPanel adminHeader = new HorizontalPanel(); final Label adminHeaderLabel = new Label("isAdmin?"); adminHeaderLabel.addStyleName("ode-ProjectHeaderLabel"); adminHeader.add(adminHeaderLabel); table.setWidget(0, column++, adminHeader); if (galleryEnabledHolder.enabled) { HorizontalPanel moderatorHeader = new HorizontalPanel(); final Label moderatorHeaderLabel = new Label("isModerator?"); moderatorHeaderLabel.addStyleName("ode-ProjectHeaderLabel"); moderatorHeader.add(moderatorHeaderLabel); table.setWidget(0, column++, moderatorHeader); } HorizontalPanel visitedHeader = new HorizontalPanel(); final Label visitedLabel = new Label("Visited"); visitedLabel.addStyleName("ode-ProjectHeaderLabel"); visitedHeader.add(visitedLabel); visitedHeader.add(visitedSortIndicator); table.setWidget(0, column++, visitedHeader); MouseDownHandler mouseDownHandler = new MouseDownHandler() { @Override public void onMouseDown(MouseDownEvent e) { SortField clickedSortField; if (e.getSource() == emailHeaderLabel || e.getSource() == nameSortIndicator) { clickedSortField = SortField.NAME; } else if (e.getSource() == visitedLabel || e.getSource() == visitedSortIndicator) { clickedSortField = SortField.VISITED; } else { return; } changeSortOrder(clickedSortField); } }; emailHeaderLabel.addMouseDownHandler(mouseDownHandler); nameSortIndicator.addMouseDownHandler(mouseDownHandler); visitedLabel.addMouseDownHandler(mouseDownHandler); visitedSortIndicator.addMouseDownHandler(mouseDownHandler); }