List of usage examples for com.google.gwt.user.client.ui UIObject setStyleName
public static void setStyleName(Element elem, String style, boolean add)
From source file:fi.jasoft.dragdroplayouts.client.ui.formlayout.VDDFormLayout.java
License:Apache License
/** * Removes any applies drag and drop style applied by emphasis() *///from ww w. j a va2 s.co m protected void deEmphasis() { if (currentlyEmphasised != null) { // Universal over style UIObject.setStyleName(currentlyEmphasised, OVER, false); UIObject.setStyleName(currentlyEmphasised, OVER_SPACED, false); // Vertical styles UIObject.setStyleName(currentlyEmphasised, OVER + "-" + VerticalDropLocation.TOP.toString().toLowerCase(), false); UIObject.setStyleName(currentlyEmphasised, OVER + "-" + VerticalDropLocation.MIDDLE.toString().toLowerCase(), false); UIObject.setStyleName(currentlyEmphasised, OVER + "-" + VerticalDropLocation.BOTTOM.toString().toLowerCase(), false); currentlyEmphasised = null; } }
From source file:fi.jasoft.dragdroplayouts.client.ui.formlayout.VDDFormLayout.java
License:Apache License
/** * Empasises the drop location of the component when hovering over a hildComponentContainer. * Passing null as the container removes any previous emphasis. * // w ww . j a v a 2s . co m * @param container The container which we are hovering over * @param event The drag event */ protected void emphasis(Widget widget, VDragEvent event) { // Remove emphasis from previous hovers deEmphasis(); // Validate if (widget == null || !getElement().isOrHasChild(widget.getElement())) { return; } /* * Get row for widget */ Element rowElement = getRowFromChildElement(widget.getElement(), VDDFormLayout.this.getElement()); currentlyEmphasised = rowElement; if (rowElement != this.getElement()) { VerticalDropLocation vl = getVerticalDropLocation(rowElement, event); UIObject.setStyleName(rowElement, OVER + "-" + vl.toString().toLowerCase(), true); } else { UIObject.setStyleName(rowElement, OVER, true); } }
From source file:fi.jasoft.dragdroplayouts.client.ui.gridlayout.VDDGridLayout.java
License:Apache License
/** * Emphasizes a component container when user is hovering a dragged component over the container. * //from www .ja va2 s . c o m * @param container The container * @param event */ protected void emphasis(CellDetails cell, VDragEvent event) { Style shadowStyle = dragShadow.getElement().getStyle(); shadowStyle.setPosition(Position.ABSOLUTE); shadowStyle.setWidth(cell.width, Unit.PX); shadowStyle.setHeight(cell.height, Unit.PX); shadowStyle.setLeft(cell.x, Unit.PX); shadowStyle.setTop(cell.y, Unit.PX); // Remove any existing empasis deEmphasis(); // Ensure we are not dragging ourself into ourself ComponentConnector draggedConnector = (ComponentConnector) event.getTransferable() .getData(Constants.TRANSFERABLE_DETAIL_COMPONENT); if (draggedConnector != null && draggedConnector.getWidget() == VDDGridLayout.this) { return; } HorizontalDropLocation hl = getHorizontalDropLocation(cell, event); VerticalDropLocation vl = getVerticalDropLocation(cell, event); // Apply over style UIObject.setStyleName(dragShadow.getElement(), OVER, true); // Add vertical location dependent style UIObject.setStyleName(dragShadow.getElement(), OVER + "-" + vl.toString().toLowerCase(), true); // Add horizontal location dependent style UIObject.setStyleName(dragShadow.getElement(), OVER + "-" + hl.toString().toLowerCase(), true); }
From source file:fi.jasoft.dragdroplayouts.client.ui.gridlayout.VDDGridLayout.java
License:Apache License
/** * Removes any emphasis previously set by emphasis *//*from www . ja v a 2s .c o m*/ protected void deEmphasis() { UIObject.setStyleName(dragShadow.getElement(), OVER, false); // Horizontal styles UIObject.setStyleName(dragShadow.getElement(), OVER + "-" + HorizontalDropLocation.LEFT.toString().toLowerCase(), false); UIObject.setStyleName(dragShadow.getElement(), OVER + "-" + HorizontalDropLocation.CENTER.toString().toLowerCase(), false); UIObject.setStyleName(dragShadow.getElement(), OVER + "-" + HorizontalDropLocation.RIGHT.toString().toLowerCase(), false); // Vertical styles UIObject.setStyleName(dragShadow.getElement(), OVER + "-" + VerticalDropLocation.TOP.toString().toLowerCase(), false); UIObject.setStyleName(dragShadow.getElement(), OVER + "-" + VerticalDropLocation.MIDDLE.toString().toLowerCase(), false); UIObject.setStyleName(dragShadow.getElement(), OVER + "-" + VerticalDropLocation.BOTTOM.toString().toLowerCase(), false); }
From source file:fi.jasoft.dragdroplayouts.client.ui.horizontallayout.VDDHorizontalLayout.java
License:Apache License
/** * Empasises the drop location of the component when hovering over a hildComponentContainer. * Passing null as the container removes any previous emphasis. * /*from w w w. j av a 2 s . c o m*/ * @param container The container which we are hovering over * @param event The drag event */ protected void emphasis(Widget container, VDragEvent event) { // Remove emphasis from previous hovers deEmphasis(); // validate container if (container == null || !getElement().isOrHasChild(container.getElement())) { return; } currentlyEmphasised = container; UIObject.setStyleName(container.getElement(), OVER, true); // Add drop location specific style if (container.getElement().equals(this.getElement())) { UIObject.setStyleName(container.getElement(), OVER + "-" + HorizontalDropLocation.CENTER.toString().toLowerCase(), true); } else { UIObject.setStyleName(container.getElement(), OVER + "-" + getHorizontalDropLocation(container, event).toString().toLowerCase(), true); } }
From source file:fi.jasoft.dragdroplayouts.client.ui.VDDGridLayout.java
License:Apache License
/** * Emphasizes a component container when user is hovering a dragged * component over the container.//from w w w . j a v a 2s. com * * @param container * The container * @param event */ protected void emphasis(CellDetails cell, VDragEvent event) { // Remove any existing empasis deEmphasis(); // Ensure we are not dragging ourself into ourself Widget draggedComponent = (Widget) event.getTransferable().getData(Constants.TRANSFERABLE_DETAIL_COMPONENT); if (draggedComponent == VDDGridLayout.this) { return; } HorizontalDropLocation hl = getHorizontalDropLocation(cell, event); VerticalDropLocation vl = getVerticalDropLocation(cell, event); // Apply over style UIObject.setStyleName(dragShadow.getElement(), OVER, true); // Add vertical location dependent style UIObject.setStyleName(dragShadow.getElement(), OVER + "-" + vl.toString().toLowerCase(), true); // Add horizontal location dependent style UIObject.setStyleName(dragShadow.getElement(), OVER + "-" + hl.toString().toLowerCase(), true); }
From source file:fi.jasoft.dragdroplayouts.client.ui.VDDGridLayout.java
License:Apache License
/** * Removes any emphasis previously set by emphasis *//* ww w . j ava2s .com*/ private void deEmphasis() { UIObject.setStyleName(dragShadow.getElement(), OVER, false); // Horizontal styles UIObject.setStyleName(dragShadow.getElement(), OVER + "-" + HorizontalDropLocation.LEFT.toString().toLowerCase(), false); UIObject.setStyleName(dragShadow.getElement(), OVER + "-" + HorizontalDropLocation.CENTER.toString().toLowerCase(), false); UIObject.setStyleName(dragShadow.getElement(), OVER + "-" + HorizontalDropLocation.RIGHT.toString().toLowerCase(), false); // Vertical styles UIObject.setStyleName(dragShadow.getElement(), OVER + "-" + VerticalDropLocation.TOP.toString().toLowerCase(), false); UIObject.setStyleName(dragShadow.getElement(), OVER + "-" + VerticalDropLocation.MIDDLE.toString().toLowerCase(), false); UIObject.setStyleName(dragShadow.getElement(), OVER + "-" + VerticalDropLocation.BOTTOM.toString().toLowerCase(), false); }
From source file:fi.jasoft.dragdroplayouts.client.ui.VDDHorizontalLayout.java
License:Apache License
/** * Removes any applies drag and drop style applied by emphasis() *///from www. jav a 2 s .c om private void deEmphasis() { if (currentlyEmphasised != null) { // Universal over style UIObject.setStyleName(currentlyEmphasised.getElement(), OVER, false); UIObject.setStyleName(currentlyEmphasised.getElement(), OVER_SPACED, false); // Horizontal styles UIObject.setStyleName(currentlyEmphasised.getElement(), OVER + "-" + HorizontalDropLocation.LEFT.toString().toLowerCase(), false); UIObject.setStyleName(currentlyEmphasised.getElement(), OVER + "-" + HorizontalDropLocation.CENTER.toString().toLowerCase(), false); UIObject.setStyleName(currentlyEmphasised.getElement(), OVER + "-" + HorizontalDropLocation.RIGHT.toString().toLowerCase(), false); currentlyEmphasised = null; } }
From source file:fi.jasoft.dragdroplayouts.client.ui.VDDHorizontalLayout.java
License:Apache License
/** * Empasises the drop location of the component when hovering over a * hildComponentContainer. Passing null as the container removes any * previous emphasis./* w ww. j ava 2 s .c o m*/ * * @param container * The container which we are hovering over * @param event * The drag event */ protected void emphasis(Widget container, VDragEvent event) { // Remove emphasis from previous hovers deEmphasis(); // Null check.. if (container == null) { return; } currentlyEmphasised = container; // Assign the container the drag and drop over style if (spacingEnabled) { UIObject.setStyleName(container.getElement(), OVER_SPACED, true); } else { UIObject.setStyleName(container.getElement(), OVER, true); } if (container != this) { // Add drop location specific style UIObject.setStyleName(container.getElement(), OVER + "-" + getHorizontalDropLocation(container, event).toString().toLowerCase(), true); } else { UIObject.setStyleName(container.getElement(), OVER + "-" + HorizontalDropLocation.CENTER.toString().toLowerCase(), true); } }
From source file:fi.jasoft.dragdroplayouts.client.ui.VDDVerticalLayout.java
License:Apache License
/** * Removes any applies drag and drop style applied by emphasis() *//*from w w w .j a v a 2 s. com*/ private void deEmphasis() { if (currentlyEmphasised != null) { // Universal over style UIObject.setStyleName(currentlyEmphasised.getElement(), OVER, false); UIObject.setStyleName(currentlyEmphasised.getElement(), OVER_SPACED, false); // Vertical styles UIObject.setStyleName(currentlyEmphasised.getElement(), OVER + "-" + VerticalDropLocation.TOP.toString().toLowerCase(), false); UIObject.setStyleName(currentlyEmphasised.getElement(), OVER + "-" + VerticalDropLocation.MIDDLE.toString().toLowerCase(), false); UIObject.setStyleName(currentlyEmphasised.getElement(), OVER + "-" + VerticalDropLocation.BOTTOM.toString().toLowerCase(), false); currentlyEmphasised = null; } }