[
https://issues.apache.org/jira/browse/NIFI-1799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15285895#comment-15285895
]
ASF GitHub Bot commented on NIFI-1799:
--------------------------------------
Github user alopresto commented on a diff in the pull request:
https://github.com/apache/nifi/pull/442#discussion_r63456899
--- Diff:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/PositionScaler.java
---
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.nifi.controller;
+
+import org.apache.nifi.connectable.Connection;
+import org.apache.nifi.connectable.Position;
+import org.apache.nifi.connectable.Positionable;
+import org.apache.nifi.groups.ProcessGroup;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * Provides utility to scale the positions of {@link Positionable}s and
bend points of {@link Connection}s
+ * by a given factor.
+ */
+class PositionScaler {
+
+ /**
+ * Scales the positions of all {@link Position}s in the given {@link
ProcessGroup} by
+ * the provided factor. This method replaces all {@link Position}s in
each {@link Positionable}
+ * in the {@link ProcessGroup} with a new scaled {@link Position}.
+ *
+ * @param processGroup containing the {@link Positionable}s to be
scaled
+ * @param factorX used to scale a {@link Positionable}'s
X-coordinate position
+ * @param factorY used to scale a {@link Positionable}'s
Y-coordinate position
+ */
+ public static void scale(ProcessGroup processGroup, double factorX,
double factorY) {
+ processGroup.findAllPositionables().stream().forEach(p -> scale(p,
factorX, factorY));
--- End diff --
I understand [NIFI-1799](https://issues.apache.org/jira/browse/NIFI-1799)
targets the `1.0.0` release, but this seems like useful logic to backport to
`0.7.0` as well. Unfortunately, `0.x` do not support Java 8 features like
lambda. I am hesitant to ask you to change this, because I appreciate the
cleanliness of doing it this way. Thoughts?
> Auto adjust flow layout
> -----------------------
>
> Key: NIFI-1799
> URL: https://issues.apache.org/jira/browse/NIFI-1799
> Project: Apache NiFi
> Issue Type: Sub-task
> Components: Core Framework, Core UI
> Reporter: Matt Gilman
> Assignee: Jeff Storck
> Fix For: 1.0.0
>
>
> Updates to the canvas to reflect the modernized look and feel and component
> level authorization will increase the size of each component. We should auto
> adjust the layouts to the components will not overlap. Below are the current
> size of each component and the new size:
> {code}
> Processor 310x100 350x130
> Process Group 365x142 380x172
> Remote Process Group 365x140 380x176
> Connection (largest) 188x53 200x55
> Port (root) 160x56 240x75
> Port 160x40 240x50
> Funnel 61x61 48x48
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)