diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineTableHeaderUI.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineTableHeaderUI.java index 8be32bb5cf..89a5e738ab 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/FineTableHeaderUI.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineTableHeaderUI.java @@ -101,9 +101,9 @@ public class FineTableHeaderUI extends FlatTableHeaderUI { selectionBackground = UIManager.getColor("Table.background"); } setBackground(selectionBackground); - setText(value == null ? StringUtils.BLANK : String.valueOf(value)); setToolTipText(table, value, column); setBorder(border); + setValue(value); return this; } diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/ReportletPane.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/ReportletPane.java index dbc7c54464..041f4db0c5 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/ReportletPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/ReportletPane.java @@ -15,7 +15,6 @@ import java.awt.CardLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import static com.fine.swing.ui.layout.Layouts.column; import static com.fine.swing.ui.layout.Layouts.row; import static com.fine.swing.ui.layout.Layouts.cell; @@ -37,7 +36,7 @@ public class ReportletPane extends BasicPane { UILabel tipLabel = new UILabel(); tipLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Schedule_The_Selected_File_Must_Be_End_With_Filter")); tipLabel.setForeground(FineUIUtils.getUIColor("Label.tipColor", "Label.tipColor")); - JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + JPanel centerPane = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(0, 6)); this.add(centerPane, BorderLayout.CENTER); switchButton = new UIButton("switch"); @@ -53,13 +52,14 @@ public class ReportletPane extends BasicPane { cardPane.setLayout(card = new CardLayout()); templateReportletTree = new TemplateFileTree(); templateReportletTree.setBackground(FineUIUtils.getUIColor("background.normal", "background.normal")); - templateReportletTree.setBorder(FineBorderFactory.createWrappedRoundBorder()); IOFileNodeFilter filter = new IOFileNodeFilter(new String[]{".cpt", ".class", ".frm", ".form", ".cptx"}); templateReportletTree.setFileNodeFilter(filter); cardPane.add(t_panel = new JScrollPane(templateReportletTree), "TEMPLATE"); classReportletTree = new ClassFileTree(); cardPane.add(c_panel = new JScrollPane(classReportletTree), "CLASS"); - centerPane.add(column(6, cell(buttonPane), cell(cardPane)).getComponent()); + cardPane.setBorder(FineBorderFactory.createWrappedRoundBorder()); + centerPane.add(buttonPane, BorderLayout.NORTH); + centerPane.add(cardPane, BorderLayout.CENTER); this.refreshEnv(); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleBackgroundEditor.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleBackgroundEditor.java index 8c0137c6f4..939b87d4df 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleBackgroundEditor.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleBackgroundEditor.java @@ -7,6 +7,7 @@ import java.awt.*; import javax.swing.*; +import com.fine.theme.utils.FineUIScale; import com.fr.general.Background; import com.fr.design.mainframe.widget.wrappers.BackgroundWrapper; import com.fr.design.dialog.BasicDialog; @@ -29,7 +30,7 @@ public class AccessibleBackgroundEditor extends UneditableAccessibleEditor { protected void showEditorPane() { if (backgroundPane == null) { backgroundPane = new BackgroundPane(); - backgroundPane.setPreferredSize(new Dimension(600, 400)); + backgroundPane.setPreferredSize(FineUIScale.createScaleDimension(600, 400)); } BasicDialog dlg = backgroundPane.showWindow(SwingUtilities.getWindowAncestor(this)); dlg.addDialogActionListener(new DialogActionAdapter() { diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/debug/HeaderRenderer.java b/designer-base/src/main/java/com/fr/design/remote/ui/debug/HeaderRenderer.java new file mode 100644 index 0000000000..8427f61062 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/remote/ui/debug/HeaderRenderer.java @@ -0,0 +1,52 @@ +package com.fr.design.remote.ui.debug; + +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.light.ui.FineTableHeaderUI; + +import javax.swing.Icon; +import javax.swing.JTable; +import javax.swing.RowSorter; +import javax.swing.SortOrder; +import java.awt.Component; + +/** + * 远程调试界面表头 + * + * @author vito + * @since 11.0 + * Created on 2024/10/17 + */ +public class HeaderRenderer extends FineTableHeaderUI.TableHeaderRenderer { + private final Icon ascendingIcon = new LazyIcon("sort_asc"); + private final Icon descendingIcon = new LazyIcon("sort_desc"); + private final Icon nosortIcon = new LazyIcon("nosort"); + + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, + boolean isSelected, boolean hasFocus, + int row, int col) { + super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col); + + int modelColumn = table.convertColumnIndexToModel(col); + setIcon(null); + RemoteDesignNetWorkTableRowSorter sorter = (RemoteDesignNetWorkTableRowSorter) table.getRowSorter(); + + if (!sorter.isSortable(modelColumn)) { + return this; + } + SortOrder sortOrder = sorter.getSortKeys().stream() + .filter(key -> key.getColumn() == modelColumn) + .map(RowSorter.SortKey::getSortOrder) + .findFirst() + .orElse(null); + if (sortOrder == SortOrder.ASCENDING) { + setIcon(ascendingIcon); + } else if (sortOrder == SortOrder.DESCENDING) { + setIcon(descendingIcon); + } else { + setIcon(nosortIcon); + } + return this; + } +} diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkAction.java b/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkAction.java index e0cfa2524e..337bcf3319 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkAction.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkAction.java @@ -8,13 +8,16 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.workspace.WorkContext; import javax.swing.JDialog; +import javax.swing.KeyStroke; import java.awt.Dimension; import java.awt.event.ActionEvent; +import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import static com.fine.theme.utils.FineUIScale.createScaleDimension; import static com.fine.theme.utils.FineUIScale.unscale; +import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; /** * 远程设计网络调试 @@ -27,7 +30,8 @@ public class RemoteDesignNetWorkAction extends UpdateAction { public static final String TITLE = "Remote Design NetWork"; public RemoteDesignNetWorkAction() { - setName(TITLE); + this.setName(TITLE); + this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, DEFAULT_MODIFIER)); } @Override diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkHelper.java b/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkHelper.java index ba08291379..ba08d0586f 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkHelper.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkHelper.java @@ -2,6 +2,8 @@ package com.fr.design.remote.ui.debug; import com.fr.stable.StringUtils; +import javax.swing.UIManager; +import java.awt.Color; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.Date; @@ -14,6 +16,9 @@ import java.util.Date; * Created on 2024/10/11 */ public class RemoteDesignNetWorkHelper { + + static final Color DEFAULT_COLOR = UIManager.getColor("Table.foreground"); + private static final int UNIT = 1000; private static final int UNIT_BYTES = 1024; private static final String SECOND = "s"; diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTablePane.java b/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTablePane.java index c29633aa5c..ab0ea82f98 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTablePane.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTablePane.java @@ -86,7 +86,11 @@ public class RemoteDesignNetWorkTablePane extends JPanel { model.addColumn("request"); model.addColumn("response"); uiTable = new JTable(model); + uiTable.getColumnModel().getColumn(4).setCellRenderer(new TimeColorCellRenderer()); + uiTable.getColumnModel().getColumn(5).setCellRenderer(new SizeColorCellRenderer()); + uiTable.getColumnModel().getColumn(6).setCellRenderer(new SizeColorCellRenderer()); uiTable.setRowSorter(new RemoteDesignNetWorkTableRowSorter(model)); + uiTable.getTableHeader().setDefaultRenderer(new HeaderRenderer()); add(new JScrollPane(uiTable), BorderLayout.CENTER); } @@ -155,5 +159,4 @@ public class RemoteDesignNetWorkTablePane extends JPanel { } } - } diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTableRowSorter.java b/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTableRowSorter.java index 231acc72c7..4f1270f1c7 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTableRowSorter.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTableRowSorter.java @@ -19,6 +19,7 @@ public class RemoteDesignNetWorkTableRowSorter extends TableRowSorter SIZE_LARGE) { + setForeground(Color.RED); + } else if (parsed > SIZE_MIDDLE) { + setForeground(Color.ORANGE); + } else { + setForeground(DEFAULT_COLOR); + } + } + setText((value == null) ? "" : value.toString()); + } +} diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/debug/TimeColorCellRenderer.java b/designer-base/src/main/java/com/fr/design/remote/ui/debug/TimeColorCellRenderer.java new file mode 100644 index 0000000000..7955fd0218 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/remote/ui/debug/TimeColorCellRenderer.java @@ -0,0 +1,38 @@ +package com.fr.design.remote.ui.debug; + +import com.fine.theme.light.ui.FineTableHeaderUI; + +import java.awt.Color; + +import static com.fr.design.remote.ui.debug.RemoteDesignNetWorkHelper.DEFAULT_COLOR; + +/** + * 时间多颜色渲染 + * + * @author vito + * @since 11.0 + * Created on 2024/10/16 + */ +public class TimeColorCellRenderer extends FineTableHeaderUI.TableRenderer { + + private static final int SIZE_MIDDLE = 1000; + private static final int SIZE_LARGE = 5000; + + + + @Override + protected void setValue(Object value) { + + if (value instanceof String) { + long parsed = RemoteDesignNetWorkHelper.parseCostToMS((String) value); + if (parsed > SIZE_LARGE) { + setForeground(Color.RED); + } else if (parsed > SIZE_MIDDLE) { + setForeground(Color.ORANGE); + } else { + setForeground(DEFAULT_COLOR); + } + } + setText((value == null) ? "" : value.toString()); + } +} diff --git a/designer-base/src/main/java/com/fr/design/style/background/BackgroundPane.java b/designer-base/src/main/java/com/fr/design/style/background/BackgroundPane.java index 786c472c08..2187c99ece 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/BackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/BackgroundPane.java @@ -92,6 +92,7 @@ public class BackgroundPane extends BasicPane { quickPane = BackgroundFactory.createIfAbsent(background == null ? null : background.getClass()); cacheMap.put(index, quickPane); } + tabbedPane.setSelectedIndex(index); return quickPane; } diff --git a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java index 1e7b3394e4..e8728d1672 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java @@ -267,7 +267,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { private void initMenuColorPane() { - menuColorPane.setLayout(new GridLayout(5, 8, DEFAULT_COLOR_HOR_INTERVAL, 0)); + menuColorPane.setLayout(new GridLayout(4, 10, DEFAULT_COLOR_HOR_INTERVAL, 0)); Color[] colorArray = this.getColorArray(); for (int i = 0; i < colorArray.length; i++) { Color color = colorArray[i] == null ? UsedColorPane.DEFAULT_COLOR : colorArray[i];