diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineComboBoxUI.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineComboBoxUI.java index 1e712238df..b410afc207 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/FineComboBoxUI.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineComboBoxUI.java @@ -2,16 +2,21 @@ package com.fine.theme.light.ui; import com.fine.theme.utils.FineClientProperties; import com.fine.theme.utils.FineUIScale; +import com.fine.theme.utils.FineUIUtils; import com.formdev.flatlaf.ui.FlatComboBoxUI; import com.formdev.flatlaf.ui.FlatUIUtils; -import org.jetbrains.annotations.Nullable; import javax.swing.JButton; +import javax.swing.JComboBox; import javax.swing.JComponent; +import javax.swing.JScrollPane; +import javax.swing.ScrollPaneConstants; import javax.swing.SwingConstants; import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.basic.ComboPopup; import java.awt.Dimension; import java.awt.Graphics2D; +import java.awt.Rectangle; /** * 提供 {@link javax.swing.JComboBox} 的UI类 @@ -47,8 +52,10 @@ public class FineComboBoxUI extends FlatComboBoxUI { @Override public Dimension getMinimumSize(JComponent c) { // ComboBox基于子组件计算适配尺寸性能一般,仅考虑部分ComboBox进行适配计算,其他采用默认值 - if (FineClientProperties.ADAPTIVE_COMBO_BOX.equals(getComboBoxTypeStr(c))) { - return super.getMinimumSize(c); + if (isAdaptiveComboBox(c)) { + Dimension dimension = super.getMinimumSize(c); + return new Dimension(Math.min(dimension.width, + FineUIUtils.getAndScaleInt("ComboBox.maximumWidth", 400)), dimension.height); } return FineUIScale.scale(new Dimension( FlatUIUtils.getUIInt("ComboBox.minimumWidth", 72), @@ -56,12 +63,41 @@ public class FineComboBoxUI extends FlatComboBoxUI { )); } - @Nullable - static String getComboBoxTypeStr(JComponent c) { + static boolean isAdaptiveComboBox(JComponent c) { Object value = c.getClientProperty(FineClientProperties.COMBO_BOX_TYPE); if (value instanceof String) { - return (String) value; + return FineClientProperties.ADAPTIVE_COMBO_BOX.equals(value); + } + return false; + } + + @Override + protected ComboPopup createPopup() { + return new FineComboPopup(this.comboBox); + } + + protected class FineComboPopup extends FlatComboPopup { + + protected FineComboPopup(JComboBox combo) { + super(combo); + } + + @Override + protected Rectangle computePopupBounds(int px, int py, int pw, int ph) { + Rectangle fitRectangle = super.computePopupBounds(px, py, pw, ph); + // 限制最大宽度,如超出则高度预留展示横向滚动条所需宽度 + int comboWidth = comboBox.getWidth(); + if (fitRectangle.width > comboWidth) { + return new Rectangle(px, py, comboWidth, fitRectangle.height + FlatUIUtils.getUIInt("ScrollBar.width", 10)); + } + return fitRectangle; + } + + @Override + protected JScrollPane createScroller() { + return new JScrollPane( list, + ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, + ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); } - return null; } } 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/cache/DesignCacheManager.java b/designer-base/src/main/java/com/fr/design/cache/DesignCacheManager.java deleted file mode 100644 index bb0e2c4b42..0000000000 --- a/designer-base/src/main/java/com/fr/design/cache/DesignCacheManager.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.fr.design.cache; - -import com.fr.base.TableData; -import com.fr.design.data.tabledata.wrapper.TableDataFactory; - -import java.util.Map; - -/** - * 设计器缓存管理 - * - * @author Destiny.Lin - * @since 11.0 - * Created on 2024/8/11 - */ -public class DesignCacheManager { - - public static ThreadLocal> cacheTableData = new ThreadLocal<>(); - - /** - * 处理任务(使用数据集缓存) - */ - public static void processByCacheTableData(Task task) { - try { - cacheTableData.set(TableDataFactory.getTableDatas()); - task.process(); - } finally { - cacheTableData.remove(); - } - } - - - /** - * 是否使用数据集的缓存 - */ - public static boolean useDataCache() { - return cacheTableData.get() != null; - } - - /** - * 获取数据集缓存 - */ - public static ThreadLocal> getCacheTableData() { - return cacheTableData; - } - - /** - * 设置数据集缓存 - */ - public static void setCacheTableData(ThreadLocal> cacheTableData) { - DesignCacheManager.cacheTableData = cacheTableData; - } - - /** - * 任务 - */ - public interface Task { - /** - * 处理 - */ - void process(); - } -} diff --git a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java index 0c17bcb0e9..dcde4716b0 100644 --- a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java +++ b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java @@ -19,7 +19,6 @@ import com.fr.data.impl.storeproc.StoreProcedureConstants; import com.fr.data.impl.storeproc.StoreProcedureHelper; import com.fr.data.operator.DataOperator; import com.fr.design.DesignModelAdapter; -import com.fr.design.cache.DesignCacheManager; import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.design.data.tabledata.wrapper.MultiResultTableDataNameWrapper; import com.fr.design.data.tabledata.wrapper.MultiResultTableDataWrapper; @@ -449,13 +448,7 @@ public abstract class DesignTableDataManager { } private static void addServerData(java.util.Map resMap) { - Map tableDataMap; - if (DesignCacheManager.useDataCache()) { - FineLoggerFactory.getLogger().debug("use cache Table data wrapper."); - tableDataMap = DesignCacheManager.getCacheTableData().get(); - } else { - tableDataMap = TableDataFactory.getTableDatas(); - } + Map tableDataMap = TableDataFactory.getTableDatas(); for (Entry entry : tableDataMap.entrySet()) { if (globalDsCache.containsKey(entry.getKey())) { resMap.put(entry.getKey(), globalDsCache.get(entry.getKey())); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataComboBox.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataComboBox.java index 3db9c3aff1..6f93848a7e 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataComboBox.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataComboBox.java @@ -1,6 +1,8 @@ package com.fr.design.data.datapane; +import com.fr.design.constants.UIConstants; import java.awt.Component; +import java.awt.Dimension; import java.awt.event.ItemEvent; import java.util.Iterator; import java.util.Map.Entry; @@ -23,7 +25,7 @@ import com.fr.stable.StringUtils; /** * 包含所有数据集的下拉框 - * + * * @author zhou * @since 2012-4-20上午10:34:30 */ @@ -43,22 +45,29 @@ public class TableDataComboBox extends UIComboBox implements Prepare4DataSourceC this.treeName = treeName; this.setRenderer(new UIComboBoxRenderer() { private static final long serialVersionUID = 1L; + private boolean labelVisible = true; @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel renderer = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - if (index == -1 && value == null) { - // 显示空白 + if (value instanceof TableDataWrapper) { + labelVisible = true; + TableDataWrapper tableDataWrapper = (TableDataWrapper)value; + renderer.setIcon(tableDataWrapper.getIcon()); + renderer.setText(tableDataWrapper.getTableDataName()); + renderer.setToolTipText(tableDataWrapper.getTableDataName()); + } else { + labelVisible = false; renderer.setIcon(null); renderer.setText(StringUtils.EMPTY); - }else if (value instanceof TableDataWrapper) { - TableDataWrapper tabledatawrappe = (TableDataWrapper)value; - renderer.setIcon(tabledatawrappe.getIcon()); - renderer.setText(tabledatawrappe.getTableDataName()); - renderer.setToolTipText(tabledatawrappe.getTableDataName()); } return renderer; } + + @Override + public Dimension getPreferredSize() { + return labelVisible ? super.getPreferredSize() : new Dimension(super.getPreferredSize().width, 0); + } }); refresh(source); registerDSChangeListener(); @@ -75,6 +84,7 @@ public class TableDataComboBox extends UIComboBox implements Prepare4DataSourceC setDsMap(); DefaultComboBoxModel model = new DefaultComboBoxModel(); this.setModel(model); + model.addElement(UIConstants.PENDING); // 遍历添加所有数据项到模型 Iterator> entryIt = dsMap.entrySet().iterator(); while (entryIt.hasNext()) { @@ -83,8 +93,6 @@ public class TableDataComboBox extends UIComboBox implements Prepare4DataSourceC model.addElement(tableDataWrapper); } } - // 设置默认选项为空白 - this.setSelectedItem(null); if (dataWrapper != null) { if (DesignTableDataManager.isDsNameChanged(dataWrapper.getTableDataName())) { this.setSelectedTableDataByName(DesignTableDataManager.getChangedDsNameByOldDsName(dataWrapper.getTableDataName())); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java index cbc67bb2e8..304ed35eae 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java @@ -336,6 +336,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData for (ServerDataSetBean bean : deleteDatas) { TableDataRepository.getInstance().delete(bean); } + TableDataRepository.getInstance().invalidCache(); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java index 0552f836e8..861e070214 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java @@ -12,7 +12,6 @@ import com.fr.design.DesignModelAdapter; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; -import com.fr.design.cache.DesignCacheManager; import com.fr.design.data.BasicTableDataTreePane; import com.fr.design.data.BasicTableDataUtils; import com.fr.design.data.DesignTableDataManager; @@ -461,7 +460,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { if (!ComparatorUtils.equals(oldName, tdName)) { map.put(oldName, tdName); } - DesignCacheManager.processByCacheTableData(() -> fireDSChanged(map)); + fireDSChanged(map); tc.fireTargetModified(); tc.parameterChanged(); int[] rows = tableDataTree.getSelectionRows(); @@ -1023,7 +1022,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { @Override public void actionPerformed(ActionEvent e) { - DesignCacheManager.processByCacheTableData(() -> dgEdit(getTableDataInstance().creatTableDataPane(), createDsName(getNamePrefix()), false)); + dgEdit(getTableDataInstance().creatTableDataPane(), createDsName(getNamePrefix()), false); } } @@ -1129,7 +1128,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { BasicDialog basicDialog = basicPane.showSmallWindow(SwingUtilities.getWindowAncestor(TableDataTreePane.this), new DialogActionAdapter() { @Override public void doOk() { - DesignCacheManager.processByCacheTableData(this::processRemove); + processRemove(); } private void processRemove() { @@ -1203,7 +1202,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { @Override public void actionPerformed(ActionEvent e) { - DesignCacheManager.processByCacheTableData(this::doPaste); + doPaste(); } private void doPaste() { diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java index 48a09ba695..d1acf83474 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java @@ -360,6 +360,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh if (!WorkContext.getCurrent().isLocal()) { EventDispatcher.fire(RemoteConfigEvent.EDIT, "ConnectionConfig"); } + ConnectionRepository.getInstance().invalidCache(); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); throw e; diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java index 4b91320829..8dc3e2f2d2 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java @@ -1,7 +1,10 @@ package com.fr.design.data.datapane.connect; import com.fanruan.config.impl.data.ConnectionConfigProviderFactory; +import com.fanruan.datasource.driver.bean.DriverLoaderBean; import com.fr.data.driver.DriverClassNotFoundException; +import com.fr.data.driver.DriverLoader; +import com.fr.data.driver.config.DriverLoaderConfig; import com.fr.data.impl.Connection; import com.fr.decision.webservice.bean.datasource.ConnectionInfoBean; import com.fr.decision.webservice.exception.general.DriverNotFoundException; @@ -9,13 +12,15 @@ import com.fr.decision.webservice.v10.datasource.connection.processor.impl.Conne import com.fr.design.data.datapane.preview.ConnectionInfoBeanHelper; import com.fr.design.i18n.Toolkit; import com.fr.log.FineLoggerFactory; -import com.fr.security.encryption.transmission.TransmissionEncryptionManager; import com.fr.workspace.engine.exception.DriverUnExistException; import com.fr.workspace.server.repository.connection.BaseConnectionSource; + import java.sql.SQLException; import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 本地Connection资源操作 @@ -98,6 +103,26 @@ public class LocalConnectionSource extends BaseConnectionSource { } + + @Override + public Map getDriverLoaders() throws Exception { + return DriverLoaderConfig.getInstance().getDriverLoaders().entrySet().stream() + .collect(Collectors.toMap(Map.Entry::getKey, entry -> convertDriverLoader(entry.getValue()), (a, b) -> a, LinkedHashMap::new)); + } + + private DriverLoaderBean convertDriverLoader(DriverLoader driverLoader) { + if (driverLoader == null) { + return null; + } + DriverLoaderBean driverLoaderBean = new DriverLoaderBean(); + driverLoaderBean.setName(driverLoader.getName()); + driverLoaderBean.setDriverClass(driverLoader.getDriverClass()); + driverLoaderBean.setDriverList(driverLoader.getDriverList()); + driverLoaderBean.setDriverJarFiles(driverLoader.getDriverJarFiles()); + driverLoaderBean.setLoadingStrategy(driverLoader.getLoadingStrategy()); + return driverLoaderBean; + } + @Override public boolean lock(String str) { // 本地默认锁定成功,让其执行后续动作 diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java index 4c672479ae..1d31b1a5ab 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java @@ -97,7 +97,7 @@ public class SshPane extends BasicPane { type.addActionListener(e -> changePaneForType()); fileChooserButton.addActionListener(e -> { - FILEChooserPane fileChooser = FILEChooserPane.getInstanceWithDesignatePath(SslUtils.PREFIX, new ChooseFileFilter(true), SslUtils.CERTIFICATES); + FILEChooserPane fileChooser = FILEChooserPane.getFileCAChoosePane(new ChooseFileFilter(true)); int type = fileChooser.showOpenDialog(SshPane.this, StringUtils.EMPTY); if (type == FILEChooserPane.OK_OPTION) { final FILE file = fileChooser.getSelectedFILE(); diff --git a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java index 0c8d62d587..6f2d1c5719 100644 --- a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java @@ -13,7 +13,6 @@ import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.file.LocateAction; import com.fr.design.actions.template.NewWorkBookToolButtonAction; -import com.fr.design.cache.DesignCacheManager; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.fun.MenuHandler; @@ -837,13 +836,13 @@ public class MultiTemplateTabPane extends Row { setIsCloseCurrent(true); } closeFormat(template); - DesignCacheManager.processByCacheTableData(() -> closeSpecifiedTemplate(template)); + closeSpecifiedTemplate(template); DesignerContext.getDesignerFrame().getContentFrame().repaint(); isShowList = false; } else { //没有点击关闭和ListDown按钮,则切换到点击的模板处 closeIconIndex = -1; - DesignCacheManager.processByCacheTableData(() -> switchJTemplate(getTemplateIndex(evtX))); + switchJTemplate(getTemplateIndex(evtX)); clodeIcon = new LazyIcon("clear"); switchJTemplate(getTemplateIndex(evtX)); isShowList = false; diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index 2971f38e22..b807123b19 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -5,7 +5,6 @@ package com.fr.design.file; import com.fanruan.repository.TemplateRepository; import com.fr.design.ExtraDesignClassManager; -import com.fr.design.cache.DesignCacheManager; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.fun.TemplateTreeDefineProcessor; import com.fr.design.gui.itree.filetree.TemplateFileTree; @@ -105,7 +104,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { return; } if (evt.getClickCount() == 2) { - DesignCacheManager.processByCacheTableData(() -> openFile()); + openFile(); } } diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java index 598ec35677..60e26e75a3 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java @@ -452,21 +452,6 @@ public class UIResizableContainer extends JPanel { repaint(); } - @Override - public void mouseClicked(MouseEvent e) { - if (e.getY() <= ARROW_RANGE_VERTICAL) { - if (containerWidth == toolPaneHeight) { - containerWidth = preferredWidth; - } else { - setPreferredWidth(containerWidth); - containerWidth = toolPaneHeight; - } - refreshContainer(); - if (DesignModeContext.isAuthorityEditing()) { - DesignerContext.getDesignerFrame().doResize(); - } - } - } }); } diff --git a/designer-base/src/main/java/com/fr/design/gui/ilist/CheckBoxList.java b/designer-base/src/main/java/com/fr/design/gui/ilist/CheckBoxList.java index 66c697bd89..174d8bc199 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ilist/CheckBoxList.java +++ b/designer-base/src/main/java/com/fr/design/gui/ilist/CheckBoxList.java @@ -256,13 +256,6 @@ public class CheckBoxList extends JComponent { this.setBackground(list.getBackground()); this.setForeground(list.getForeground()); } - - if (cellHasFocus) { - this.setBorder(UIManager.getBorder("List.focusCellHighlightBorder")); - } else { - this.setBorder(NO_FOCUS_BORDER); - } - 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]; diff --git a/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java b/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java index f22f1eb0a6..879b417b9e 100644 --- a/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java @@ -23,6 +23,8 @@ import java.awt.event.ActionListener; import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.flex; public class IconDefinePane extends BasicPane { @@ -66,8 +68,9 @@ public class IconDefinePane extends BasicPane { showIconImageLable.setIcon(null); } }); - - JPanel iconButtonPane = row(LayoutConstants.HORIZONTAL_GAP, cell(this.showIconImageLable), cell(this.editIconButton), cell(this.removeIconButton)).getComponent(); + JPanel iconButtonPane = row(LayoutConstants.HORIZONTAL_GAP, cell(this.showIconImageLable), + column(flex(), row(LayoutConstants.HORIZONTAL_GAP, cell(this.editIconButton), cell(this.removeIconButton)), flex()) + ).getComponent(); iconButtonPane.setBorder(new ScaledEmptyBorder(0,0,0,0)); this.setLayout(new BorderLayout()); this.add(iconButtonPane, BorderLayout.CENTER); @@ -92,16 +95,6 @@ public class IconDefinePane extends BasicPane { setShowIconImage(); } - /** - * 直接更新icon - * @param iconName - * @param icon - */ - public void populateIcon(String iconName, Icon icon) { - this.curIconName = iconName; - showIconImageLable.setIcon(icon); - } - public String update() { return this.curIconName; } diff --git a/designer-base/src/main/java/com/fr/design/widget/component/BackgroundCompPane.java b/designer-base/src/main/java/com/fr/design/widget/component/BackgroundCompPane.java index 98e4844ade..c3cdb42990 100644 --- a/designer-base/src/main/java/com/fr/design/widget/component/BackgroundCompPane.java +++ b/designer-base/src/main/java/com/fr/design/widget/component/BackgroundCompPane.java @@ -1,5 +1,6 @@ package com.fr.design.widget.component; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; @@ -12,7 +13,6 @@ import javax.swing.JPanel; import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.column; -import static com.fine.swing.ui.layout.Layouts.flex; import static com.fine.swing.ui.layout.Layouts.row; import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; @@ -40,26 +40,24 @@ public abstract class BackgroundCompPane extends BasicPane { backgroundHead = new UIButtonGroup(titles); panel = column(VERTICAL_GAP, row( - flex(LEFT_WEIGHT), cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Initial"))).weight(RIGHT_WEIGHT / 2), cell(initialBackgroundEditor).weight(RIGHT_WEIGHT / 2) ), row( - flex(LEFT_WEIGHT), cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Over"))).weight(RIGHT_WEIGHT / 2), cell(overBackgroundEditor).weight(RIGHT_WEIGHT / 2) ), row( - flex(LEFT_WEIGHT), cell(getClickLabel()).weight(RIGHT_WEIGHT / 2), cell(clickBackgroundEditor).weight(RIGHT_WEIGHT / 2) ) - ).getComponent(); + ).with(it -> it.setBorder(new ScaledEmptyBorder(0, 10, 0, 0))).getComponent(); this.add(column(VERTICAL_GAP, row( cell(headLabel).weight(LEFT_WEIGHT), cell(backgroundHead).weight(RIGHT_WEIGHT) - ) + ), + cell(panel) ).getComponent()); } diff --git a/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java b/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java index eebd4811dc..1751fa98f4 100644 --- a/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java +++ b/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java @@ -238,8 +238,8 @@ public class DBManipulationPane extends BasicBeanPane { } }); helpButton.set4ToolbarButton(); - buttonGroup.add(row(5, cell(UpdateCheckBox), - cell(helpButton))); + checkBoxUpdatePane.add(row(5, cell(UpdateCheckBox), cell(helpButton)).getComponent()); + buttonGroup.add(cell(checkBoxUpdatePane)); controlBtnPane.add(column(5, buttonGroup.toArray(new Layouts.Cell[0])).getComponent()); } } diff --git a/designer-base/src/main/java/com/fr/file/FileDataFILE.java b/designer-base/src/main/java/com/fr/file/FileDataFILE.java index 11fba58b6a..2b75312d83 100644 --- a/designer-base/src/main/java/com/fr/file/FileDataFILE.java +++ b/designer-base/src/main/java/com/fr/file/FileDataFILE.java @@ -9,6 +9,7 @@ import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.workspace.server.repository.tabledata.TableDataRepository; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.HashMap; @@ -98,6 +99,9 @@ public class FileDataFILE extends FileNodeFILE{ FileDataFILE root = null; if (!this.builded) { root = buildTree(); + if (root == null) { + return new FILE[0]; + } FileDataFILE dataFILE = root.getFileDataFILE(this.id); this.setChildren(dataFILE.getChildren()); this.setType(dataFILE.getType()); @@ -125,7 +129,7 @@ public class FileDataFILE extends FileNodeFILE{ return null; } - private FileDataFILE buildTree() { + private @Nullable FileDataFILE buildTree() { List beans = TableDataRepository.getInstance().getFileList(type); Map tree = new HashMap<>(); FileDataFILE root = null; diff --git a/designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/WidgetStyleEditPane.java b/designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/WidgetStyleEditPane.java index b5d3f0f5c4..3447ef084b 100644 --- a/designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/WidgetStyleEditPane.java +++ b/designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/WidgetStyleEditPane.java @@ -34,6 +34,7 @@ import java.awt.Component; import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; /** @@ -68,7 +69,7 @@ public class WidgetStyleEditPane extends BasicBeanPane< * 控件背景和透明度配置面板 */ protected NewColorSelectBox widgetBgColorSelectBox; - protected UINumberDragPaneWithPercent widgetBgAlphaDragPane; + protected UIPercentDragPane widgetBgAlphaDragPane; /** * 图标颜色 */ @@ -131,7 +132,7 @@ public class WidgetStyleEditPane extends BasicBeanPane< colorSelectBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, true); colorSelectBox.setSelectObject(WidgetThemeDisplayConstants.DEFAULT_THEME_COLOR); widgetBgColorSelectBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, true); - widgetBgAlphaDragPane = new UINumberDragPaneWithPercent(0, 100, 1); + widgetBgAlphaDragPane = new UIPercentDragPane(); initLineBox(); borderRadiusSpinner = new UISpinner(0, Integer.MAX_VALUE, 1); iconColorSelectBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, true); diff --git a/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_bottom_align.svg b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_bottom_align.svg new file mode 100644 index 0000000000..25544d99e1 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_bottom_align.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_bottom_align_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_bottom_align_disable.svg new file mode 100644 index 0000000000..a3f5e89fb5 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_bottom_align_disable.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_horizontal_center.svg b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_horizontal_center.svg new file mode 100644 index 0000000000..0686dc97bf --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_horizontal_center.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_horizontal_center_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_horizontal_center_disable.svg new file mode 100644 index 0000000000..15185165ab --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_horizontal_center_disable.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_horizontal_distribute.svg b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_horizontal_distribute.svg new file mode 100644 index 0000000000..0cb2dba130 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_horizontal_distribute.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_horizontal_distribute_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_horizontal_distribute_disable.svg new file mode 100644 index 0000000000..bdbc4cb218 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_horizontal_distribute_disable.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_left_align.svg b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_left_align.svg new file mode 100644 index 0000000000..f611b29c34 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_left_align.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_left_align_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_left_align_disable.svg new file mode 100644 index 0000000000..2dad9aa3c1 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_left_align_disable.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_right_align.svg b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_right_align.svg new file mode 100644 index 0000000000..d914b29fef --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_right_align.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_right_align_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_right_align_disable.svg new file mode 100644 index 0000000000..1e2368cc87 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_right_align_disable.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_top_align.svg b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_top_align.svg new file mode 100644 index 0000000000..efc6bd391d --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_top_align.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_top_align_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_top_align_disable.svg new file mode 100644 index 0000000000..2087739095 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_top_align_disable.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_vertical_center.svg b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_vertical_center.svg new file mode 100644 index 0000000000..0fd18a1aa4 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_vertical_center.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_vertical_center_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_vertical_center_disable.svg new file mode 100644 index 0000000000..0479e03629 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_vertical_center_disable.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_vertical_distribute.svg b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_vertical_distribute.svg new file mode 100644 index 0000000000..45c0fdea12 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_vertical_distribute.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_vertical_distribute_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_vertical_distribute_disable.svg new file mode 100644 index 0000000000..4c799c85cf --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/arrange/arrange_vertical_distribute_disable.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json b/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json index 3d09c571bf..475c24d733 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json @@ -472,7 +472,14 @@ "layout_top_right": "layout/layout_top_right.svg", "theme_edit": "theme_edit.svg", "folder_half_authority" : "filetree/folder_half_authority.svg", - "folder_half_authority_open" : "filetree/folder_half_authority_open.svg" - + "folder_half_authority_open" : "filetree/folder_half_authority_open.svg", + "arrange_left_align": "arrange/arrange_left_align.svg", + "arrange_horizontal_center": "arrange/arrange_horizontal_center.svg", + "arrange_right_align": "arrange/arrange_right_align.svg", + "arrange_top_align": "arrange/arrange_top_align.svg", + "arrange_vertical_center": "arrange/arrange_vertical_center.svg", + "arrange_bottom_align": "arrange/arrange_bottom_align.svg", + "arrange_horizontal_distribute": "arrange/arrange_horizontal_distribute.svg", + "arrange_vertical_distribute": "arrange/arrange_vertical_distribute.svg" } } diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties index 34e9f8e3c5..0adc8cf686 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties @@ -302,6 +302,7 @@ ColorChooser.swatchesDefaultRecentColor = $control ComboBox.border = com.fine.theme.light.ui.FineRoundBorder ComboBox.padding = @componentMargin ComboBox.minimumWidth = 72 +ComboBox.maximumWidth = 400 ComboBox.editorColumns = 0 ComboBox.maximumRowCount = 15 [mac]ComboBox.showPopupOnNavigation = true diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java index 0334044235..970b5ea9fc 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java @@ -1,7 +1,6 @@ package com.fr.design.chartx.component; import com.fine.theme.icon.LazyIcon; -import com.fine.theme.utils.FineLayoutBuilder; import com.fine.theme.utils.FineUIUtils; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.chartx.TwoTuple; @@ -48,8 +47,8 @@ import java.awt.event.ItemListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX; -import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; import static com.fine.theme.utils.FineUIScale.scale; /** @@ -102,12 +101,13 @@ public class MapAreaMatchPane extends BasicBeanPane { } private JPanel createContentPane() { - tableNameCombox.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX); - areaNameBox.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX); - return FineLayoutBuilder.createHorizontalLayout(10, - new UILabel(Toolkit.i18nText("Fine-Design_Chart_Table_Data") + ":"), tableNameCombox, - new UILabel(Toolkit.i18nText("Fine-Design_Chart_Area_Name") + ":"), areaNameBox, - refreshLabel); + return row(10, + cell(new UILabel(Toolkit.i18nText("Fine-Design_Chart_Table_Data") + ":")), + cell(tableNameCombox).weight(1), + cell(new UILabel(Toolkit.i18nText("Fine-Design_Chart_Area_Name") + ":")), + cell(areaNameBox).weight(1), + cell(refreshLabel) + ).getComponent(); } private void initTable(TwoTuple> treeNodeAndItems) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/AbstractMultiSelectionArrangementButton.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/AbstractMultiSelectionArrangementButton.java index 9474295049..2bfd21a30c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/AbstractMultiSelectionArrangementButton.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/AbstractMultiSelectionArrangementButton.java @@ -1,10 +1,13 @@ package com.fr.design.mainframe.widget.arrangement.buttons; +import com.fine.theme.icon.LazyIcon; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.mainframe.MultiSelectionArrangement; +import com.fr.stable.StringUtils; +import javax.swing.Icon; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -16,11 +19,21 @@ public abstract class AbstractMultiSelectionArrangementButton extends UIButton i public AbstractMultiSelectionArrangementButton(MultiSelectionArrangement arrangement) { super(); this.arrangement = arrangement; - this.setNormalPainted(false); - this.setBorderPaintedOnlyWhenPressed(true); - this.setIcon(getIcon()); this.setToolTipText(getTipText()); this.addActionListener(getActionListener()); + setBorderPainted(false); + setBackground(null); + setBackground(null); + } + + @Override + public Icon getIcon() { + LazyIcon icon = new LazyIcon(getIconId()); + return isEnabled() ? icon : icon.disabled(); + } + + public String getIconId() { + return StringUtils.EMPTY; } @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/BottomAlignButton.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/BottomAlignButton.java index 97974298a5..8cacba2055 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/BottomAlignButton.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/BottomAlignButton.java @@ -3,9 +3,6 @@ package com.fr.design.mainframe.widget.arrangement.buttons; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.ArrangementType; import com.fr.design.mainframe.MultiSelectionArrangement; -import com.fr.general.IOUtils; - -import javax.swing.Icon; public class BottomAlignButton extends AbstractMultiSelectionArrangementButton { private static final long serialVersionUID = 2397455240682353024L; @@ -15,8 +12,8 @@ public class BottomAlignButton extends AbstractMultiSelectionArrangementButton { } @Override - public Icon getIcon() { - return IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_bottom_align.png"); + public String getIconId() { + return "arrange_bottom_align"; } @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalCenterButton.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalCenterButton.java index ec8f315df2..d55cd0b0c9 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalCenterButton.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalCenterButton.java @@ -3,9 +3,6 @@ package com.fr.design.mainframe.widget.arrangement.buttons; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.ArrangementType; import com.fr.design.mainframe.MultiSelectionArrangement; -import com.fr.general.IOUtils; - -import javax.swing.Icon; public class HorizontalCenterButton extends AbstractMultiSelectionArrangementButton { private static final long serialVersionUID = 6290178236460051049L; @@ -15,8 +12,8 @@ public class HorizontalCenterButton extends AbstractMultiSelectionArrangementBut } @Override - public Icon getIcon() { - return IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_horizontal_center_align.png"); + public String getIconId() { + return "arrange_horizontal_center"; } @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalDistributionButton.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalDistributionButton.java index 0702248ed4..3b2c057b41 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalDistributionButton.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalDistributionButton.java @@ -3,9 +3,6 @@ package com.fr.design.mainframe.widget.arrangement.buttons; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.ArrangementType; import com.fr.design.mainframe.MultiSelectionArrangement; -import com.fr.general.IOUtils; - -import javax.swing.Icon; public class HorizontalDistributionButton extends AbstractMultiSelectionArrangementButton { private static final long serialVersionUID = 5052092252720664954L; @@ -15,8 +12,8 @@ public class HorizontalDistributionButton extends AbstractMultiSelectionArrangem } @Override - public Icon getIcon() { - return IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_horizontal_auto_spacing.png"); + public String getIconId() { + return "arrange_horizontal_distribute"; } @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/LeftAlignButton.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/LeftAlignButton.java index 02a6a2c796..09f2a282cd 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/LeftAlignButton.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/LeftAlignButton.java @@ -3,9 +3,6 @@ package com.fr.design.mainframe.widget.arrangement.buttons; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.ArrangementType; import com.fr.design.mainframe.MultiSelectionArrangement; -import com.fr.general.IOUtils; - -import javax.swing.Icon; public class LeftAlignButton extends AbstractMultiSelectionArrangementButton { private static final long serialVersionUID = -8177637788632733710L; @@ -15,8 +12,8 @@ public class LeftAlignButton extends AbstractMultiSelectionArrangementButton { } @Override - public Icon getIcon() { - return IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_left_align.png"); + public String getIconId() { + return "arrange_left_align"; } @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/RightAlignButton.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/RightAlignButton.java index 1b047b6ba8..2112758564 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/RightAlignButton.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/RightAlignButton.java @@ -3,9 +3,6 @@ package com.fr.design.mainframe.widget.arrangement.buttons; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.ArrangementType; import com.fr.design.mainframe.MultiSelectionArrangement; -import com.fr.general.IOUtils; - -import javax.swing.Icon; public class RightAlignButton extends AbstractMultiSelectionArrangementButton { private static final long serialVersionUID = -8698936349956288409L; @@ -15,8 +12,8 @@ public class RightAlignButton extends AbstractMultiSelectionArrangementButton { } @Override - public Icon getIcon() { - return IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_right_align.png"); + public String getIconId() { + return "arrange_right_align"; } @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/TopAlignButton.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/TopAlignButton.java index 0adfb9378e..fb551282d7 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/TopAlignButton.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/TopAlignButton.java @@ -3,9 +3,6 @@ package com.fr.design.mainframe.widget.arrangement.buttons; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.ArrangementType; import com.fr.design.mainframe.MultiSelectionArrangement; -import com.fr.general.IOUtils; - -import javax.swing.Icon; public class TopAlignButton extends AbstractMultiSelectionArrangementButton { private static final long serialVersionUID = 2896267783075870924L; @@ -15,8 +12,8 @@ public class TopAlignButton extends AbstractMultiSelectionArrangementButton { } @Override - public Icon getIcon() { - return IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_top_align.png"); + public String getIconId() { + return "arrange_top_align"; } @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalCenterButton.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalCenterButton.java index 4fb8b62a28..77c1255cbd 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalCenterButton.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalCenterButton.java @@ -3,9 +3,6 @@ package com.fr.design.mainframe.widget.arrangement.buttons; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.ArrangementType; import com.fr.design.mainframe.MultiSelectionArrangement; -import com.fr.general.IOUtils; - -import javax.swing.Icon; public class VerticalCenterButton extends AbstractMultiSelectionArrangementButton { public VerticalCenterButton(MultiSelectionArrangement arrangement) { @@ -13,8 +10,8 @@ public class VerticalCenterButton extends AbstractMultiSelectionArrangementButto } @Override - public Icon getIcon() { - return IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_vertical_center_align.png"); + public String getIconId() { + return "arrange_vertical_center"; } @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalDistributionButton.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalDistributionButton.java index 76dcf9427a..8906923c37 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalDistributionButton.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalDistributionButton.java @@ -3,9 +3,6 @@ package com.fr.design.mainframe.widget.arrangement.buttons; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.ArrangementType; import com.fr.design.mainframe.MultiSelectionArrangement; -import com.fr.general.IOUtils; - -import javax.swing.Icon; public class VerticalDistributionButton extends AbstractMultiSelectionArrangementButton { public VerticalDistributionButton(MultiSelectionArrangement arrangement) { @@ -13,8 +10,8 @@ public class VerticalDistributionButton extends AbstractMultiSelectionArrangemen } @Override - public Icon getIcon() { - return IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_vertical_auto_spacing.png"); + public String getIconId() { + return "arrange_vertical_distribute"; } @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java index cf59b595c5..b4c0776e38 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java @@ -1,5 +1,8 @@ package com.fr.design.mainframe.widget.ui; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineLayoutBuilder; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.ibutton.UIButton; @@ -24,7 +27,6 @@ import com.fr.general.IOUtils; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; @@ -43,93 +45,46 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane { public void initPropertyPane() { arrangement = new MultiSelectionArrangement(designer); - content.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 0)); content.add(createArrangementLayoutPane(), BorderLayout.CENTER); - this.listener = new AttributeChangeListener() { - @Override - public void attributeChange() { - designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_RESIZED); - } - }; + setBorder(new ScaledEmptyBorder(10, 0, 0, 0)); + this.listener = () -> designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_RESIZED); } - // 整个排列分布面板的layout,可以看成一个三行一列的表格,第一行是分布,第二行是自动间距,第三行是手动间距 + /** + * 整个排列分布面板的layout,可以看成一个两行一列的表格,第一行是分布,第二行是自动间距 + */ private JPanel createArrangementLayoutPane() { - double[] rowSize = {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED}; - double[] columnSize = {TableLayout.PREFERRED}; - Component[][] components = new Component[][] { - new Component[] { - createAlignmentPane() - }, - new Component[] { - createAutoSpacingPane() - } - }; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 16); + return FineLayoutBuilder.createVerticalLayout(10, createAlignmentPane(), createAutoSpacingPane()); } // 对齐 private JPanel createAlignmentPane() { - double[] rowSize = {TableLayout.PREFERRED}; - double[] columnSize = { - TableLayout.PREFERRED, - TableLayout.PREFERRED, - TableLayout.PREFERRED, - TableLayout.PREFERRED, - TableLayout.PREFERRED, - TableLayout.PREFERRED - }; - Component[][] components = new Component[][] { - new Component[] { - new LeftAlignButton(arrangement), - new HorizontalCenterButton(arrangement), - new RightAlignButton(arrangement), - new TopAlignButton(arrangement), - new VerticalCenterButton(arrangement), - new BottomAlignButton(arrangement) - } - }; - JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 18, 0); + JPanel centerPane = FineLayoutBuilder.createHorizontalLayout(16, + new LeftAlignButton(arrangement), + new HorizontalCenterButton(arrangement), + new RightAlignButton(arrangement), + new TopAlignButton(arrangement), + new VerticalCenterButton(arrangement), + new BottomAlignButton(arrangement)); + return createTitleLayout(Toolkit.i18nText("Fine-Design_Multi_Selection_Align"), centerPane); } // 自动间距 private JPanel createAutoSpacingPane() { - double[] rowSize = {TableLayout.PREFERRED}; - double[] columnSize = { - TableLayout.PREFERRED, - TableLayout.PREFERRED - }; UIButton horizontalAutoSpacingBtn = new HorizontalDistributionButton(arrangement); UIButton verticalAutoSpacingBtn = new VerticalDistributionButton(arrangement); if (designer.getSelectionModel().getSelection().size() < 3) { horizontalAutoSpacingBtn.setEnabled(false); verticalAutoSpacingBtn.setEnabled(false); } - Component[][] components = new Component[][] { - new Component[] { - horizontalAutoSpacingBtn, - verticalAutoSpacingBtn - } - }; - JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 18, 0); + JPanel centerPane = FineLayoutBuilder.createHorizontalLayout(16, horizontalAutoSpacingBtn, verticalAutoSpacingBtn); - - UILabel tip = new UILabel(IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_auto_spacing_tip.png")); + UILabel tip = new UILabel(new LazyIcon("jumpHelp", 12)); tip.setToolTipText(Toolkit.i18nText("Fine-Design_Multi_Selection_Auto_Spacing_Tip")); - Component[][] titleComponents = new Component[][] { - new Component[] { - new UILabel(Toolkit.i18nText("Fine-Design_Multi_Selection_Auto_Spacing")), - tip - } - }; - JPanel northPane = TableLayoutHelper.createGapTableLayoutPane(titleComponents, rowSize, columnSize, 5, 0); + JPanel northPane = FineLayoutBuilder.createHorizontalLayout(5, new UILabel(Toolkit.i18nText("Fine-Design_Multi_Selection_Auto_Spacing")), tip); - JPanel jPanel = new JPanel(); - jPanel.setLayout(new BorderLayout(0, 8)); - jPanel.add(northPane, BorderLayout.NORTH); - jPanel.add(centerPane, BorderLayout.CENTER); - return jPanel; + return FineLayoutBuilder.createVerticalLayout(10, northPane, centerPane); } // 手动间距 @@ -195,13 +150,11 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane { } } - // 创建一个BorderLayout布局,上面是标题,例如“对齐”,下面是个容器 + /** + * 创建一个面板,上面是标题,例如“对齐”,下面是个容器 + */ private JPanel createTitleLayout(String title, JPanel centerPane) { - JPanel jPanel = new JPanel(); - jPanel.setLayout(new BorderLayout(0, 8)); - jPanel.add(new UILabel(title), BorderLayout.NORTH); - jPanel.add(centerPane, BorderLayout.CENTER); - return jPanel; + return FineLayoutBuilder.createVerticalLayout(10, new UILabel(title), centerPane); } @Override diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/DesignFunctionComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/DesignFunctionComponent.java index 63de9d0d27..f1608a8f52 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/DesignFunctionComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/DesignFunctionComponent.java @@ -1,6 +1,5 @@ package com.fanruan.boot.env; -import com.fanruan.carina.annotions.ActivatorRefer; import com.fanruan.carina.annotions.DependsOn; import com.fanruan.carina.annotions.FineComponent; import com.fanruan.carina.annotions.Start; diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignAnalyzerComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignAnalyzerComponent.java index 3403f28df9..783180952a 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignAnalyzerComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignAnalyzerComponent.java @@ -7,47 +7,13 @@ import com.fanruan.carina.annotions.FineComponent; import com.fanruan.carina.annotions.Start; import com.fanruan.carina.annotions.Supplemental; import com.fanruan.carina.core.partition.ResourceAffiliate; -import com.fr.base.OptimizeUtil; -import com.fr.collect.Collect; -import com.fr.concurrent.NamedThreadFactory; -import com.fr.design.constants.DesignerLaunchStatus; -import com.fr.design.record.analyzer.DesignerAnalyzer; -import com.fr.design.record.analyzer.Interceptor.CollectInterceptor; -import com.fr.design.record.analyzer.advice.CollectAdvice; -import com.fr.design.record.analyzer.advice.DBMonitorAdvice; -import com.fr.design.record.analyzer.advice.FaultToleranceAdvice; -import com.fr.design.record.analyzer.advice.FocusAdvice; -import com.fr.design.record.analyzer.advice.MonitorAdvice; -import com.fr.design.record.analyzer.advice.PerformancePointAdvice; -import com.fr.event.Event; -import com.fr.event.EventDispatcher; -import com.fr.event.Listener; -import com.fr.event.Null; -import com.fr.intelli.metrics.Compute; -import com.fr.intelli.record.Focus; -import com.fr.intelli.record.PerformancePoint; -import com.fr.jvm.assist.FineAssist; import com.fr.record.analyzer.AnalyzerConfiguration; -import com.fr.record.analyzer.AnalyzerKey; -import com.fr.record.analyzer.Assistant; -import com.fr.record.analyzer.DBMetrics; -import com.fr.record.analyzer.FineAnalyzer; -import com.fr.record.analyzer.advice.AnalyzerAdviceKey; import com.fr.record.analyzer.advice.FineAdviceAssistant; import com.fr.record.analyzer.configuration.AnalyzerAssemblyFactory; import com.fr.record.analyzer.configuration.FineAnalyzerAssemblyFactory; -import com.fr.stable.collections.CollectionUtils; -import com.fr.third.net.bytebuddy.description.type.TypeDescription; -import com.fr.third.net.bytebuddy.dynamic.DynamicType; -import com.fr.third.net.bytebuddy.implementation.MethodDelegation; -import com.fr.third.net.bytebuddy.matcher.ElementMatchers; -import com.fr.third.net.bytebuddy.utility.JavaModule; -import com.fr.tolerance.FaultTolerance; import org.jetbrains.annotations.NotNull; -import java.util.ArrayList; import java.util.List; -import java.util.concurrent.ExecutorService; /** * 设计器埋点及分析组件 diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java index 688f4079e0..ce2e398b2e 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java @@ -43,9 +43,11 @@ import com.fr.decision.webservice.v10.datasource.dataset.processor.impl.DataSetP import com.fr.design.data.datapane.connect.LocalConnectionSource; import com.fr.design.data.tabledata.LocalTableDataSource; import com.fr.file.TableDataConfigWrapper; +import com.fr.workspace.server.repository.connection.ConnectionRepository; import com.fr.workspace.server.repository.connection.ConnectionWriterShell; import com.fr.workspace.server.repository.connection.LocalConnectionShell; import com.fr.workspace.server.repository.tabledata.LocalTableDataShell; +import com.fr.workspace.server.repository.tabledata.TableDataRepository; /** @@ -102,7 +104,8 @@ public class DesignDatasourceComponent extends DatasourceComponent { */ @Stop public void stop() { - + ConnectionRepository.getInstance().invalidCache(); + TableDataRepository.getInstance().invalidCache(); } /** diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignAppComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignAppComponent.java index 55ceb2de9d..aec58e3e81 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignAppComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignAppComponent.java @@ -10,6 +10,7 @@ import com.fr.design.mainframe.App; import com.fr.design.mainframe.AppGroup; import com.fr.design.mainframe.JTemplateFactory; import com.fr.nx.app.designer.CptxApp; +import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; import java.util.ArrayList; import java.util.List; @@ -43,7 +44,7 @@ public class DesignAppComponent { */ @Stop public void stop() { - + RemoteAuthorityRepository.getInstance().invalidCache(); List appList = new ArrayList<>(Carina.getApplicationContext().group(AppGroup.class).getAll()); for (App app : appList) { JTemplateFactory.remove(app); diff --git a/designer-realize/src/main/java/com/fanruan/boot/pre/DesignPreStartComponent.java b/designer-realize/src/main/java/com/fanruan/boot/pre/DesignPreStartComponent.java index 3ad246a9a8..7f64f751c8 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/pre/DesignPreStartComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/pre/DesignPreStartComponent.java @@ -1,12 +1,6 @@ package com.fanruan.boot.pre; import com.fanruan.boot.FSProperties; -import com.fanruan.fs.FileServer; -import com.fanruan.fs.RepositoryFactory; -import com.fanruan.fs.repository.local.LocalFileRepository; -import com.fanruan.product.ProductConstants; -import com.fr.decision.inject.node.impl.DecisionSystemInjectNode; -import com.fr.design.ConfigHelper; import com.fanruan.boot.key.StartupArgsShell; import com.fanruan.carina.Carina; import com.fanruan.carina.annotions.FineComponent; @@ -18,11 +12,17 @@ import com.fanruan.config.impl.ShareConfigProviderImpl; import com.fanruan.config.realm.ConfigRealm; import com.fanruan.config.realm.ConfigRepositoryFactory; import com.fanruan.config.realm.local.LocalConfigRepositoryBuilder; +import com.fanruan.fs.FileServer; +import com.fanruan.fs.RepositoryFactory; +import com.fanruan.fs.repository.local.LocalFileRepository; import com.fanruan.mq.CarinaMQ; import com.fanruan.mq.InternalMQProvider; +import com.fanruan.product.ProductConstants; import com.fr.base.function.UITerminator; import com.fr.carina.util.CarinaResourceUtils; import com.fr.carina.util.provider.CarinaResourceProvider; +import com.fr.decision.inject.node.impl.DecisionSystemInjectNode; +import com.fr.design.ConfigHelper; import com.fr.design.DesignerEnvManager; import com.fr.design.constants.DesignerLaunchStatus; import com.fr.design.deeplink.DeepLinkManager; @@ -47,7 +47,6 @@ import com.fr.module.engine.event.LifecycleErrorEvent; import com.fr.runtime.FineRuntime; import com.fr.stable.CommonCodeUtils; import com.fr.stable.CommonUtils; -import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.lifecycle.FineLifecycleFatalError; import com.fr.stable.project.ProjectConstants; diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewWorkBookAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewWorkBookAction.java index ec8e28cad6..5f41bd5f89 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewWorkBookAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewWorkBookAction.java @@ -3,7 +3,6 @@ package com.fr.design.actions.file.newReport; import com.fine.theme.icon.LazyIcon; import com.fr.design.actions.UpdateAction; -import com.fr.design.cache.DesignCacheManager; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.MenuKeySet; @@ -35,7 +34,7 @@ public class NewWorkBookAction extends UpdateAction { * @param e 事件 */ public void actionPerformed(ActionEvent e) { - DesignCacheManager.processByCacheTableData(() -> DesignerContext.getDesignerFrame().addAndActivateJTemplate(new JWorkBook())); + DesignerContext.getDesignerFrame().addAndActivateJTemplate(new JWorkBook()); } public static final MenuKeySet NEW_WORK_BOOK = new MenuKeySet() { diff --git a/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java b/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java index 2fc42d01a5..f722725a6d 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java @@ -667,7 +667,7 @@ public class EditToolBar extends BasicPane { this.icon.setSelected(button.isShowIcon()); this.text.setSelected(button.isShowText()); this.nameField.setText(button.getText()); - this.iconPane.populateIcon(((Button) widget).getIconName(), icon); + this.iconPane.populate(((Button) widget).getIconName()); } /** diff --git a/designer-realize/src/main/java/com/fr/design/webattr/ToolBarButton.java b/designer-realize/src/main/java/com/fr/design/webattr/ToolBarButton.java index e375289d63..c1efe6397f 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/ToolBarButton.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/ToolBarButton.java @@ -1,6 +1,6 @@ package com.fr.design.webattr; -import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIScale; import com.fr.base.vcs.DesignerMode; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.mainframe.DesignerContext; @@ -8,16 +8,22 @@ import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.core.WidgetOption; import com.fr.form.ui.Widget; +import com.fr.stable.StringUtils; +import com.fr.form.ui.WidgetInfoConfig; import java.awt.Insets; import java.awt.Graphics; +import java.awt.Image; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.Icon; +import javax.swing.ImageIcon; public class ToolBarButton extends UIButton implements MouseListener { private Widget widget; private WidgetOption no; + private final int ICON_WIDTH = FineUIScale.scale(16); + private final int ICON_HEIGHT = FineUIScale.scale(16); public ToolBarButton(Icon icon, Widget widget) { this(null, icon, widget); @@ -30,15 +36,30 @@ public class ToolBarButton extends UIButton implements MouseListener { public ToolBarButton(String text, Icon icon, Widget widget) { super(text, icon); this.widget = widget; - //直接设置Icon图标 - setIcon(icon); - if (icon instanceof LazyIcon) { - setDisabledIcon(((LazyIcon) icon).disabled()); + if (widget instanceof com.fr.form.ui.Button) { + com.fr.form.ui.Button button = (com.fr.form.ui.Button) widget; + String iconName = button.getIconName(); + if (StringUtils.isNotEmpty(iconName)) { + Image iimage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(iconName); + if (iimage != null) { + setIcon(new ImageIcon(iimage)); + } + } } this.addMouseListener(this); setMargin(new Insets(0, 0, 0, 0)); } + @Override + public void setIcon(Icon icon) { + if (icon instanceof ImageIcon) { + //自定义上传的图标在设计器工具栏显示需要按照16*16进行缩放 + Image originalImage = ((ImageIcon) icon).getImage(); + Image scaledImage = originalImage.getScaledInstance(ICON_WIDTH, ICON_HEIGHT, Image.SCALE_SMOOTH); + icon = new ImageIcon(scaledImage); + } + super.setIcon(icon); + } /** * 改变按钮的权限细粒度状态 diff --git a/designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java b/designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java index ef228699f6..bb05139af8 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java @@ -154,7 +154,7 @@ public class ToolBarPane extends BasicBeanPane { this.validate(); this.repaint(); } -// this.getFToolBar().setBackground(toolbar.getBackground()); + this.getFToolBar().setBackground(toolbar.getBackground()); this.getFToolBar().setDefault(toolbar.isDefault()); this.getFToolBar().setButtonBgColorMode(toolbar.getButtonBgColorMode()); setPopulateFinished(true); diff --git a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java index fffdbbbb59..92674958e2 100644 --- a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java +++ b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java @@ -12,6 +12,7 @@ import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.editor.ValueEditorPaneFactory; +import com.fr.design.editor.editor.Editor; import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.ilable.UILabel; @@ -47,7 +48,9 @@ import java.awt.Component; import java.awt.Container; import java.awt.Dialog; import java.awt.event.ActionEvent; +import java.awt.event.MouseEvent; import java.util.ArrayList; +import java.util.EventObject; import java.util.List; import static com.fine.theme.utils.FineUIScale.scale; @@ -374,7 +377,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { ColumnRowGroupCellRenderer2 cellRenderer2 = new ColumnRowGroupCellRenderer2(); cellRenderer2.setHorizontalAlignment(SwingConstants.LEFT); column2.setCellRenderer(cellRenderer2); - column2.setCellEditor(new ColumnValueEditor(ValueEditorPaneFactory.cellGroupEditor())); + column2.setCellEditor(new SmartColumnValueEditor(ValueEditorPaneFactory.cellGroupEditor())); } else { SelectedColumnValueTableCellRenderer renderer = new SelectedColumnValueTableCellRenderer(); renderer.setHorizontalAlignment(SwingConstants.LEFT); @@ -612,4 +615,24 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { } } } + + protected class SmartColumnValueEditor extends ColumnValueEditor { + + protected SmartColumnValueEditor(Editor[] types) { + super(types); + } + + /** + * 双击修改 + * @param anEvent 事件 + * @return 是否可编辑 + */ + @Override + public boolean isCellEditable(EventObject anEvent) { + if (anEvent instanceof MouseEvent) { + return ((MouseEvent) anEvent).getClickCount() >= 2; + } + return true; + } + } }