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

The following are Jave code examples for showing how to use Cursor of the com.google.gwt.dom.client.Style class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: appformer   File: RestrictedMousePanMediatorTest.java   Source Code and License Vote up 6 votes
@Test
public void testSetCursor() {

    final Viewport viewport = mock(Viewport.class);
    final DivElement divElement = mock(DivElement.class);
    final Style.Cursor cursor = mock(Style.Cursor.class);
    final Style style = mock(Style.class);

    doReturn(style).when(divElement).getStyle();
    doReturn(divElement).when(viewport).getElement();
    doReturn(viewport).when(mediator).getLayerViewport();

    mediator.setCursor(cursor);

    verify(style).setCursor(cursor);
}
 
Example 2
Project: gwt-jui   File: CursorUtil.java   Source Code and License Vote up 5 votes
public static Style.Cursor fromCssName(String cssName) {
    for(Style.Cursor cursor : Style.Cursor.values()) {
        if(cursor.getCssName().equals(cssName)) {
            return cursor;
        }
    }
    return Style.Cursor.AUTO;
}
 
Example 3
Project: umlet   File: Converter.java   Source Code and License Vote up 5 votes
public static Style.Cursor convert(CursorOwn in) {
	switch (in) {
		case N:
			return Style.Cursor.N_RESIZE;
		case NE:
			return Style.Cursor.NE_RESIZE;
		case E:
			return Style.Cursor.E_RESIZE;
		case SE:
			return Style.Cursor.SE_RESIZE;
		case S:
			return Style.Cursor.S_RESIZE;
		case SW:
			return Style.Cursor.SW_RESIZE;
		case W:
			return Style.Cursor.W_RESIZE;
		case NW:
			return Style.Cursor.NW_RESIZE;
		case HAND:
			return Style.Cursor.POINTER;
		case MOVE:
			return Style.Cursor.MOVE;
		case DEFAULT:
			return Style.Cursor.DEFAULT;
		case CROSS:
			return Style.Cursor.CROSSHAIR;
		case TEXT:
			return Style.Cursor.TEXT;
		default:
			throw new RuntimeException("Unknown Cursor: " + in);
	}
}
 
Example 4
Project: appformer   File: GridWidgetDnDMouseMoveHandler.java   Source Code and License Vote up 5 votes
private void setCursor(final Style.Cursor cursor) {
    for (IMediator mediator : layer.getViewport().getMediators()) {
        if (mediator instanceof RestrictedMousePanMediator) {
            if (((RestrictedMousePanMediator) mediator).isDragging()) {
                return;
            }
        }
    }
    layer.getViewport().getElement().getStyle().setCursor(cursor);
    state.setCursor(cursor);
}
 
Example 5
Project: gwt-jui   File: Draggable.java   Source Code and License Vote up 4 votes
public Style.Cursor getCursor() {
    return CursorUtil.fromCssName((String)getOption("cursor"));
}
 
Example 6
Project: gwt-jui   File: Draggable.java   Source Code and License Vote up 4 votes
/**
 * The CSS cursor during the drag operation.
 */
public void setCursor(Style.Cursor cursor) {
    setOption("cursor", cursor);
}
 
Example 7
Project: appformer   File: GridWidgetDnDMouseDownHandler.java   Source Code and License Vote up 4 votes
private void setCursor(final Style.Cursor cursor) {
    layer.getViewport().getElement().getStyle().setCursor(cursor);
    state.setCursor(cursor);
}
 
Example 8
Project: appformer   File: RestrictedMousePanMediator.java   Source Code and License Vote up 4 votes
protected void setCursor(final Style.Cursor cursor) {
    getLayerViewport().getElement().getStyle().setCursor(cursor);
}
 
Example 9
Project: appformer   File: WorkbenchSplitLayoutPanel.java   Source Code and License Vote up 4 votes
@Override
protected Style.Cursor getHoverCursorStyle() {
    return Style.Cursor.COL_RESIZE;
}
 
Example 10
Project: appformer   File: WorkbenchSplitLayoutPanel.java   Source Code and License Vote up 4 votes
@Override
protected Style.Cursor getHoverCursorStyle() {
    return Style.Cursor.ROW_RESIZE;
}
 
Example 11
Project: appformer   File: GridWidgetDnDHandlersState.java   Source Code and License Vote up 2 votes
/**
 * Returns the Cursor type to be shown for the current operation. This primarily used in conjunction with DOMElement based cells.
 * When the pointer moves over a DOM element the browser determines the Cursor to show based on the DOM element's CSS. This
 * however can be different to the pointer required during, for example, a column resize operation. In such cases the
 * browser changes the pointer to that defined by CSS replacing that set by the MouseMove handler.
 * @return
 */
public Style.Cursor getCursor() {
    return cursor;
}
 
Example 12
Project: appformer   File: GridWidgetDnDHandlersState.java   Source Code and License Vote up 2 votes
/**
 * Sets the Cursor type to be shown for the current operation.
 * @param cursor
 */
public void setCursor(Style.Cursor cursor) {
    this.cursor = cursor;
}
 
Example 13
Project: appformer   File: WorkbenchSplitLayoutPanel.java   Source Code and License Vote up 0 votes
protected abstract Style.Cursor getHoverCursorStyle();