本文整理汇总了Java中com.google.gwt.user.client.ui.Label.addMouseDownHandler方法的典型用法代码示例。如果您正苦于以下问题:Java Label.addMouseDownHandler方法的具体用法?Java Label.addMouseDownHandler怎么用?Java Label.addMouseDownHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.Label
的用法示例。
在下文中一共展示了Label.addMouseDownHandler方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Leaf
import com.google.gwt.user.client.ui.Label; //导入方法依赖的package包/类
/**
* 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);
}
示例2: SimpleDayCell
import com.google.gwt.user.client.ui.Label; //导入方法依赖的package包/类
public SimpleDayCell(VCalendar calendar, int row, int cell) {
this.calendar = calendar;
this.row = row;
this.cell = cell;
setStylePrimaryName("v-calendar-month-day");
caption = new Label();
caption.setStyleName("v-calendar-day-number");
caption.addMouseDownHandler(this);
caption.addMouseUpHandler(this);
add(caption);
bottomspacer = new HTML();
bottomspacer.setStyleName("v-calendar-bottom-spacer-empty");
bottomspacer.setWidth(3 + "em");
add(bottomspacer);
}
示例3: setHeaderRow
import com.google.gwt.user.client.ui.Label; //导入方法依赖的package包/类
/**
* 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);
}
示例4: setHeaderRow
import com.google.gwt.user.client.ui.Label; //导入方法依赖的package包/类
/**
* 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);
}