|
|
@ -85,6 +85,7 @@ public class CustomSortPane extends JPanel { |
|
|
|
top.addActionListener(e -> { |
|
|
|
top.addActionListener(e -> { |
|
|
|
SwingUtilities.invokeLater(() -> { |
|
|
|
SwingUtilities.invokeLater(() -> { |
|
|
|
sortItemPane.setComponentZOrder(selectedLabel, 0); |
|
|
|
sortItemPane.setComponentZOrder(selectedLabel, 0); |
|
|
|
|
|
|
|
setToolbarEnable(false, false, true, true); |
|
|
|
CustomSortPane.this.revalidate(); |
|
|
|
CustomSortPane.this.revalidate(); |
|
|
|
CustomSortPane.this.repaint(); |
|
|
|
CustomSortPane.this.repaint(); |
|
|
|
refreshCurrentOrder(); |
|
|
|
refreshCurrentOrder(); |
|
|
@ -94,6 +95,7 @@ public class CustomSortPane extends JPanel { |
|
|
|
bottom.addActionListener(e -> { |
|
|
|
bottom.addActionListener(e -> { |
|
|
|
SwingUtilities.invokeLater(() -> { |
|
|
|
SwingUtilities.invokeLater(() -> { |
|
|
|
sortItemPane.setComponentZOrder(selectedLabel, sortItemPane.getComponentCount() - 1); |
|
|
|
sortItemPane.setComponentZOrder(selectedLabel, sortItemPane.getComponentCount() - 1); |
|
|
|
|
|
|
|
setToolbarEnable(true, true, false, false); |
|
|
|
CustomSortPane.this.revalidate(); |
|
|
|
CustomSortPane.this.revalidate(); |
|
|
|
CustomSortPane.this.repaint(); |
|
|
|
CustomSortPane.this.repaint(); |
|
|
|
refreshCurrentOrder(); |
|
|
|
refreshCurrentOrder(); |
|
|
@ -103,6 +105,7 @@ public class CustomSortPane extends JPanel { |
|
|
|
up.addActionListener(e -> { |
|
|
|
up.addActionListener(e -> { |
|
|
|
SwingUtilities.invokeLater(() -> { |
|
|
|
SwingUtilities.invokeLater(() -> { |
|
|
|
sortItemPane.setComponentZOrder(selectedLabel, sortItemPane.getComponentZOrder(selectedLabel) - 1); |
|
|
|
sortItemPane.setComponentZOrder(selectedLabel, sortItemPane.getComponentZOrder(selectedLabel) - 1); |
|
|
|
|
|
|
|
setToolbarEnable(true, true, true, true); |
|
|
|
CustomSortPane.this.revalidate(); |
|
|
|
CustomSortPane.this.revalidate(); |
|
|
|
CustomSortPane.this.repaint(); |
|
|
|
CustomSortPane.this.repaint(); |
|
|
|
refreshCurrentOrder(); |
|
|
|
refreshCurrentOrder(); |
|
|
@ -112,6 +115,7 @@ public class CustomSortPane extends JPanel { |
|
|
|
down.addActionListener(e -> { |
|
|
|
down.addActionListener(e -> { |
|
|
|
SwingUtilities.invokeLater(() -> { |
|
|
|
SwingUtilities.invokeLater(() -> { |
|
|
|
sortItemPane.setComponentZOrder(selectedLabel, sortItemPane.getComponentZOrder(selectedLabel) + 1); |
|
|
|
sortItemPane.setComponentZOrder(selectedLabel, sortItemPane.getComponentZOrder(selectedLabel) + 1); |
|
|
|
|
|
|
|
setToolbarEnable(true, true, true, true); |
|
|
|
CustomSortPane.this.revalidate(); |
|
|
|
CustomSortPane.this.revalidate(); |
|
|
|
CustomSortPane.this.repaint(); |
|
|
|
CustomSortPane.this.repaint(); |
|
|
|
refreshCurrentOrder(); |
|
|
|
refreshCurrentOrder(); |
|
|
@ -151,23 +155,26 @@ public class CustomSortPane extends JPanel { |
|
|
|
private void disableButton() { |
|
|
|
private void disableButton() { |
|
|
|
int order = sortItemPane.getComponentZOrder(selectedLabel); |
|
|
|
int order = sortItemPane.getComponentZOrder(selectedLabel); |
|
|
|
if (order == 0) { |
|
|
|
if (order == 0) { |
|
|
|
top.setEnabled(false); |
|
|
|
setToolbarEnable(false, false, true, true); |
|
|
|
up.setEnabled(false); |
|
|
|
|
|
|
|
down.setEnabled(true); |
|
|
|
|
|
|
|
bottom.setEnabled(true); |
|
|
|
|
|
|
|
} else if (order == sortItemPane.getComponentCount() - 1) { |
|
|
|
} else if (order == sortItemPane.getComponentCount() - 1) { |
|
|
|
up.setEnabled(true); |
|
|
|
setToolbarEnable(true, true, false, false); |
|
|
|
top.setEnabled(true); |
|
|
|
|
|
|
|
down.setEnabled(false); |
|
|
|
|
|
|
|
bottom.setEnabled(false); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
up.setEnabled(true); |
|
|
|
setToolbarEnable(true, true, true, true); |
|
|
|
top.setEnabled(true); |
|
|
|
|
|
|
|
down.setEnabled(true); |
|
|
|
|
|
|
|
bottom.setEnabled(true); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 设置 置顶,上移,下移,置底 按钮的状态 |
|
|
|
|
|
|
|
* true:启用 |
|
|
|
|
|
|
|
* false:关闭 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void setToolbarEnable(boolean top, boolean up, boolean down, boolean bottom) { |
|
|
|
|
|
|
|
this.top.setEnabled(top); |
|
|
|
|
|
|
|
this.up.setEnabled(up); |
|
|
|
|
|
|
|
this.down.setEnabled(down); |
|
|
|
|
|
|
|
this.bottom.setEnabled(bottom); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void refreshCurrentOrder() { |
|
|
|
private void refreshCurrentOrder() { |
|
|
|
String[] currentTabOrder = parentPane.getCurrentOrder(); |
|
|
|
String[] currentTabOrder = parentPane.getCurrentOrder(); |
|
|
|
HashSet<String> selectedTab = new HashSet<>(); |
|
|
|
HashSet<String> selectedTab = new HashSet<>(); |
|
|
|