com.google.gwt.event.dom.client.MouseDownHandler Java Examples
The following examples show how to use
com.google.gwt.event.dom.client.MouseDownHandler.
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: RoomSharingWidget.java From unitime with Apache License 2.0 | 6 votes |
Cell(int day, int slot) { super("cell", "item", isEditable(day, slot) ? "clickable" : null); iDay = day; iSlot = slot; RoomSharingOption option = iModel.getOption(day, slot); if (option == null) { getElement().getStyle().clearBackgroundColor(); setHTML(""); setTitle(""); } else { getElement().getStyle().setBackgroundColor(option.getColor()); setHTML(option.getCode() == null ? "" : option.getCode()); setTitle(CONSTANTS.longDays()[day] + " " + slot2short(slot) + " - " + slot2short(slot + iMode.getStep()) + ": " + option.getName()); } if (isEditable(day, slot)) addMouseDownHandler(new MouseDownHandler() { @Override public void onMouseDown(MouseDownEvent event) { setOption(iOption); } }); }
Example #2
Source File: PeriodPreferencesWidget.java From unitime with Apache License 2.0 | 6 votes |
Cell(int day, int slot, Date date, PeriodInterface period) { super("cell", "item", isEditable() && period != null ? "clickable" : null, period == null ? "disabled" : null, period != null && iModel.isAssigned(period) ? "highlight" : null); iDay = day; iSlot = slot; iDate = date; iPeriod = period; if (period != null) { PreferenceInterface preference = iModel.getPreference(day, slot); if (preference == null) { getElement().getStyle().clearBackgroundColor(); setHTML(""); setTitle(""); } else { getElement().getStyle().setBackgroundColor(preference.getColor()); setTitle(DateTimeFormat.getFormat(CONSTANTS.examPeriodDateFormat()).format(date) + " " + slot2short(slot) + (period == null ? "" : " - " + slot2short(slot + period.getLength())) + ": " + preference.getName()); } if (isEditable()) addMouseDownHandler(new MouseDownHandler() { @Override public void onMouseDown(MouseDownEvent event) { setOption(iPreference); } }); } }
Example #3
Source File: PeriodPreferencesWidget.java From unitime with Apache License 2.0 | 6 votes |
private D(int day, int slot, Date date, PeriodInterface period) { super("cell", "day", isEditable() && period != null ? "clickable" : null, period == null ? "unavailable" : null); iDay = day; iSlot = slot; iDate = date; iPeriod = period; setText(DateTimeFormat.getFormat("d").format(date)); if (period != null) { PreferenceInterface preference = iModel.getPreference(day, slot); if (preference == null) { getElement().getStyle().clearBackgroundColor(); setTitle(""); } else { getElement().getStyle().setBackgroundColor(preference.getColor()); setTitle(DateTimeFormat.getFormat(CONSTANTS.examPeriodDateFormat()).format(date) + " " + slot2short(slot) + (period == null ? "" : " - " + slot2short(slot + period.getLength())) + ": " + preference.getName()); } if (isEditable()) addMouseDownHandler(new MouseDownHandler() { @Override public void onMouseDown(MouseDownEvent event) { setOption(iPreference); } }); } }
Example #4
Source File: Leaf.java From EasyML with Apache License 2.0 | 6 votes |
/** * Create a leaf node for the Tree * * @param name name of the TreeItem * @param module Attached moduleId for the TreeItem */ public Leaf(String name, T module, String style) { // add context menu this.menu = new ContextMenu(); label = new Label(name); this.setWidget(label); label.addMouseDownHandler(new MouseDownHandler() { @Override public void onMouseDown(MouseDownEvent event) { // display the context menu when right click if (event.getNativeButton() == NativeEvent.BUTTON_RIGHT) { menu.setPopupPosition(event.getClientX(), event.getClientY()); menu.show(); } } }); // set moduleId this.module = module; this.addStyleName("bda-treeleaf"); if (!style.equals("")) this.addStyleName(style); }
Example #5
Source File: SimplePaletteItem.java From appinventor-extensions with Apache License 2.0 | 5 votes |
private void addHandlers() { addMouseDownHandler(new MouseDownHandler() { @Override public void onMouseDown(MouseDownEvent arg0) { select(getWidget()); } }); addTouchStartHandler(new TouchStartHandler() { @Override public void onTouchStart(TouchStartEvent event) { select(getWidget()); } }); }
Example #6
Source File: MaterialTabTest.java From gwt-material with Apache License 2.0 | 5 votes |
public void testDynamicTab() { // given MaterialTab tab = getWidget(); // when / then // This will dynamically add new Tab Item MaterialTabItem item = newTabItem(tab, row, 1); boolean[] selectionEventFired = new boolean[]{false}; tab.addSelectionHandler(selectionEvent -> selectionEventFired[0] = true); // This will trigger the selection event of the tab once tab item fired MouseDownEvent item.fireEvent(new GwtEvent<MouseDownHandler>() { @Override public Type<MouseDownHandler> getAssociatedType() { return MouseDownEvent.getType(); } @Override protected void dispatch(MouseDownHandler eventHandler) { eventHandler.onMouseDown(null); } }); // Expected : true assertTrue(selectionEventFired[0]); }
Example #7
Source File: TimeGrid.java From unitime with Apache License 2.0 | 5 votes |
public SelectionPanel(boolean fixed) { setStyleName(fixed ? "selection" : "active-selection"); if (fixed) { iRemove = new P("x"); iRemove.setHTML("×"); iRemove.addMouseDownHandler(new MouseDownHandler() { @Override public void onMouseDown(MouseDownEvent event) { iSelections.remove(SelectionPanel.this); if (iSelection != null) iAllSelections.remove(iSelection); } }); if (iRTL) { iRemove.getElement().getStyle().setLeft(2, Unit.PX); } else { iRemove.getElement().getStyle().setRight(2, Unit.PX); } iRemove.getElement().getStyle().setTop(2, Unit.PX); iRemove.getElement().getStyle().setPosition(Position.ABSOLUTE); add(iRemove); iText = new P("text"); add(iText, 0, 0); } sinkEvents(Event.ONMOUSEDOWN); sinkEvents(Event.ONMOUSEUP); sinkEvents(Event.ONMOUSEMOVE); }
Example #8
Source File: P.java From unitime with Apache License 2.0 | 4 votes |
@Override public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) { return addHandler(handler, MouseDownEvent.getType()); }
Example #9
Source File: ImplPanel.java From incubator-retired-wave with Apache License 2.0 | 4 votes |
@Override public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) { return addDomHandler(handler, MouseDownEvent.getType()); }
Example #10
Source File: ClickableDivPanel.java From incubator-retired-wave with Apache License 2.0 | 4 votes |
@Override public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) { return addDomHandler(handler, MouseDownEvent.getType()); }
Example #11
Source File: Anchor.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 4 votes |
@Override public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) { return this.addDomHandler(handler, MouseDownEvent.getType()); }
Example #12
Source File: ListItem.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 4 votes |
@Override public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) { return this.addDomHandler(handler, MouseDownEvent.getType()); }
Example #13
Source File: AbstractInput.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 4 votes |
@Override public com.google.gwt.event.shared.HandlerRegistration addMouseDownHandler(MouseDownHandler handler) { return this.addDomHandler(handler, MouseDownEvent.getType()); }
Example #14
Source File: ImplPanel.java From swellrt with Apache License 2.0 | 4 votes |
@Override public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) { return addDomHandler(handler, MouseDownEvent.getType()); }
Example #15
Source File: ClickableDivPanel.java From swellrt with Apache License 2.0 | 4 votes |
@Override public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) { return addDomHandler(handler, MouseDownEvent.getType()); }
Example #16
Source File: SingleDateSelector.java From unitime with Apache License 2.0 | 4 votes |
@Override public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) { return addHandler(handler, MouseDownEvent.getType()); }
Example #17
Source File: SingleDateSelector.java From unitime with Apache License 2.0 | 4 votes |
@Override public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) { return addHandler(handler, MouseDownEvent.getType()); }
Example #18
Source File: IntervalSelector.java From unitime with Apache License 2.0 | 4 votes |
@Override public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) { return addHandler(handler, MouseDownEvent.getType()); }
Example #19
Source File: TravelTimes.java From unitime with Apache License 2.0 | 4 votes |
@Override public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) { return addHandler(handler, MouseDownEvent.getType()); }
Example #20
Source File: HandlerPanel.java From appinventor-extensions with Apache License 2.0 | 4 votes |
public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) { return addDomHandler(handler, MouseDownEvent.getType()); }
Example #21
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); }
Example #22
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 #23
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); }