Java源码示例:com.google.gwt.dom.client.Style.Cursor

示例1
public void init() {

		uploader.setButtonImageURL("studio/img/uploadimg.png").setButtonWidth(32)
		.setButtonHeight(32)
		.setButtonCursor(Uploader.Cursor.HAND);

		horizontalPanel.setStyleName("bda-fileupload-bottom-hpanel");
		horizontalPanel.setSpacing(10);
		horizontalPanel.add(uploader);
		if (Uploader.isAjaxUploadWithProgressEventsSupported()) {

			dropFilesLabel.getElement().getStyle().setCursor(Cursor.POINTER);
			dropFilesLabel.setSize("32px", "32px");
			dropFilesLabel.setTitle("File dragable upload area");
		}
		horizontalPanel.add(dropFilesLabel);
		horizontalPanel.add(progressBarPanel);
		horizontalPanel.setCellVerticalAlignment(progressBarPanel,
				HasVerticalAlignment.ALIGN_MIDDLE);
		this.add(horizontalPanel);
		initFacet();
	}
 
示例2
private Cursor cursor(double x, double y) {
	if (x <= 6) {
		if (y <= 6)
			return Cursor.NW_RESIZE;
		else if (y >= getHeight() - 6)
			return Cursor.SW_RESIZE;
		else
			return Cursor.W_RESIZE;
	} else if (x >= getWidth() - 6) {
		if (y <= 6)
			return Cursor.NE_RESIZE;
		else if (y >= getHeight() - 6)
			return Cursor.SE_RESIZE;
		else
			return Cursor.E_RESIZE;
	} else if (y <= 6) {
		return Cursor.N_RESIZE;
	} else if (y >= getHeight() - 6) {
		return Cursor.S_RESIZE;
	} else {
		return Cursor.MOVE;
	}
}
 
示例3
public Group(String name, int type, boolean editable) {
	super(name, false);
	iName = name;
	iType = type;
	iGroupEditable = editable;
	setStylePrimaryName("unitime-TinyLabel" + (iType == 1 ? "White" : ""));
	if (iEditable && !iGroupEditable)
		getElement().getStyle().setFontStyle(FontStyle.ITALIC);
	if (iEditable && iGroupEditable) {
		addClickHandler(iNewGroupDialog.getClickHandler());
		getElement().getStyle().setCursor(Cursor.POINTER);
	}
	iOperation = new Operation() {
		@Override
		public String getName() {
			return getElement().getString();
		}
		@Override
		public boolean hasSeparator() {
			return false;
		}

		@Override
		public boolean isApplicable() {
			return iEditable && iGroupEditable && iVisibleCourses == null;
		}

		@Override
		public void execute() {
			assignGroup(null, iName, iType);
		}
	};
}
 
示例4
public void onBrowserEvent(Event event) {
	Element td = getEventTargetCell(event);
	if (td==null) return;
    Element tr = DOM.getParent(td);
    Element body = DOM.getParent(tr);
    final int row = DOM.getChildIndex(body, tr);

    final ChainedCommand command = iRowClicks.get(row);
    
    switch (DOM.eventGetType(event)) {
	case Event.ONMOUSEOVER:
		getRowFormatter().setStyleName(row, "unitime-TableRowHover");
		if (command == null) getRowFormatter().getElement(row).getStyle().setCursor(Cursor.AUTO);
		break;
	case Event.ONMOUSEOUT:
		getRowFormatter().setStyleName(row, null);	
		break;
	case Event.ONCLICK:
		if (command == null) break;
		if (command.getLoadingMessage() != null)
			LoadingWidget.getInstance().show(command.getLoadingMessage());
		getRowFormatter().setStyleName(row, "unitime-TableRowSelected");
		iSelectedRow = row;
		command.execute(new ConditionalCommand() {
			@Override
			public void executeOnSuccess() {
				//getRowFormatter().setStyleName(row, null);	
				if (command.getLoadingMessage() != null)
					LoadingWidget.getInstance().hide();
			}
			@Override
			public void executeOnFailure() {
				getRowFormatter().setStyleName(row, "unitime-TableRowHover");	
				if (command.getLoadingMessage() != null)
					LoadingWidget.getInstance().hide();
			}
		});
		break;
	}
}
 
