Java Code Examples for com.google.gwt.event.dom.client.ClickEvent#getSource()

The following examples show how to use com.google.gwt.event.dom.client.ClickEvent#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: CubaCheckBoxGroupWidget.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Override
public void onClick(ClickEvent event) {
    if (!isEnabled() || isReadonly()) {
        event.preventDefault();

        if (isReadonly()
                && (BrowserInfo.get().isIE() || BrowserInfo.get().isEdge())) {
            // IE and Edge do not focus read-only checkbox on click
            Object checkBox = event.getSource();
            if (checkBox instanceof VCheckBox) {
                ((VCheckBox) checkBox).setFocus(true);
            }
        }

        return;
    }

    super.onClick(event);
}
 
Example 2
Source File: ContextFieldSet.java    From bitcoin-transaction-explorer with MIT License 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public void onClick(final ClickEvent event) {
  if (selectedField != null) {
    selectedField.setSelected(false);
  }

  if (selectedField == event.getSource()) {
    selectedField = null;
    return;
  }

  selectedField = (ContextField<T>) event.getSource();
  selectedField.setSelected(true);

  selectedField.fireEvent(new MouseOverEvent() {});
}
 
Example 3
Source File: TableSelecter.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void onClick(ClickEvent event) {
	if (!TableSelecter.this.enable) {
		return;
	}
	boolean fire = false;
	if (event.getSource() == this) {
		fire = TableSelecter.this.setSelected(this.value, this.inputElem.isChecked());
		event.stopPropagation();
	} else if (event.getSource() instanceof TableRow) {
		TableRow<T> row = (TableRow<T>) event.getSource();
		T clickedValue = row.getValue();
		fire = TableSelecter.this.setSelected(clickedValue, !TableSelecter.this.isSelected(clickedValue));
	}

	if (fire) {
		TableSelecter.this.fireEvent(new SelectionEvent(TableSelecter.this.selection));
	}
	this.redraw();
}
 
Example 4
Source File: DayToolbar.java    From calendar-component with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(ClickEvent event) {
    if (!calendar.isDisabled()) {
        if (event.getSource() == nextLabel) {
            if (calendar.getForwardListener() != null) {
                calendar.getForwardListener().forward();
            }
        } else if (event.getSource() == backLabel) {
            if (calendar.getBackwardListener() != null) {
                calendar.getBackwardListener().backward();
            }
        }
    }
}
 
Example 5
Source File: SimpleDayToolbar.java    From calendar-component with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(ClickEvent event) {
    if (!calendar.isDisabled()) {
        if (event.getSource() == nextLabel) {
            if (calendar.getForwardListener() != null) {
                calendar.getForwardListener().forward();
            }
        } else if (event.getSource() == backLabel) {
            if (calendar.getBackwardListener() != null) {
                calendar.getBackwardListener().backward();
            }
        }
    }
}
 
Example 6
Source File: SimpleWeekToolbar.java    From calendar-component with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(ClickEvent event) {
    WeekLabel wl = (WeekLabel) event.getSource();
    if (calendar.getWeekClickListener() != null) {
        calendar.getWeekClickListener()
                .weekClick(wl.getYear() + "w" + wl.getWeek());
    }
}
 
Example 7
Source File: CubaTwinColSelectWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(ClickEvent event) {
    if (!isEnabled() || isReadOnly()) {
        return;
    }

    super.onClick(event);
    if (addAllBtnEnabled) {
        if (event.getSource() == addAll) {
            addAll();
        } else if (event.getSource() == removeAll) {
            removeAll();
        }
    }
}
 
Example 8
Source File: RoomNoteChanges.java    From unitime with Apache License 2.0 5 votes vote down vote up
private ClickHandler clickHandler(final int column) {
	return new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			UniTimeTableHeader header = (UniTimeTableHeader)event.getSource();
			final boolean order = (header.getOrder() == null ? true : !header.getOrder());
			iChanges.sort(header, comparator(column, order));
			LastChangesCookie.getInstance().setSort(column, order);
			header.setOrder(order);
		}
	};
}
 
Example 9
Source File: Button.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onClick(ClickEvent event) {
	Object source = event.getSource();
	event.stopPropagation();
	if (source instanceof Button) {
		((Button<?>) source).fireEvent(new ButtonEvent((Button<?>) source));
	}
}
 
Example 10
Source File: TableBody.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onClick(ClickEvent event) {
	Object source = event.getSource();
	if (source instanceof TableRow) {
		EventBus.get().fireEventFromSource(new RowClickEvent((TableRow<T>) source), TableBody.this);
	}
}
 
Example 11
Source File: AddressBookView.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@UiHandler("selectGroupAnchor")
void onClickGroupAnchor(ClickEvent event) {
	Anchor<Group> anchor = (Anchor<Group>) event.getSource();
	displayGroup(anchor.getValue());
}
 
Example 12
Source File: AddressBookView.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@UiHandler("openContactAnchor")
void onClickContactAnchor(ClickEvent event) {
	Anchor<Contact> anchor = (Anchor<Contact>) event.getSource();
	selectContact(anchor.getValue());
}
 
Example 13
Source File: AddressBookPage.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@UiHandler("selectGroupAnchor")
void onClickGroupAnchor(ClickEvent event) {
	Anchor<Group> anchor = (Anchor<Group>) event.getSource();
	this.displayGroup(anchor.getValue());
}
 
Example 14
Source File: AddressBookPage.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@UiHandler("openContactAnchor")
void onClickContactAnchor(ClickEvent event) {
	Anchor<Contact> anchor = (Anchor<Contact>) event.getSource();
	this.selectContact(anchor.getValue());
}