|
|
|
@ -74,10 +74,14 @@ public class CustomSortPane extends JPanel {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void createToolbarPane() { |
|
|
|
|
top = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/top.svg")); |
|
|
|
|
bottom = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/bottom.svg")); |
|
|
|
|
up = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/up.svg")); |
|
|
|
|
down = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/down.svg")); |
|
|
|
|
top = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/top.svg"), false); |
|
|
|
|
bottom = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/bottom.svg"), false); |
|
|
|
|
up = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/up.svg"), false); |
|
|
|
|
down = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/down.svg"), false); |
|
|
|
|
top.setDisabledIcon(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/top_disable.svg")); |
|
|
|
|
bottom.setDisabledIcon(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/bottom_disable.svg")); |
|
|
|
|
up.setDisabledIcon(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/up_disable.svg")); |
|
|
|
|
down.setDisabledIcon(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/down_disable.svg")); |
|
|
|
|
top.addActionListener(e -> { |
|
|
|
|
SwingUtilities.invokeLater(() -> { |
|
|
|
|
sortItemPane.setComponentZOrder(selectedLabel, 0); |
|
|
|
@ -132,6 +136,7 @@ public class CustomSortPane extends JPanel {
|
|
|
|
|
for (UICheckBox item : sortItems) { |
|
|
|
|
MenuLabel label = new MenuLabel(item.getText(), (Function<MenuLabel, Object>) o -> { |
|
|
|
|
selectedLabel = o; |
|
|
|
|
disableButton(); |
|
|
|
|
return null; |
|
|
|
|
}); |
|
|
|
|
sortLabels.add(label); |
|
|
|
@ -140,6 +145,24 @@ public class CustomSortPane extends JPanel {
|
|
|
|
|
sortItemPane = new MenuLabelPane(sortLabels); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 如果选中第一个和最后一个,则置灰向上和向下的按钮 |
|
|
|
|
*/ |
|
|
|
|
private void disableButton() { |
|
|
|
|
int order = sortItemPane.getComponentZOrder(selectedLabel); |
|
|
|
|
if (order == 0) { |
|
|
|
|
top.setEnabled(false); |
|
|
|
|
up.setEnabled(false); |
|
|
|
|
} else if (order == sortItemPane.getComponentCount() - 1) { |
|
|
|
|
down.setEnabled(false); |
|
|
|
|
bottom.setEnabled(false); |
|
|
|
|
} else { |
|
|
|
|
up.setEnabled(true); |
|
|
|
|
top.setEnabled(true); |
|
|
|
|
down.setEnabled(true); |
|
|
|
|
bottom.setEnabled(true); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void refreshCurrentOrder() { |
|
|
|
|
String[] currentTabOrder = parentPane.getCurrentOrder(); |
|
|
|
|