示例5
public OpenCloseSectionImage(boolean opened) {
	super(RESOURCES.treeOpen());
	getElement().getStyle().setCursor(Cursor.POINTER);
	addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			setValue(!getValue(), true);
		}
	});
}
 
示例6
@Override
public MenuItem addItem(MenuItem item) {
	Character ch = UniTimeHeaderPanel.guessAccessKey(item.getHTML());
	if (ch != null)
		iAccessKeys.put(Character.toLowerCase(ch), item);
	item.getElement().getStyle().setCursor(Cursor.POINTER);
	return super.addItem(item);
}
 
示例7
private Cursor transform(Cursor cursor) {
	if (iRTL) {
		switch (cursor) {
		case E_RESIZE: return Cursor.W_RESIZE;
		case W_RESIZE: return Cursor.E_RESIZE;
		case NE_RESIZE: return Cursor.NW_RESIZE;
		case NW_RESIZE: return Cursor.NE_RESIZE;
		case SE_RESIZE: return Cursor.SW_RESIZE;
		case SW_RESIZE: return Cursor.SE_RESIZE;
		}
	}
	return cursor;
}
 
示例8
public void setStatus(ImageResource icon, String message) {
	if (iStatus != null) {
		iStatus.setStatus(icon, message);
		iError.getElement().getStyle().setCursor(Cursor.POINTER);
		resizeFilterIfNeeded();
	}
}
 
示例9
public void setStatus(ImageResource icon, String message) {
	if (iStatus != null) {
		iStatus.setStatus(icon, message);
		iError.getElement().getStyle().setCursor(Cursor.POINTER);
		resizeFilterIfNeeded();
	}
}
 
示例10
private void showResizingPointer(Element bar, boolean showPointer) {
    if (showPointer) {
        bar.getStyle().setCursor(Cursor.E_RESIZE);
    } else {
        bar.getStyle().clearCursor();
    }
}
 
示例11
private void clearAnimationsOnCanvas() {
	RootPanel.getBodyElement().getStyle().setCursor(Cursor.DEFAULT);
}
 
示例12
@Override
public void onBrowserEvent(Event event) {
	if (Event.ONMOUSEMOVE == DOM.eventGetType(event) && !iSelection.isActive() && iMoving != null) {
		iMoving.onBrowserEvent(event);
		if (iMoving.iCursor != null)
			getElement().getStyle().setCursor(iMoving.iCursor);
		return;
	}

	double x = event.getClientX() - getAbsoluteLeft() + Window.getScrollLeft();
	double y = event.getClientY() - getAbsoluteTop() + Window.getScrollTop();

	int slot = 3 * Math.min(Math.max(0, (int)Math.round(4 * (y - 1 + iStart * iCellHeight) / iCellHeight)), 96);
	int day = Math.min(Math.max(0, (int)Math.floor((x - 2) / iCellWidth)), iDays.length - 1);
	int weeks = (isSingleRoom() ? iSelectedWeeks.size() : iRoomResources.size());
	int week = Math.min(Math.max(0, (int)Math.floor(weeks * (x - 2 - iCellWidth * day) / (iCellWidth - 6))), weeks - 1);
	if (iRTL) {
		day = iDays.length - day - 1;
		week = weeks - week - 1;
	}
	int dayOfWeek = iDays[day];
	int h = slot / 12;
	int m = 5 * (slot % 12);
	String time = (CONSTANTS.useAmPm() ? (h == 0 ? "12": h <= 12 ? h : h-12) : h) + ":" + (m < 10 ? "0" : "") + m + (CONSTANTS.useAmPm() ? (h <= 11 ? "a" : "p") : "");
	
	int dayInv = (iDayOfWeeks == null ? (7 + dayOfWeek - iPropertiesProvider.getFirstDayOfWeek()) % 7 : dayOfWeek);
	String text = (iDayOfWeeks == null ? CONSTANTS.longDays()[dayOfWeek] : iDayOfWeeks.get(dayOfWeek)) + " " + (isSingleRoom() ? iSelectedWeeks.get(week) : iSelectedWeeks.get(0)).getDayNames().get(dayInv) +
			" " + time + (isSingleRoom() ? "" : " " + iRoomResources.get(week).getName());
	ResourceInterface room = (isSingleRoom() ? iRoomResources.get(0) : iRoomResources.get(week));
	iPopup.setPopupPosition(event.getClientX() + Window.getScrollLeft(), event.getClientY() + Window.getScrollTop());
	
	getElement().getStyle().setCursor(Cursor.CROSSHAIR);
	
	switch (DOM.eventGetType(event)) {
	case Event.ONMOUSEDOWN:
		iSelection.setStart(dayOfWeek, slot, week);
		iSelection.setEnd(dayOfWeek, slot, week);
		iSelection.setVisible(true);
		iSelection.setActive(true);
		break;
	case Event.ONMOUSEMOVE:
		iSelection.setEnd(dayOfWeek, slot, week);
		if (!iPopup.isShowing()) iPopup.show();
		if (!room.getId().equals(iLastRoomId)) {
			RoomHint.showHint(iPopup.getElement(), room.getId(), "", (room.hasDistance() ? String.valueOf(Math.round(room.getDistance())) : ""), false);
			iLastRoomId = room.getId();
		}
		break;
	case Event.ONMOUSEUP:
		onMouseUp();
		break;
	case Event.ONMOUSEOVER:
		if (!iPopup.isShowing() && (iSelection.isActive() || iMoving == null)) iPopup.show();
		if (iSelection.isActive() && !iSelection.isVisible()) {
			iSelection.setVisible(true);					
		}
		if (!room.getId().equals(iLastRoomId)) {
			RoomHint.showHint(iPopup.getElement(), room.getId(), "", (room.hasDistance() ? String.valueOf(Math.round(room.getDistance())) : ""), false);
			iLastRoomId = room.getId();
		}
		break;
	case Event.ONMOUSEOUT:
		Element child = DOM.eventGetToElement(event);
		if (child != null && !getElement().isOrHasChild(child)) {
			if (iPopup.isShowing()) {
				iPopup.hide();
				RoomHint.hideHint(); iLastRoomId = null;
			}
			iSelection.setVisible(false);
		}
		/*
		if (iSelection.isActive() && !DOM.isOrHasChild(TimeGrid.this.getElement(), DOM.eventGetToElement(event))) {
			iSelection.setActive(false);
		}
		*/
		break;
	}
	
	iHint.setText((iSelection.isVisible() && iSelection.isActive() ? iSelection.toString() : text));
	
	event.preventDefault();
	event.stopPropagation();
}
 
