|
|
@ -85,7 +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); |
|
|
|
setToolbarEnable(sortItemPane.getComponentZOrder(selectedLabel), sortItemPane.getComponentCount()); |
|
|
|
CustomSortPane.this.revalidate(); |
|
|
|
CustomSortPane.this.revalidate(); |
|
|
|
CustomSortPane.this.repaint(); |
|
|
|
CustomSortPane.this.repaint(); |
|
|
|
refreshCurrentOrder(); |
|
|
|
refreshCurrentOrder(); |
|
|
@ -95,7 +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); |
|
|
|
setToolbarEnable(sortItemPane.getComponentZOrder(selectedLabel), sortItemPane.getComponentCount()); |
|
|
|
CustomSortPane.this.revalidate(); |
|
|
|
CustomSortPane.this.revalidate(); |
|
|
|
CustomSortPane.this.repaint(); |
|
|
|
CustomSortPane.this.repaint(); |
|
|
|
refreshCurrentOrder(); |
|
|
|
refreshCurrentOrder(); |
|
|
@ -105,7 +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); |
|
|
|
setToolbarEnable(sortItemPane.getComponentZOrder(selectedLabel), sortItemPane.getComponentCount()); |
|
|
|
CustomSortPane.this.revalidate(); |
|
|
|
CustomSortPane.this.revalidate(); |
|
|
|
CustomSortPane.this.repaint(); |
|
|
|
CustomSortPane.this.repaint(); |
|
|
|
refreshCurrentOrder(); |
|
|
|
refreshCurrentOrder(); |
|
|
@ -115,7 +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); |
|
|
|
setToolbarEnable(sortItemPane.getComponentZOrder(selectedLabel), sortItemPane.getComponentCount()); |
|
|
|
CustomSortPane.this.revalidate(); |
|
|
|
CustomSortPane.this.revalidate(); |
|
|
|
CustomSortPane.this.repaint(); |
|
|
|
CustomSortPane.this.repaint(); |
|
|
|
refreshCurrentOrder(); |
|
|
|
refreshCurrentOrder(); |
|
|
@ -175,6 +175,26 @@ public class CustomSortPane extends JPanel { |
|
|
|
this.bottom.setEnabled(bottom); |
|
|
|
this.bottom.setEnabled(bottom); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 根据选项当前位置以及菜单大小设置 置顶,上移,下移,置底 按钮的状态 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void setToolbarEnable(int order, int maxOrder) { |
|
|
|
|
|
|
|
this.top.setEnabled(true); |
|
|
|
|
|
|
|
this.up.setEnabled(true); |
|
|
|
|
|
|
|
this.down.setEnabled(true); |
|
|
|
|
|
|
|
this.bottom.setEnabled(true); |
|
|
|
|
|
|
|
// 选项处于顶端,则置灰上移和置顶按钮
|
|
|
|
|
|
|
|
if (order == 0) { |
|
|
|
|
|
|
|
this.top.setEnabled(false); |
|
|
|
|
|
|
|
this.up.setEnabled(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 选项处于底端,则置灰下移和置底按钮
|
|
|
|
|
|
|
|
if (order == maxOrder - 1) { |
|
|
|
|
|
|
|
this.down.setEnabled(false); |
|
|
|
|
|
|
|
this.bottom.setEnabled(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void refreshCurrentOrder() { |
|
|
|
private void refreshCurrentOrder() { |
|
|
|
String[] currentTabOrder = parentPane.getCurrentOrder(); |
|
|
|
String[] currentTabOrder = parentPane.getCurrentOrder(); |
|
|
|
HashSet<String> selectedTab = new HashSet<>(); |
|
|
|
HashSet<String> selectedTab = new HashSet<>(); |
|
|
|