diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/AbstractSupportSelectTablePane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/AbstractSupportSelectTablePane.java index 7c2d56b509..a4ee2623c2 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/AbstractSupportSelectTablePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/AbstractSupportSelectTablePane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.vcs.ui; +import com.fr.base.svg.IconUtils; import com.fr.design.data.tabledata.tabledatapane.loading.TipsPane; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.icheckbox.UICheckBox; @@ -242,6 +243,7 @@ public abstract class AbstractSupportSelectTablePane exte public HeaderRenderer(JTable table) { this.tableHeader = table.getTableHeader(); + tableHeader.setCursor(new Cursor(Cursor.HAND_CURSOR)); selectBox = new UICheckBox(); selectBox.setSelected(false); tableHeader.addMouseListener(new MouseAdapter() { @@ -290,8 +292,12 @@ public abstract class AbstractSupportSelectTablePane exte tableHeader = table.getTableHeader(); tableHeader.setReorderingAllowed(false); String valueStr = (String) value; - JLabel label = new JLabel(valueStr); - label.setHorizontalAlignment(SwingConstants.LEFT); + UILabel label = new UILabel(valueStr); + if (needIcon4Head(column)) { + label.setIcon(IconUtils.readIcon("/com/fr/design/standard/vcslist/vcs_sort")); + label.setHorizontalTextPosition(JLabel.LEFT); + label.setHorizontalAlignment(SwingConstants.LEFT); + } selectBox.setHorizontalAlignment(SwingConstants.CENTER); selectBox.setBorderPainted(true); JComponent component = (column == 0) ? selectBox : label; @@ -320,6 +326,7 @@ public abstract class AbstractSupportSelectTablePane exte setColumnClass(classes); this.setDefaultEditor(Boolean.class, new BooleanEditor()); this.setDefaultRenderer(Boolean.class, new BooleanRenderer()); + this.setDefaultRenderer(UILabel.class, new ToolTipTableCellRenderer()); } @Override @@ -375,5 +382,14 @@ public abstract class AbstractSupportSelectTablePane exte } + /** + * 表头的某列是否需要icon + * + * @param col 列 + * @return + */ + protected boolean needIcon4Head(int col) { + return col != 0; + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/ToolTipTableCellRenderer.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/ToolTipTableCellRenderer.java new file mode 100644 index 0000000000..9e2dca1054 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/ToolTipTableCellRenderer.java @@ -0,0 +1,28 @@ +package com.fr.design.mainframe.vcs.ui; + +import com.fr.general.GeneralUtils; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import javax.swing.table.DefaultTableCellRenderer; +import java.awt.*; + + +/** + * 带ToolTip的UILabel的表格渲染类 + * + */ +public class ToolTipTableCellRenderer extends DefaultTableCellRenderer { + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + if(component instanceof JLabel) { + String toolTipText = GeneralUtils.objectToString(value); + if (StringUtils.isNotEmpty(toolTipText)) { + ((JLabel) component).setToolTipText(toolTipText); + } + } + return component; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java index 5c2520ce1e..d1ac7ad31e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java @@ -125,6 +125,12 @@ public class VcsCenterPane extends VcsNewPane { }); } + + @Override + protected boolean needIcon4Head(int col) { + return col != 0 && col != OPERATOR_COL; + } + private void initOpenListener() { open.addMouseListener(new MouseAdapter() { @Override diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java index 42b5f15db0..e65726bc68 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java @@ -113,6 +113,7 @@ public class VcsNewPane extends RecyclePane { this.operatorPane = createOperatorPane(); this.model.setDefaultEditor(VcsOperatorPane.class, new VcsCellEditor(createOperatorPane())); this.model.setDefaultRenderer(VcsOperatorPane.class, new VcsCellRender(createOperatorPane())); + this.model.setDefaultRenderer(UILabel.class, new ToolTipTableCellRenderer()); } @@ -339,4 +340,9 @@ public class VcsNewPane extends RecyclePane { }; dialog.setVisible(true); } + + @Override + protected boolean needIcon4Head(int col) { + return col != 0 && col != OPERATOR_COL; + } } diff --git a/designer-base/src/main/resources/com/fr/design/standard/vcslist/vcs_sort_normal.svg b/designer-base/src/main/resources/com/fr/design/standard/vcslist/vcs_sort_normal.svg new file mode 100644 index 0000000000..01d9ffeb5f --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/standard/vcslist/vcs_sort_normal.svg @@ -0,0 +1,4 @@ + + + +