示例13
CriticalCell(Request request) {
	super(request.isCritical() ? RESOURCES.requestsCritical() : request.isImportant() ? RESOURCES.requestsImportant() : RESOURCES.requestsNotCritical(), "", null);
	getIcon().setTitle(request.isCritical() ? MESSAGES.descriptionRequestCritical() : request.isImportant() ? MESSAGES.descriptionRequestImportant() : MESSAGES.descriptionRequestNotCritical());
	getIcon().setAltText(request.isCritical() ? MESSAGES.descriptionRequestCritical() : request.isImportant() ? MESSAGES.descriptionRequestImportant() : MESSAGES.descriptionRequestNotCritical());
	iRequest = request;
	getIcon().getElement().getStyle().setCursor(Cursor.POINTER);
	getIcon().addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			final PopupPanel popup = new PopupPanel(true);
			popup.addStyleName("unitime-Menu");
			MenuBar menu = new MenuBarWithAccessKeys();
			
			MenuItem item1 = new MenuItem(MESSAGES.opSetCritical(), true, new Command() {
				@Override
				public void execute() {
					popup.hide();
					change(1);
				}
			});
			menu.addItem(item1);
			
			MenuItem item2 = new MenuItem(MESSAGES.opSetImportant(), true, new Command() {
				@Override
				public void execute() {
					popup.hide();
					change(2);
				}
			});
			menu.addItem(item2);
			
			MenuItem item3 = new MenuItem(MESSAGES.opSetNotCritical(), true, new Command() {
				@Override
				public void execute() {
					popup.hide();
					change(0);
				}
			});
			menu.addItem(item3);
			
			MenuItem item4 = new MenuItem(MESSAGES.opSetCriticalNotSet(), true, new Command() {
				@Override
				public void execute() {
					popup.hide();
					change(null);
				}
			});
			menu.addItem(item4);
			menu.setVisible(true);
			
			popup.add(menu);
			popup.showRelativeTo((Widget)event.getSource());
			((MenuBar)popup.getWidget()).focus();
		}
	});
}