X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.g2d%2Fsrc%2Forg%2Fsimantics%2Fg2d%2Fdiagram%2Fhandler%2FPickRequest.java;fp=bundles%2Forg.simantics.g2d%2Fsrc%2Forg%2Fsimantics%2Fg2d%2Fdiagram%2Fhandler%2FPickRequest.java;h=f2d80a6c45fa5bd1280e028457ccdd6b70c24c91;hb=1c8c22f795944c25fd76d99117e581b7d1b3f351;hp=265caa805b604210e12612d49b22a2126ada9c35;hpb=680b5fe108fc6929d40785c76ec7444bbb092f51;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/handler/PickRequest.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/handler/PickRequest.java index 265caa805..f2d80a6c4 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/handler/PickRequest.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/handler/PickRequest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * Copyright (c) 2007, 2020 Association for Decentralized Information Management * in Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -8,6 +8,7 @@ * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation + * Semantum Oy - gitlab #454 *******************************************************************************/ package org.simantics.g2d.diagram.handler; @@ -135,8 +136,33 @@ public class PickRequest { } public static interface PickSorter { + /** + * Sorts the specified element list. + * + * @param elements the element list to sort + */ void sort(List elements); + /** + * Extended interface-method that receives the pick request in addition to the + * picked elements to be sorted. Allows e.g. looking at the pick area in the + * sorter. + * + *

+ * The default implementation just invokes {@link #sort(List)} ignoring the pick + * request. The default implementation also keeps PickSorter API/ABI-compatible. + * + * @param request the original pick request that produced the hits listed in + * elements + * @param elements the element list to sort + * + * @author Tuukka Lehtonen + * @since 1.43.0, 1.35.3 + */ + default void sort(PickRequest request, List elements) { + sort(elements); + } + // public static final PickSorter CONNECTIONS_LAST = new PickSorter() { @Override