com.google.gwt.dom.client.Style.Cursor Java Examples

The following examples show how to use com.google.gwt.dom.client.Style.Cursor. 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: FileUploader.java    From EasyML with Apache License 2.0 6 votes vote down vote up
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();
	}
 
Example #2
Source File: TimeGrid.java    From unitime with Apache License 2.0 6 votes vote down vote up
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;
	}
}
 
Example #3
Source File: CurriculaCourses.java    From unitime with Apache License 2.0 5 votes vote down vote up
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);
		}
	};
}
 
Example #4
Source File: CourseCurriculaTable.java    From unitime with Apache License 2.0 5 votes vote down vote up
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;
	}
}
 
Example #5
Source File: OpenCloseSectionImage.java    From unitime with Apache License 2.0 5 votes vote down vote up
public OpenCloseSectionImage(boolean opened) {
	super(RESOURCES.treeOpen());
	getElement().getStyle().setCursor(Cursor.POINTER);
	addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			setValue(!getValue(), true);
		}
	});
}
 
Example #6
Source File: UniTimeTableHeader.java    From unitime with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #7
Source File: TimeGrid.java    From unitime with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #8
Source File: AdvisorCourseRequestLine.java    From unitime with Apache License 2.0 5 votes vote down vote up
public void setStatus(ImageResource icon, String message) {
	if (iStatus != null) {
		iStatus.setStatus(icon, message);
		iError.getElement().getStyle().setCursor(Cursor.POINTER);
		resizeFilterIfNeeded();
	}
}
 
Example #9
Source File: CourseRequestLine.java    From unitime with Apache License 2.0 5 votes vote down vote up
public void setStatus(ImageResource icon, String message) {
	if (iStatus != null) {
		iStatus.setStatus(icon, message);
		iError.getElement().getStyle().setCursor(Cursor.POINTER);
		resizeFilterIfNeeded();
	}
}
 
Example #10
Source File: GanttWidget.java    From gantt with Apache License 2.0 5 votes vote down vote up
private void showResizingPointer(Element bar, boolean showPointer) {
    if (showPointer) {
        bar.getStyle().setCursor(Cursor.E_RESIZE);
    } else {
        bar.getStyle().clearCursor();
    }
}
 
Example #11
Source File: DiagramController.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void clearAnimationsOnCanvas() {
	RootPanel.getBodyElement().getStyle().setCursor(Cursor.DEFAULT);
}
 
Example #12
Source File: TimeGrid.java    From unitime with Apache License 2.0 4 votes vote down vote up
@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();
}
 
Example #13
Source File: StudentSchedule.java    From unitime with Apache License 2.0 4 votes vote down vote up
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();
		}
	});
}