From 343fec05ae1c3c92dbdec6e0667b020e474a2cbb Mon Sep 17 00:00:00 2001 From: a-schild Date: Wed, 27 Apr 2016 17:22:41 +0200 Subject: [PATCH 01/12] Corrected some of the javadocs --- .../DDAbsoluteLayoutConnector.java | 2 +- .../ui/accordion/DDAccordionConnector.java | 2 +- .../client/ui/accordion/VDDAccordion.java | 4 +- .../client/ui/formlayout/VDDFormLayout.java | 6 +- .../client/ui/gridlayout/VDDGridLayout.java | 2 +- .../horizontallayout/VDDHorizontalLayout.java | 672 +++++++++--------- .../VDDHorizontalSplitPanel.java | 4 +- .../client/ui/panel/VDDPanel.java | 4 +- .../client/ui/tabsheet/VDDTabSheet.java | 4 +- .../VDDVerticalSplitPanel.java | 4 +- .../DefaultFormLayoutDropHandler.java | 2 - .../interfaces/DragImageReferenceSupport.java | 7 +- .../interfaces/LayoutDragSource.java | 2 +- .../interfaces/ShimSupport.java | 4 +- 14 files changed, 353 insertions(+), 366 deletions(-) diff --git a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/absolutelayout/DDAbsoluteLayoutConnector.java b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/absolutelayout/DDAbsoluteLayoutConnector.java index 7395cf45..f6bcda88 100644 --- a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/absolutelayout/DDAbsoluteLayoutConnector.java +++ b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/absolutelayout/DDAbsoluteLayoutConnector.java @@ -50,7 +50,7 @@ protected void init() { /** * - * TODO Remove this when drag & drop is done properly in core + * TODO Remove this when drag & drop is done properly in core */ @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { diff --git a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/accordion/DDAccordionConnector.java b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/accordion/DDAccordionConnector.java index 0377e592..148b28ab 100644 --- a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/accordion/DDAccordionConnector.java +++ b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/accordion/DDAccordionConnector.java @@ -54,7 +54,7 @@ public LayoutDragMode getDragMode() { /** * - * TODO Remove this when drag & drop is done properly in core + * TODO Remove this when drag & drop is done properly in core */ public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { VDragDropUtil.updateDropHandlerFromUIDL(uidl, this, new VDDAccordionDropHandler(this)); diff --git a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/accordion/VDDAccordion.java b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/accordion/VDDAccordion.java index 6813ee46..952c63c7 100644 --- a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/accordion/VDDAccordion.java +++ b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/accordion/VDDAccordion.java @@ -172,8 +172,6 @@ public boolean dragStart(Widget widget, LayoutDragMode mode) { * Updates the drop details while dragging. This is needed to ensure client * side criterias can validate the drop location. * - * @param widget - * The container which we are hovering over * @param event * The drag event */ @@ -309,7 +307,7 @@ private boolean removeSpacer(Widget spacer) { } /** - * Removes any previous emphasis made by drag&drop + * Removes any previous emphasis made by drag&drop */ protected void deEmphasis() { if (currentlyEmphasised != null) { diff --git a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/formlayout/VDDFormLayout.java b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/formlayout/VDDFormLayout.java index b38b13f6..66ea0110 100644 --- a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/formlayout/VDDFormLayout.java +++ b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/formlayout/VDDFormLayout.java @@ -131,8 +131,8 @@ protected void deEmphasis() { * cell. By default the cell is devided into three parts: left,center,right * with the ratios 10%,80%,10%; * - * @param container - * The widget container + * @param rowElement + * The row * @param event * The drag event * @return The horizontal drop location @@ -211,7 +211,7 @@ protected void updateDragDetails(Widget widget, VDragEvent event) { * ĆhildComponentContainer. Passing null as the container removes any * previous emphasis. * - * @param container + * @param widget * The container which we are hovering over * @param event * The drag event diff --git a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/gridlayout/VDDGridLayout.java b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/gridlayout/VDDGridLayout.java index b8cb5827..48701b51 100644 --- a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/gridlayout/VDDGridLayout.java +++ b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/gridlayout/VDDGridLayout.java @@ -230,7 +230,7 @@ protected VerticalDropLocation getVerticalDropLocation(CellDetails cell, * Emphasizes a component container when user is hovering a dragged * component over the container. * - * @param container + * @param cell * The container * @param event */ diff --git a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/horizontallayout/VDDHorizontalLayout.java b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/horizontallayout/VDDHorizontalLayout.java index 2cf0e08c..c6c260d1 100644 --- a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/horizontallayout/VDDHorizontalLayout.java +++ b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/horizontallayout/VDDHorizontalLayout.java @@ -1,336 +1,336 @@ -/* - * Copyright 2015 John Ahlroos - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package fi.jasoft.dragdroplayouts.client.ui.horizontallayout; - -import com.google.gwt.user.client.ui.UIObject; -import com.google.gwt.user.client.ui.Widget; -import com.google.gwt.user.client.ui.WidgetCollection; -import com.vaadin.client.ComponentConnector; -import com.vaadin.client.MouseEventDetailsBuilder; -import com.vaadin.client.Util; -import com.vaadin.client.ui.VHorizontalLayout; -import com.vaadin.client.ui.dd.VDragEvent; -import com.vaadin.client.ui.orderedlayout.Slot; -import com.vaadin.shared.MouseEventDetails; -import com.vaadin.shared.ui.dd.HorizontalDropLocation; - -import fi.jasoft.dragdroplayouts.DDHorizontalLayout; -import fi.jasoft.dragdroplayouts.client.VDragFilter; -import fi.jasoft.dragdroplayouts.client.ui.Constants; -import fi.jasoft.dragdroplayouts.client.ui.LayoutDragMode; -import fi.jasoft.dragdroplayouts.client.ui.VDragDropUtil; -import fi.jasoft.dragdroplayouts.client.ui.VLayoutDragDropMouseHandler; -import fi.jasoft.dragdroplayouts.client.ui.VLayoutDragDropMouseHandler.DragStartListener; -import fi.jasoft.dragdroplayouts.client.ui.interfaces.VDDHasDropHandler; -import fi.jasoft.dragdroplayouts.client.ui.interfaces.VDragImageProvider; -import fi.jasoft.dragdroplayouts.client.ui.interfaces.VHasDragFilter; -import fi.jasoft.dragdroplayouts.client.ui.interfaces.VHasDragImageReferenceSupport; -import fi.jasoft.dragdroplayouts.client.ui.interfaces.VHasDragMode; -import fi.jasoft.dragdroplayouts.client.ui.interfaces.VHasIframeShims; -import fi.jasoft.dragdroplayouts.client.ui.util.IframeCoverUtility; - -/** - * Client side implementation for {@link DDHorizontalLayout} - * - * @author John Ahlroos / www.jasoft.fi - * @since 0.4.0 - */ -public class VDDHorizontalLayout extends VHorizontalLayout - implements VHasDragMode, - VDDHasDropHandler, DragStartListener, - VHasDragFilter, VHasDragImageReferenceSupport, VHasIframeShims { - - public static final String OVER = "v-ddorderedlayout-over"; - public static final String OVER_SPACED = OVER + "-spaced"; - - private Widget currentlyEmphasised; - - private VDDHorizontalLayoutDropHandler dropHandler; - - private VDragFilter dragFilter; - - private final IframeCoverUtility iframeCoverUtility = new IframeCoverUtility(); - - private final VLayoutDragDropMouseHandler ddMouseHandler = new VLayoutDragDropMouseHandler( - this, LayoutDragMode.NONE); - - // Value delegated from state - private double cellLeftRightDropRatio = DDHorizontalLayoutState.DEFAULT_HORIZONTAL_DROP_RATIO; - - private LayoutDragMode mode = LayoutDragMode.NONE; - - private boolean iframeCovers = false; - - public VDDHorizontalLayout() { - super(); - } - - @Override - protected void onLoad() { - super.onLoad(); - ddMouseHandler.addDragStartListener(this); - setDragMode(mode); - iframeShimsEnabled(iframeCovers); - } - - @Override - protected void onUnload() { - super.onUnload(); - ddMouseHandler.removeDragStartListener(this); - ddMouseHandler.updateDragMode(LayoutDragMode.NONE); - iframeCoverUtility.setIframeCoversEnabled(false, getElement(), - LayoutDragMode.NONE); - } - - /** - * Removes any applies drag and drop style applied by emphasis() - */ - protected 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; - } - } - - /** - * Returns the horizontal location within the cell when hoovering over the - * cell. By default the cell is devided into three parts: left,center,right - * with the ratios 10%,80%,10%; - * - * @param container - * The widget container - * @param event - * The drag event - * @return The horizontal drop location - */ - protected HorizontalDropLocation getHorizontalDropLocation(Widget container, - VDragEvent event) { - return VDragDropUtil.getHorizontalDropLocation(container.getElement(), - Util.getTouchOrMouseClientX(event.getCurrentGwtEvent()), - cellLeftRightDropRatio); - } - - /** - * A hook for extended components to post process the the drop before it is - * sent to the server. Useful if you don't want to override the whole drop - * handler. - */ - protected boolean postDropHook(VDragEvent drag) { - // Extended classes can add content here... - return true; - } - - /** - * A hook for extended components to post process the the enter event. - * Useful if you don't want to override the whole drophandler. - */ - protected void postEnterHook(VDragEvent drag) { - // Extended classes can add content here... - } - - /** - * A hook for extended components to post process the the leave event. - * Useful if you don't want to override the whole drophandler. - */ - protected void postLeaveHook(VDragEvent drag) { - // Extended classes can add content here... - } - - /** - * A hook for extended components to post process the the over event. Useful - * if you don't want to override the whole drophandler. - */ - protected void postOverHook(VDragEvent drag) { - // Extended classes can add content here... - } - - /** - * Can be used to listen to drag start events, must return true for the drag - * to commence. Return false to interrupt the drag: - */ - @Override - public boolean dragStart(Widget widget, LayoutDragMode mode) { - ComponentConnector layout = Util.findConnectorFor(this); - return VDragDropUtil.isDraggingEnabled(layout, widget); - } - - /** - * Updates the drop details while dragging. This is needed to ensure client - * side criterias can validate the drop location. - * - * @param widget - * The container which we are hovering over - * @param event - * The drag event - */ - protected void updateDragDetails(Widget widget, VDragEvent event) { - if (widget == null) { - return; - } - - /* - * The horizontal position within the cell{ - */ - event.getDropDetails().put( - Constants.DROP_DETAIL_HORIZONTAL_DROP_LOCATION, - getHorizontalDropLocation(widget, event)); - - /* - * The index over which the drag is. Can be used by a client side - * criteria to verify that a drag is over a certain index. - */ - int index = -1; - if (widget instanceof Slot) { - WidgetCollection captionsAndSlots = getChildren(); - index = VDragDropUtil.findSlotIndex(captionsAndSlots, - (Slot) widget); - } - - event.getDropDetails().put(Constants.DROP_DETAIL_TO, index); - - // Add mouse event details - MouseEventDetails details = MouseEventDetailsBuilder - .buildMouseEventDetails(event.getCurrentGwtEvent(), - getElement()); - event.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT, - details.serialize()); - } - - /** - * Empasises the drop location of the component when hovering over a - * ĆhildComponentContainer. Passing null as the container removes any - * previous emphasis. - * - * @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; - - HorizontalDropLocation location = null; - - // Add drop location specific style - if (currentlyEmphasised != this) { - location = getHorizontalDropLocation(container, event); - - } else { - location = HorizontalDropLocation.CENTER; - } - - UIObject.setStyleName(currentlyEmphasised.getElement(), OVER, true); - UIObject.setStyleName(currentlyEmphasised.getElement(), - OVER + "-" + location.toString().toLowerCase(), true); - } - - /** - * Returns the current drag mode which determines how the drag is visualized - */ - public LayoutDragMode getDragMode() { - return ddMouseHandler.getDragMode(); - } - - /** - * Creates a drop handler if one does not already exist and updates it from - * the details received from the server. - * - * @param childUidl - * The UIDL - */ - public void setDropHandler(VDDHorizontalLayoutDropHandler dropHandler) { - this.dropHandler = dropHandler; - } - - /** - * Get the drop handler attached to the Layout - */ - public VDDHorizontalLayoutDropHandler getDropHandler() { - return dropHandler; - } - - public VDragFilter getDragFilter() { - return dragFilter; - } - - IframeCoverUtility getIframeCoverUtility() { - return iframeCoverUtility; - } - - public double getCellLeftRightDropRatio() { - return cellLeftRightDropRatio; - } - - public void setCellLeftRightDropRatio(float cellLeftRightDropRatio) { - this.cellLeftRightDropRatio = cellLeftRightDropRatio; - } - - @Override - public void setDragFilter(VDragFilter filter) { - this.dragFilter = filter; - } - - @Override - public void iframeShimsEnabled(boolean enabled) { - iframeCovers = enabled; - iframeCoverUtility.setIframeCoversEnabled(enabled, getElement(), mode); - } - - @Override - public boolean isIframeShimsEnabled() { - return iframeCovers; - } - - @Override - public void setDragMode(LayoutDragMode mode) { - this.mode = mode; - ddMouseHandler.updateDragMode(mode); - iframeShimsEnabled(iframeCovers); - } - - @Override - public void setDragImageProvider(VDragImageProvider provider) { - ddMouseHandler.setDragImageProvider(provider); - } - - protected final VLayoutDragDropMouseHandler getMouseHandler() { - return ddMouseHandler; - } -} +/* + * Copyright 2015 John Ahlroos + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package fi.jasoft.dragdroplayouts.client.ui.horizontallayout; + +import com.google.gwt.user.client.ui.UIObject; +import com.google.gwt.user.client.ui.Widget; +import com.google.gwt.user.client.ui.WidgetCollection; +import com.vaadin.client.ComponentConnector; +import com.vaadin.client.MouseEventDetailsBuilder; +import com.vaadin.client.Util; +import com.vaadin.client.ui.VHorizontalLayout; +import com.vaadin.client.ui.dd.VDragEvent; +import com.vaadin.client.ui.orderedlayout.Slot; +import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.ui.dd.HorizontalDropLocation; + +import fi.jasoft.dragdroplayouts.DDHorizontalLayout; +import fi.jasoft.dragdroplayouts.client.VDragFilter; +import fi.jasoft.dragdroplayouts.client.ui.Constants; +import fi.jasoft.dragdroplayouts.client.ui.LayoutDragMode; +import fi.jasoft.dragdroplayouts.client.ui.VDragDropUtil; +import fi.jasoft.dragdroplayouts.client.ui.VLayoutDragDropMouseHandler; +import fi.jasoft.dragdroplayouts.client.ui.VLayoutDragDropMouseHandler.DragStartListener; +import fi.jasoft.dragdroplayouts.client.ui.interfaces.VDDHasDropHandler; +import fi.jasoft.dragdroplayouts.client.ui.interfaces.VDragImageProvider; +import fi.jasoft.dragdroplayouts.client.ui.interfaces.VHasDragFilter; +import fi.jasoft.dragdroplayouts.client.ui.interfaces.VHasDragImageReferenceSupport; +import fi.jasoft.dragdroplayouts.client.ui.interfaces.VHasDragMode; +import fi.jasoft.dragdroplayouts.client.ui.interfaces.VHasIframeShims; +import fi.jasoft.dragdroplayouts.client.ui.util.IframeCoverUtility; + +/** + * Client side implementation for {@link DDHorizontalLayout} + * + * @author John Ahlroos / www.jasoft.fi + * @since 0.4.0 + */ +public class VDDHorizontalLayout extends VHorizontalLayout + implements VHasDragMode, + VDDHasDropHandler, DragStartListener, + VHasDragFilter, VHasDragImageReferenceSupport, VHasIframeShims { + + public static final String OVER = "v-ddorderedlayout-over"; + public static final String OVER_SPACED = OVER + "-spaced"; + + private Widget currentlyEmphasised; + + private VDDHorizontalLayoutDropHandler dropHandler; + + private VDragFilter dragFilter; + + private final IframeCoverUtility iframeCoverUtility = new IframeCoverUtility(); + + private final VLayoutDragDropMouseHandler ddMouseHandler = new VLayoutDragDropMouseHandler( + this, LayoutDragMode.NONE); + + // Value delegated from state + private double cellLeftRightDropRatio = DDHorizontalLayoutState.DEFAULT_HORIZONTAL_DROP_RATIO; + + private LayoutDragMode mode = LayoutDragMode.NONE; + + private boolean iframeCovers = false; + + public VDDHorizontalLayout() { + super(); + } + + @Override + protected void onLoad() { + super.onLoad(); + ddMouseHandler.addDragStartListener(this); + setDragMode(mode); + iframeShimsEnabled(iframeCovers); + } + + @Override + protected void onUnload() { + super.onUnload(); + ddMouseHandler.removeDragStartListener(this); + ddMouseHandler.updateDragMode(LayoutDragMode.NONE); + iframeCoverUtility.setIframeCoversEnabled(false, getElement(), + LayoutDragMode.NONE); + } + + /** + * Removes any applies drag and drop style applied by emphasis() + */ + protected 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; + } + } + + /** + * Returns the horizontal location within the cell when hoovering over the + * cell. By default the cell is devided into three parts: left,center,right + * with the ratios 10%,80%,10%; + * + * @param container + * The widget container + * @param event + * The drag event + * @return The horizontal drop location + */ + protected HorizontalDropLocation getHorizontalDropLocation(Widget container, + VDragEvent event) { + return VDragDropUtil.getHorizontalDropLocation(container.getElement(), + Util.getTouchOrMouseClientX(event.getCurrentGwtEvent()), + cellLeftRightDropRatio); + } + + /** + * A hook for extended components to post process the the drop before it is + * sent to the server. Useful if you don't want to override the whole drop + * handler. + */ + protected boolean postDropHook(VDragEvent drag) { + // Extended classes can add content here... + return true; + } + + /** + * A hook for extended components to post process the the enter event. + * Useful if you don't want to override the whole drophandler. + */ + protected void postEnterHook(VDragEvent drag) { + // Extended classes can add content here... + } + + /** + * A hook for extended components to post process the the leave event. + * Useful if you don't want to override the whole drophandler. + */ + protected void postLeaveHook(VDragEvent drag) { + // Extended classes can add content here... + } + + /** + * A hook for extended components to post process the the over event. Useful + * if you don't want to override the whole drophandler. + */ + protected void postOverHook(VDragEvent drag) { + // Extended classes can add content here... + } + + /** + * Can be used to listen to drag start events, must return true for the drag + * to commence. Return false to interrupt the drag: + */ + @Override + public boolean dragStart(Widget widget, LayoutDragMode mode) { + ComponentConnector layout = Util.findConnectorFor(this); + return VDragDropUtil.isDraggingEnabled(layout, widget); + } + + /** + * Updates the drop details while dragging. This is needed to ensure client + * side criterias can validate the drop location. + * + * @param widget + * The container which we are hovering over + * @param event + * The drag event + */ + protected void updateDragDetails(Widget widget, VDragEvent event) { + if (widget == null) { + return; + } + + /* + * The horizontal position within the cell{ + */ + event.getDropDetails().put( + Constants.DROP_DETAIL_HORIZONTAL_DROP_LOCATION, + getHorizontalDropLocation(widget, event)); + + /* + * The index over which the drag is. Can be used by a client side + * criteria to verify that a drag is over a certain index. + */ + int index = -1; + if (widget instanceof Slot) { + WidgetCollection captionsAndSlots = getChildren(); + index = VDragDropUtil.findSlotIndex(captionsAndSlots, + (Slot) widget); + } + + event.getDropDetails().put(Constants.DROP_DETAIL_TO, index); + + // Add mouse event details + MouseEventDetails details = MouseEventDetailsBuilder + .buildMouseEventDetails(event.getCurrentGwtEvent(), + getElement()); + event.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT, + details.serialize()); + } + + /** + * Empasises the drop location of the component when hovering over a + * ĆhildComponentContainer. Passing null as the container removes any + * previous emphasis. + * + * @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; + + HorizontalDropLocation location = null; + + // Add drop location specific style + if (currentlyEmphasised != this) { + location = getHorizontalDropLocation(container, event); + + } else { + location = HorizontalDropLocation.CENTER; + } + + UIObject.setStyleName(currentlyEmphasised.getElement(), OVER, true); + UIObject.setStyleName(currentlyEmphasised.getElement(), + OVER + "-" + location.toString().toLowerCase(), true); + } + + /** + * Returns the current drag mode which determines how the drag is visualized + */ + public LayoutDragMode getDragMode() { + return ddMouseHandler.getDragMode(); + } + + /** + * Creates a drop handler if one does not already exist and updates it from + * the details received from the server. + * + * @param dropHandler + * The drop handler + */ + public void setDropHandler(VDDHorizontalLayoutDropHandler dropHandler) { + this.dropHandler = dropHandler; + } + + /** + * Get the drop handler attached to the Layout + */ + public VDDHorizontalLayoutDropHandler getDropHandler() { + return dropHandler; + } + + public VDragFilter getDragFilter() { + return dragFilter; + } + + IframeCoverUtility getIframeCoverUtility() { + return iframeCoverUtility; + } + + public double getCellLeftRightDropRatio() { + return cellLeftRightDropRatio; + } + + public void setCellLeftRightDropRatio(float cellLeftRightDropRatio) { + this.cellLeftRightDropRatio = cellLeftRightDropRatio; + } + + @Override + public void setDragFilter(VDragFilter filter) { + this.dragFilter = filter; + } + + @Override + public void iframeShimsEnabled(boolean enabled) { + iframeCovers = enabled; + iframeCoverUtility.setIframeCoversEnabled(enabled, getElement(), mode); + } + + @Override + public boolean isIframeShimsEnabled() { + return iframeCovers; + } + + @Override + public void setDragMode(LayoutDragMode mode) { + this.mode = mode; + ddMouseHandler.updateDragMode(mode); + iframeShimsEnabled(iframeCovers); + } + + @Override + public void setDragImageProvider(VDragImageProvider provider) { + ddMouseHandler.setDragImageProvider(provider); + } + + protected final VLayoutDragDropMouseHandler getMouseHandler() { + return ddMouseHandler; + } +} diff --git a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/horizontalsplitpanel/VDDHorizontalSplitPanel.java b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/horizontalsplitpanel/VDDHorizontalSplitPanel.java index 18b4439b..d92b5f8b 100644 --- a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/horizontalsplitpanel/VDDHorizontalSplitPanel.java +++ b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/horizontalsplitpanel/VDDHorizontalSplitPanel.java @@ -192,7 +192,7 @@ protected void emphasis(Element element) { } /** - * Removes any previous emphasis made by drag&drag + * Removes any previous emphasis made by drag&drag */ protected void deEmphasis() { if (currentEmphasis != null) { @@ -234,8 +234,6 @@ protected Element getSplitter() { * Updates the drop details while dragging. This is needed to ensure client * side criterias can validate the drop location. * - * @param widget - * The container which we are hovering over * @param event * The drag event */ diff --git a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/panel/VDDPanel.java b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/panel/VDDPanel.java index c6fef380..32ff488f 100644 --- a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/panel/VDDPanel.java +++ b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/panel/VDDPanel.java @@ -148,7 +148,7 @@ protected void emphasis(Element element) { } /** - * Removes any previous emphasis made by drag&drag + * Removes any previous emphasis made by drag&drag */ protected void deEmphasis() { if (currentEmphasis != null) { @@ -161,8 +161,6 @@ protected void deEmphasis() { * Updates the drop details while dragging. This is needed to ensure client * side criterias can validate the drop location. * - * @param widget - * The container which we are hovering over * @param event * The drag event */ diff --git a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/tabsheet/VDDTabSheet.java b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/tabsheet/VDDTabSheet.java index 68baa58d..d51f208c 100644 --- a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/tabsheet/VDDTabSheet.java +++ b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/tabsheet/VDDTabSheet.java @@ -181,8 +181,6 @@ public boolean dragStart(Widget widget, LayoutDragMode mode) { * Updates the drop details while dragging. This is needed to ensure client * side criterias can validate the drop location. * - * @param widget - * The container which we are hovering over * @param event * The drag event */ @@ -291,7 +289,7 @@ protected void emphasis(Element element, VDragEvent event) { } /** - * Removes any previous emphasis made by drag&drop + * Removes any previous emphasis made by drag&drop */ protected void deEmphasis() { if (currentlyEmphasised != null diff --git a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/verticalsplitpanel/VDDVerticalSplitPanel.java b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/verticalsplitpanel/VDDVerticalSplitPanel.java index ddc63be4..098b2771 100644 --- a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/verticalsplitpanel/VDDVerticalSplitPanel.java +++ b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/verticalsplitpanel/VDDVerticalSplitPanel.java @@ -198,7 +198,7 @@ protected void emphasis(Element element) { } /** - * Removes any previous emphasis made by drag&drag + * Removes any previous emphasis made by drag&drag */ protected void deEmphasis() { if (currentEmphasis != null) { @@ -240,8 +240,6 @@ protected Element getSplitter() { * Updates the drop details while dragging. This is needed to ensure client * side criterias can validate the drop location. * - * @param widget - * The container which we are hovering over * @param event * The drag event */ diff --git a/addon/src/main/java/fi/jasoft/dragdroplayouts/drophandlers/DefaultFormLayoutDropHandler.java b/addon/src/main/java/fi/jasoft/dragdroplayouts/drophandlers/DefaultFormLayoutDropHandler.java index bf3a5b5e..b6ff012a 100644 --- a/addon/src/main/java/fi/jasoft/dragdroplayouts/drophandlers/DefaultFormLayoutDropHandler.java +++ b/addon/src/main/java/fi/jasoft/dragdroplayouts/drophandlers/DefaultFormLayoutDropHandler.java @@ -45,8 +45,6 @@ public class DefaultFormLayoutDropHandler /** * Constructor * - * @param dropCellAlignment - * The cell alignment of the component after it has been dropped */ public DefaultFormLayoutDropHandler() { diff --git a/addon/src/main/java/fi/jasoft/dragdroplayouts/interfaces/DragImageReferenceSupport.java b/addon/src/main/java/fi/jasoft/dragdroplayouts/interfaces/DragImageReferenceSupport.java index 3603af36..c376e985 100644 --- a/addon/src/main/java/fi/jasoft/dragdroplayouts/interfaces/DragImageReferenceSupport.java +++ b/addon/src/main/java/fi/jasoft/dragdroplayouts/interfaces/DragImageReferenceSupport.java @@ -7,17 +7,16 @@ public interface DragImageReferenceSupport { * image will be shown instead of the component when the user drag a * component in the layout. * - * @param component - * The component in the layout + * @param provider + * The image provider * - * @param reference - * The reference component to show */ void setDragImageProvider(DragImageProvider provider); /** * Returns the drag image provider * + * @return the image provider */ DragImageProvider getDragImageProvider(); } diff --git a/addon/src/main/java/fi/jasoft/dragdroplayouts/interfaces/LayoutDragSource.java b/addon/src/main/java/fi/jasoft/dragdroplayouts/interfaces/LayoutDragSource.java index 8eca6334..93088f8e 100644 --- a/addon/src/main/java/fi/jasoft/dragdroplayouts/interfaces/LayoutDragSource.java +++ b/addon/src/main/java/fi/jasoft/dragdroplayouts/interfaces/LayoutDragSource.java @@ -57,7 +57,7 @@ public interface LayoutDragSource extends DragSource { * By default the drag filter permits dragging all components when the * layout drag mode allows it. * - * @param dragFilter + * @return dragFilter * The filter to use, by default {@link DragFilter#ALL} is used. */ DragFilter getDragFilter(); diff --git a/addon/src/main/java/fi/jasoft/dragdroplayouts/interfaces/ShimSupport.java b/addon/src/main/java/fi/jasoft/dragdroplayouts/interfaces/ShimSupport.java index 439cfd2b..e5d4c3e3 100644 --- a/addon/src/main/java/fi/jasoft/dragdroplayouts/interfaces/ShimSupport.java +++ b/addon/src/main/java/fi/jasoft/dragdroplayouts/interfaces/ShimSupport.java @@ -30,14 +30,14 @@ public interface ShimSupport { * False to disable the iframe shim used to enable dragging iframe based * components (defaults to true). * - * @return Are the iframes shimmed + * @param shim Are the iframes shimmed */ void setShim(boolean shim); /** * Are shims used over iframes so dragging is possible * - * @return + * @return Are the iframes shimmed */ boolean isShimmed(); From e0eeccebb9460619d53450c8cf05e9323e8e7c3f Mon Sep 17 00:00:00 2001 From: a-schild Date: Mon, 2 May 2016 17:40:59 +0200 Subject: [PATCH 02/12] Resolved Issue #58 https://github.com/johndevs/dragdroplayouts/issues/58 Added demo case --- .../client/ui/csslayout/VDDCssLayout.java | 21 ++++++++++++++- .../demo/views/DragdropCssLayoutDemo.java | 27 +++++++------------ 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/csslayout/VDDCssLayout.java b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/csslayout/VDDCssLayout.java index a3c89177..402ed784 100644 --- a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/csslayout/VDDCssLayout.java +++ b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/csslayout/VDDCssLayout.java @@ -219,12 +219,31 @@ protected void updateDragDetails(VDragEvent event) { return; } + Element e= getElement(); Widget widget = (Widget) Util.findWidget(over, null); if (widget == null) { // Null check return; } - + else + { + // Solve https://github.com/johndevs/dragdroplayouts/issues/58 + Widget parentWidget= widget.getParent(); + Element pE= parentWidget != null ? parentWidget.getElement() : null; + // Check for direct child (not child of child) + while (widget != null && pE != null && !e.equals(pE)) + { + widget= widget.getParent(); + parentWidget= widget.getParent(); + pE= parentWidget != null ? parentWidget.getElement() : null; + } + if (widget != null) + { + event.setElementOver(widget.getElement()); + over= widget.getElement(); + } + } + int offset = 0; int index = -1; for (int i = 0; i < getElement().getChildCount(); i++) { diff --git a/demo/src/main/java/fi/jasoft/dragdroplayouts/demo/views/DragdropCssLayoutDemo.java b/demo/src/main/java/fi/jasoft/dragdroplayouts/demo/views/DragdropCssLayoutDemo.java index 12d89870..75421949 100644 --- a/demo/src/main/java/fi/jasoft/dragdroplayouts/demo/views/DragdropCssLayoutDemo.java +++ b/demo/src/main/java/fi/jasoft/dragdroplayouts/demo/views/DragdropCssLayoutDemo.java @@ -58,24 +58,15 @@ public boolean isDraggable(Component component) { new Label( "This is an CSS layout, the positions are defined by css rules. Try dragging the components around."); cssLayout.addComponent(lbl); - Button btn = new Button("Button 1", new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - Notification.show("Click!"); - } - }); - cssLayout.addComponent(btn); - btn = new Button("Button 2", new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - Notification.show("Click!"); - } - }); - cssLayout.addComponent(btn); - btn = new Button("Button 3", new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - Notification.show("Click!"); - } - }); - cssLayout.addComponent(btn); + for (int i=0; i < 20; i++) + { + Button btn = new Button("Button "+i, new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + Notification.show("Click!"); + } + }); + cssLayout.addComponent(btn); + } // end-source return cssLayout; } From f6380810b75bf4f1877223027b09798fade6bb25 Mon Sep 17 00:00:00 2001 From: Yuriy Artamonov Date: Thu, 12 May 2016 14:52:26 +0400 Subject: [PATCH 03/12] Fix tab selection on touch devices --- .../ui/VLayoutDragDropMouseHandler.java | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/VLayoutDragDropMouseHandler.java b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/VLayoutDragDropMouseHandler.java index f0e3f91f..e04f4b3e 100644 --- a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/VLayoutDragDropMouseHandler.java +++ b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/VLayoutDragDropMouseHandler.java @@ -193,11 +193,10 @@ protected void initiateDragOnMove(final NativeEvent originalEvent) { // Stop event propagation and prevent default behaviour if // - target is *not* a VTabsheet.TabCaption or // - drag mode is caption mode and widget is caption - boolean isTabCaption = targetParent instanceof VTabsheet.TabCaption; + boolean isTabCaption = isTabCaptionText(target); boolean isCaption = VDragDropUtil.isCaptionOrCaptionless(targetParent); - if (dragMode == LayoutDragMode.CLONE && isTabCaption == false) { - + if (dragMode == LayoutDragMode.CLONE && !isTabCaption) { stopEventPropagation = true; // overwrite stopEventPropagation flag again if @@ -251,9 +250,26 @@ public void onPreviewNativeEvent(NativePreviewEvent event) { }); } + // Allow dragging only for caption text of Tab to avoid bugs on touch-devices + protected boolean isTabCaptionText(Widget target) { + Widget parent = target; + + while (parent != null) { + if (parent instanceof Tab) { + return true; + } + + parent = parent.getParent(); + } + + return false; + } + private boolean isElementNotDraggable(Element targetElement) { // do not try to drag tabsheet close button it breaks close on touch devices - return targetElement.getClassName().contains("v-tabsheet-caption-close"); + return targetElement.getClassName().contains("v-tabsheet-caption-close") + || (targetElement.getClassName().contains("v-caption") && + targetElement.getParentElement().getClassName().contains("v-tabsheet-tabitem")); } /** From 2a0cf45c3fd38c1edadc4cdf10af4f7eaa2d78ca Mon Sep 17 00:00:00 2001 From: Yuriy Artamonov Date: Sun, 26 Jun 2016 20:13:29 +0400 Subject: [PATCH 04/12] Fix addon install with proper group and without war --- build.gradle | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 9138bc7e..4d964198 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ allprojects { - group='fi.jasoft' + group='org.vaadin.addons' version = project.hasProperty('BUILD_VERSION') ? getProperty('BUILD_VERSION') : 'development'; apply plugin: 'eclipse-wtp' } @@ -95,6 +95,10 @@ project(':addon'){ } } } + + configurations.archives.artifacts.removeAll { + it.file =~ 'war' + } } From 76327405d97be104d0f642372e71b5c31fe93c21 Mon Sep 17 00:00:00 2001 From: Yuriy Artamonov Date: Sun, 26 Jun 2016 20:30:37 +0400 Subject: [PATCH 05/12] Haulmont API HTML5Support for global drag over handler --- .../client/ui/util/HTML5Support.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/util/HTML5Support.java b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/util/HTML5Support.java index 3f0addb7..ee5181a1 100644 --- a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/util/HTML5Support.java +++ b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/util/HTML5Support.java @@ -46,6 +46,8 @@ */ public class HTML5Support { + protected static DragOverHandler globalDragOverHandler = null; + private final List handlers = new ArrayList(); public static class HTML5DragHandler @@ -116,6 +118,13 @@ public void onDragOver(DragOverEvent event) { if (validate(nativeEvent) && vaadinDragEvent != null) { nativeEvent.preventDefault(); nativeEvent.stopPropagation(); + + // event stopped, just notify global handler + // Haulmont API + if (globalDragOverHandler != null) { + globalDragOverHandler.onDragOver(event); + } + vaadinDragEvent.setCurrentGwtEvent(nativeEvent); VDragAndDropManager.get().setCurrentDropHandler(dropHandler); dropHandler.dragOver(vaadinDragEvent); @@ -217,4 +226,12 @@ public void disable() { } handlers.clear(); } + + public static DragOverHandler getGlobalDragOverHandler() { + return globalDragOverHandler; + } + + public static void setGlobalDragOverHandler(DragOverHandler globalDragOverHandler) { + HTML5Support.globalDragOverHandler = globalDragOverHandler; + } } From 9346021cee163b3ae20a53cb1c1e03062addf8eb Mon Sep 17 00:00:00 2001 From: Yuriy Artamonov Date: Wed, 13 Jul 2016 16:53:23 +0400 Subject: [PATCH 06/12] Global DropHandler and DragEnterHandler --- .../client/ui/util/HTML5Support.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/util/HTML5Support.java b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/util/HTML5Support.java index ee5181a1..22c44c04 100644 --- a/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/util/HTML5Support.java +++ b/addon/src/main/java/fi/jasoft/dragdroplayouts/client/ui/util/HTML5Support.java @@ -47,6 +47,8 @@ public class HTML5Support { protected static DragOverHandler globalDragOverHandler = null; + protected static DropHandler globalDropHandler = null; + protected static DragEnterHandler globalDragEnterHandler = null; private final List handlers = new ArrayList(); @@ -91,6 +93,12 @@ public void onDrop(DropEvent event) { nativeEvent.preventDefault(); nativeEvent.stopPropagation(); + // event stopped, just notify global handler + // Haulmont API + if (globalDropHandler != null) { + globalDropHandler.onDrop(event); + } + vaadinDragEvent.setCurrentGwtEvent(nativeEvent); VDragAndDropManager.get().setCurrentDropHandler(dropHandler); @@ -163,6 +171,10 @@ public void onDragEnter(DragEnterEvent event) { nativeEvent.preventDefault(); nativeEvent.stopPropagation(); } + + if (globalDragEnterHandler != null) { + globalDragEnterHandler.onDragEnter(event); + } } private boolean validate(NativeEvent event) { @@ -227,11 +239,33 @@ public void disable() { handlers.clear(); } + // Haulmont API public static DragOverHandler getGlobalDragOverHandler() { return globalDragOverHandler; } + // Haulmont API public static void setGlobalDragOverHandler(DragOverHandler globalDragOverHandler) { HTML5Support.globalDragOverHandler = globalDragOverHandler; } + + // Haulmont API + public static DropHandler getGlobalDropHandler() { + return globalDropHandler; + } + + // Haulmont API + public static void setGlobalDropHandler(DropHandler globalDropHandler) { + HTML5Support.globalDropHandler = globalDropHandler; + } + + // Haulmont API + public static DragEnterHandler getGlobalDragEnterHandler() { + return globalDragEnterHandler; + } + + // Haulmont API + public static void setGlobalDragEnterHandler(DragEnterHandler globalDragEnterHandler) { + HTML5Support.globalDragEnterHandler = globalDragEnterHandler; + } } From 002742a338f491b7713878676688b9bf4fbb2a7b Mon Sep 17 00:00:00 2001 From: John Ahlroos Date: Sat, 27 Aug 2016 21:01:26 +0300 Subject: [PATCH 07/12] Compile for Java 7 --- .gitignore | 2 ++ build.gradle | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index b8b7f885..45a97ee4 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ demo/src/main/webapp/VAADIN/widgetsets/ addon/GWT development mode for addon.launch /build/ /bin/ +/demo/ +/addon/ diff --git a/build.gradle b/build.gradle index 19602c9f..905e581d 100644 --- a/build.gradle +++ b/build.gradle @@ -7,6 +7,8 @@ allprojects { subprojects { apply from: 'http://plugins.jasoft.fi/vaadin.plugin' vaadin.version = '7.7.+' + sourceCompatibility = 1.7 + targetCompatibility = 1.7 } task wrapper(type: Wrapper) { From a675b23e3793b8d28934b90c74d97d7d3bf19fd1 Mon Sep 17 00:00:00 2001 From: John Ahlroos Date: Sat, 27 Aug 2016 21:04:13 +0300 Subject: [PATCH 08/12] Updated gitignore --- .gitignore | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 45a97ee4..ca03bfcf 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ **/.settings **/META-INF **/build +**/bin # Specific ignores addon/src/main/webapp/VAADIN/ @@ -14,7 +15,3 @@ demo/src/main/webapp/VAADIN/gwt-unitCache/ demo/src/main/webapp/VAADIN/themes/demo/styles.css demo/src/main/webapp/VAADIN/widgetsets/ addon/GWT development mode for addon.launch -/build/ -/bin/ -/demo/ -/addon/ From 8783e3e2f0824197bb49e5eed33441185c1eb400 Mon Sep 17 00:00:00 2001 From: John Ahlroos Date: Sun, 28 Aug 2016 20:22:04 +0300 Subject: [PATCH 09/12] Updated Readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 70afa5f7..cf0cf91b 100644 --- a/README.md +++ b/README.md @@ -32,3 +32,4 @@ Please see the version table below to decide which version to use in your projec | 7.0.x+ | 1.0.x | | 7.2.x+ | 1.1.x | | 7.6.x+ | 1.2.x | +| 7.7.x+ | 1.3.x | From 97ad2e63c02cc398c543ca9a7095e57dc375c636 Mon Sep 17 00:00:00 2001 From: John Ahlroos Date: Thu, 1 Sep 2016 16:03:56 +0300 Subject: [PATCH 10/12] Fix missing widgetset metadata #69 --- build.gradle | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 905e581d..6335913e 100644 --- a/build.gradle +++ b/build.gradle @@ -33,11 +33,12 @@ project(':addon'){ } vaadin { - addon { - author 'John Ahlroos' - license 'Apache 2.0' - title 'DragDropLayouts' - } + widgetset 'fi.jasoft.dragdroplayouts.DragDropLayoutsWidgetSet' + addon { + author 'John Ahlroos' + license 'Apache 2.0' + title 'DragDropLayouts' + } } task createAddonPom { From 3d23dc0ece5b7315fbebdf54d50c004734937372 Mon Sep 17 00:00:00 2001 From: Daniil Tsarev Date: Thu, 3 Nov 2016 17:24:11 +0400 Subject: [PATCH 11/12] Fix addon applying, use concrete vaadin version --- build.gradle | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index ab443f1e..aac29ee4 100644 --- a/build.gradle +++ b/build.gradle @@ -1,14 +1,23 @@ +plugins { + id 'fi.jasoft.plugin.vaadin' version '1.0' apply false +} + allprojects { - group='org.vaadin.addons' + group = 'org.vaadin.addons' version = project.hasProperty('BUILD_VERSION') ? getProperty('BUILD_VERSION') : 'development'; apply plugin: 'eclipse-wtp' } subprojects { - apply from: 'http://plugins.jasoft.fi/vaadin.plugin' - vaadin.version = '7.7.+' + apply plugin: 'fi.jasoft.plugin.vaadin' + vaadin { + version = '7.7.3' + } sourceCompatibility = 1.7 targetCompatibility = 1.7 + + javadoc.enabled = false + vaadinJavadocJar.enabled = false } task wrapper(type: Wrapper) { @@ -19,7 +28,7 @@ task wrapper(type: Wrapper) { * Vaadin addon project */ project(':addon'){ - + apply plugin: 'java' apply plugin: 'maven' apply plugin: 'osgi' @@ -27,13 +36,12 @@ project(':addon'){ deploy } - dependencies{ + dependencies { testCompile 'junit:junit:4.8.+' deploy 'org.apache.maven.wagon:wagon-ssh:2.2' } vaadin { - widgetset 'fi.jasoft.dragdroplayouts.DragDropLayoutsWidgetSet' addon { author 'John Ahlroos' license 'Apache 2.0' @@ -110,11 +118,11 @@ project(':addon'){ } } - /* * Demo application for demonstrating the addon */ project(':demo'){ + apply plugin: 'java' dependencies { compile project(':addon') @@ -148,4 +156,4 @@ project(':demo'){ dependsOn 'vaadinCompile' systemProperties = System.properties } -} +} \ No newline at end of file From c3d3040108b7004be9d58486d30dd7c48f1c60ec Mon Sep 17 00:00:00 2001 From: Daniil Tsarev Date: Mon, 7 Nov 2016 11:43:12 +0400 Subject: [PATCH 12/12] Exclude javadoc jar from uploading --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index aac29ee4..07be7133 100644 --- a/build.gradle +++ b/build.gradle @@ -114,7 +114,7 @@ project(':addon'){ } configurations.archives.artifacts.removeAll { - it.file =~ 'war' + it.file =~ 'war' || it.file =~ 'javadoc' } }