mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
improved bring to front/back
This commit is contained in:
+13
-4
@@ -56,7 +56,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
|
|
||||||
private static final Logger LOG = Logger.getLogger(Presenter.class);
|
private static final Logger LOG = Logger.getLogger(Presenter.class);
|
||||||
|
|
||||||
public static final VersionNumber CURRENT_VERSION = new VersionNumber(3, 7, 0);
|
public static final VersionNumber CURRENT_VERSION = new VersionNumber(3, 8, 0);
|
||||||
public static final String DEFAULTS_KEY_PREFIX = "default.";
|
public static final String DEFAULTS_KEY_PREFIX = "default.";
|
||||||
|
|
||||||
public static final List<IDIYComponent<?>> EMPTY_SELECTION = Collections.emptyList();
|
public static final List<IDIYComponent<?>> EMPTY_SELECTION = Collections.emptyList();
|
||||||
@@ -1034,12 +1034,17 @@ public class Presenter implements IPlugInPort {
|
|||||||
int index = currentProject.getComponents().indexOf(component);
|
int index = currentProject.getComponents().indexOf(component);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
LOG.warn("Component not found in the project: " + component.getName());
|
LOG.warn("Component not found in the project: " + component.getName());
|
||||||
} else if (index > 0) {
|
} else
|
||||||
IDIYComponent<?> componentBefore = currentProject.getComponents().get(index - 1);
|
while (index > 0) {
|
||||||
|
IDIYComponent<?> componentBefore = currentProject.getComponents()
|
||||||
|
.get(index - 1);
|
||||||
ComponentType componentBeforeType = ComponentProcessor.getInstance()
|
ComponentType componentBeforeType = ComponentProcessor.getInstance()
|
||||||
.extractComponentTypeFrom(
|
.extractComponentTypeFrom(
|
||||||
(Class<? extends IDIYComponent<?>>) componentBefore.getClass());
|
(Class<? extends IDIYComponent<?>>) componentBefore.getClass());
|
||||||
|
if (componentBeforeType.getZOrder() < componentType.getZOrder())
|
||||||
|
break;
|
||||||
Collections.swap(currentProject.getComponents(), index, index - 1);
|
Collections.swap(currentProject.getComponents(), index, index - 1);
|
||||||
|
index--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!oldProject.equals(currentProject)) {
|
if (!oldProject.equals(currentProject)) {
|
||||||
@@ -1061,12 +1066,16 @@ public class Presenter implements IPlugInPort {
|
|||||||
int index = currentProject.getComponents().indexOf(component);
|
int index = currentProject.getComponents().indexOf(component);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
LOG.warn("Component not found in the project: " + component.getName());
|
LOG.warn("Component not found in the project: " + component.getName());
|
||||||
} else if (index < currentProject.getComponents().size() - 1) {
|
} else
|
||||||
|
while (index < currentProject.getComponents().size() - 1) {
|
||||||
IDIYComponent<?> componentAfter = currentProject.getComponents().get(index + 1);
|
IDIYComponent<?> componentAfter = currentProject.getComponents().get(index + 1);
|
||||||
ComponentType componentAfterType = ComponentProcessor.getInstance()
|
ComponentType componentAfterType = ComponentProcessor.getInstance()
|
||||||
.extractComponentTypeFrom(
|
.extractComponentTypeFrom(
|
||||||
(Class<? extends IDIYComponent<?>>) componentAfter.getClass());
|
(Class<? extends IDIYComponent<?>>) componentAfter.getClass());
|
||||||
|
if (componentAfterType.getZOrder() > componentType.getZOrder())
|
||||||
|
break;
|
||||||
Collections.swap(currentProject.getComponents(), index, index + 1);
|
Collections.swap(currentProject.getComponents(), index, index + 1);
|
||||||
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!oldProject.equals(currentProject)) {
|
if (!oldProject.equals(currentProject)) {
|
||||||
|
|||||||
Binary file not shown.
@@ -593,5 +593,21 @@
|
|||||||
</changes>
|
</changes>
|
||||||
<url>http://code.google.com/p/diy-layout-creator/downloads/list</url>
|
<url>http://code.google.com/p/diy-layout-creator/downloads/list</url>
|
||||||
</org.diylc.appframework.update.Version>
|
</org.diylc.appframework.update.Version>
|
||||||
|
<org.diylc.appframework.update.Version>
|
||||||
|
<versionNumber>
|
||||||
|
<major>3</major>
|
||||||
|
<minor>8</minor>
|
||||||
|
<build>0</build>
|
||||||
|
</versionNumber>
|
||||||
|
<releaseDate>2012-03-27 20:00:00.000 CET</releaseDate>
|
||||||
|
<name></name>
|
||||||
|
<changes>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
<description>More usable "Bring to Forward" and "Send to Backward"</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
</changes>
|
||||||
|
<url>http://code.google.com/p/diy-layout-creator/downloads/list</url>
|
||||||
|
</org.diylc.appframework.update.Version>
|
||||||
</a>
|
</a>
|
||||||
</java.util.Arrays_-ArrayList>
|
</java.util.Arrays_-ArrayList>
|
||||||
Reference in New Issue
Block a user