diff --git a/designer-base/src/main/java/com/fine/theme/icon/IconManager.java b/designer-base/src/main/java/com/fine/theme/icon/IconManager.java index aa2ef8b173..01f722e24b 100644 --- a/designer-base/src/main/java/com/fine/theme/icon/IconManager.java +++ b/designer-base/src/main/java/com/fine/theme/icon/IconManager.java @@ -1,5 +1,8 @@ package com.fine.theme.icon; +import com.fine.theme.icon.plugin.PluginIconSet; +import com.fine.theme.light.ui.FineLightIconSet; +import com.formdev.flatlaf.FlatLaf; import com.fr.base.extension.FileExtension; import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; @@ -8,10 +11,13 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.Icon; +import javax.swing.LookAndFeel; +import javax.swing.UIManager; import java.awt.Dimension; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; /** * 图标管理器 @@ -26,12 +32,42 @@ import java.util.HashMap; */ @Immutable public class IconManager { - public static final String ICON_DISABLE_SUFFIX = "_disable"; public static final Dimension DEFAULT_DIMENSION = new Dimension(16, 16); - private static final ArrayList ICON_SETS = new ArrayList<>(2); + private static final ArrayList ICON_SETS = new ArrayList<>(); private static final HashMap> CACHE = new HashMap<>(64); + /** + * 初始化 Icon:FineIcon、PluginIcon + */ + public static void initializeIcon() { + addIconSet(); + } + + /** + * 切换 Icon + */ + public static void updateIcon() { + ICON_SETS.clear(); + clearCache(); + addIconSet(); + } + + private static void addIconSet() { + boolean dark = false; + LookAndFeel laf = UIManager.getLookAndFeel(); + if (laf instanceof FlatLaf) { + dark = ((FlatLaf) laf).isDark(); + } + if (dark) { + // dark 主题还没适配 + addSet(new FineLightIconSet()); + } else { + addSet(new FineLightIconSet()); + } + addSet(new PluginIconSet()); + } + /** * 获取图标集 @@ -40,10 +76,17 @@ public class IconManager { * @return 图标集 */ public static IconSet getSet(String id) { + IconSet iconSet = null; for (IconSet set : ICON_SETS) { if (set.getId().equals(id)) { - return set; + iconSet = set; } + if (set instanceof PluginIconSet && iconSet == null) { + iconSet = PluginIconSet.getIconSet(id); + } + } + if (iconSet != null) { + return iconSet; } throw new IconException("[IconManager] Can not find icon set by id: " + id); } diff --git a/designer-base/src/main/java/com/fine/theme/icon/plugin/PluginIconSet.java b/designer-base/src/main/java/com/fine/theme/icon/plugin/PluginIconSet.java new file mode 100644 index 0000000000..39d8c04112 --- /dev/null +++ b/designer-base/src/main/java/com/fine/theme/icon/plugin/PluginIconSet.java @@ -0,0 +1,127 @@ +package com.fine.theme.icon.plugin; + +import com.fine.theme.icon.AbstractIconSet; +import com.fine.theme.icon.IconSet; +import com.fine.theme.icon.IconType; +import com.fine.theme.icon.JsonIconSet; +import com.fine.theme.icon.UrlIconResource; +import com.formdev.flatlaf.FlatLaf; +import com.fr.design.fun.LazyIconProvider; +import com.fr.general.GeneralContext; +import com.fr.plugin.manage.PluginFilter; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; +import com.fr.plugin.observer.PluginEventType; +import com.fr.stable.AssistUtils; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import javax.swing.Icon; +import javax.swing.LookAndFeel; +import javax.swing.UIManager; +import java.awt.Dimension; +import java.util.ArrayList; +import java.util.Set; +import java.util.function.Consumer; + + +/** + * 管理插件 iconSet + * @author lemon + * @since + * Created on + */ +public class PluginIconSet extends AbstractIconSet { + + private static final String NAME = "Plugin Icon Set"; + private static final ArrayList PLUGIN_ICON_SETS = new ArrayList<>(); + + public PluginIconSet() { + name = NAME; + listenPluginIcons(); + } + + /** + * 适配插件图标 Icon + */ + public static void listenPluginIcons() { + //注册插件监听 + PluginFilter filter = context -> context.contain(LazyIconProvider.MARK_STRING); + + PluginEventListener insert = new PluginEventListener() { + @Override + public void on(PluginEvent event) { + handlePluginEvent(event, (provider) -> PLUGIN_ICON_SETS.add(generateJsonIconSet(provider))); + } + }; + + PluginEventListener remove = new PluginEventListener() { + @Override + public void on(PluginEvent event) { + handlePluginEvent(event, (provider) -> PLUGIN_ICON_SETS.removeIf(iconSet -> iconSet.getId().equals(provider.pluginId()))); + } + }; + + GeneralContext.listenPlugin(PluginEventType.AfterRun, insert, filter); + GeneralContext.listenPlugin(PluginEventType.AfterInstall, insert, filter); + GeneralContext.listenPlugin(PluginEventType.AfterForbid, remove, filter); + GeneralContext.listenPlugin(PluginEventType.AfterUninstall, remove, filter); + } + + private static void handlePluginEvent(PluginEvent event, Consumer consumer) { + Set set = event.getContext().getRuntime().get(LazyIconProvider.MARK_STRING); + for (LazyIconProvider provider : set) { + consumer.accept(provider); + } + } + + private static JsonIconSet generateJsonIconSet(LazyIconProvider provider) { + LookAndFeel laf = UIManager.getLookAndFeel(); + boolean dark = ((FlatLaf) laf).isDark(); + String jsonPath = dark ? provider.darkJsonPath() : provider.lightJsonPath(); + return new JsonIconSet(new UrlIconResource(jsonPath)) { + @Override + public @NotNull String getId() { + return provider.pluginId(); + } + }; + } + + @Override + public @Nullable Icon findIcon(@NotNull String id, @NotNull Dimension dimension, IconType type) { + Icon icon; + for (IconSet iconSet : PLUGIN_ICON_SETS) { + icon = iconSet.findIcon(id, dimension, type); + if (icon != null) { + return icon; + } + } + return null; + } + + /** + * 根据 id 匹配 icon set + * @param id 对于 plugin icon set, id 是 plugin_id + * @return icon set + */ + public static IconSet getIconSet(@NotNull final String id ) { + for (IconSet iconSet : PLUGIN_ICON_SETS) { + if (iconSet.getId().equals(id)) { + return iconSet; + } + } + return null; + } + + + @Override + public boolean equals(Object obj) { + return obj instanceof PluginIconSet + && AssistUtils.equals(this.name, ((PluginIconSet) obj).name); + } + + @Override + public int hashCode() { + return AssistUtils.hashCode(name); + } +} diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineDarkLaf.java b/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineDarkLaf.java index e568f5af32..0af36de488 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineDarkLaf.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineDarkLaf.java @@ -2,7 +2,6 @@ package com.fine.theme.light.ui.laf; import com.fine.swing.ui.layout.Layouts; import com.fine.theme.icon.IconManager; -import com.fine.theme.light.ui.FineLightIconSet; import com.formdev.flatlaf.util.UIScale; import com.fr.stable.StringUtils; @@ -25,7 +24,7 @@ public class FineDarkLaf extends FineLaf { * @return 是否安装成功 */ public static boolean setup() { - IconManager.addSet(new FineLightIconSet()); + IconManager.initializeIcon(); Layouts.setScaleFactor(UIScale.getUserScaleFactor()); UIScale.addPropertyChangeListener(evt -> { if (StringUtils.equals(evt.getPropertyName(), USER_SCALE_FACTOR)) { diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLaf.java b/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLaf.java index edb038dd0f..aa67a7d2ca 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLaf.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLaf.java @@ -18,7 +18,6 @@ public abstract class FineLaf extends FlatLaf { private static final String NAME = "FineLaf"; - @Override public String getName() { return NAME; @@ -53,4 +52,5 @@ public abstract class FineLaf extends FlatLaf { System.setProperty("flatlaf.menuBarEmbedded", "false"); } } + } diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLightLaf.java b/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLightLaf.java index 9e95b76f7e..5ccc51a8b1 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLightLaf.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLightLaf.java @@ -2,7 +2,6 @@ package com.fine.theme.light.ui.laf; import com.fine.swing.ui.layout.Layouts; import com.fine.theme.icon.IconManager; -import com.fine.theme.light.ui.FineLightIconSet; import com.formdev.flatlaf.util.UIScale; import com.fr.stable.StringUtils; @@ -25,7 +24,7 @@ public class FineLightLaf extends FineLaf { * @return 是否安装成功 */ public static boolean setup() { - IconManager.addSet(new FineLightIconSet()); + IconManager.initializeIcon(); Layouts.setScaleFactor(UIScale.getUserScaleFactor()); UIScale.addPropertyChangeListener(evt -> { if (StringUtils.equals(evt.getPropertyName(), USER_SCALE_FACTOR)) { diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java index 4229b54036..49af47f2ca 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java @@ -332,7 +332,7 @@ public class ChoosePane extends BasicBeanPane implements Refresha List authConnections = getHasAuthConnections(); for (String name : authConnections) { if (ComparatorUtils.equals(selectedDSName, name)) { - return ConnectionRepository.getInstance().getByName(name).getConnection(); + return ConnectionInfoBeanHelper.createConnection(ConnectionRepository.getInstance().getByName(name)); } } return null; @@ -442,7 +442,7 @@ public class ChoosePane extends BasicBeanPane implements Refresha boolean connect = false; com.fr.data.impl.Connection database = null; try { - database = ConnectionRepository.getInstance().getByName(paras.getDatabaseName()).getConnection(); + database = ConnectionInfoBeanHelper.createConnection(ConnectionRepository.getInstance().getByName(paras.getDatabaseName())); } catch (Exception e) { FineLoggerFactory.getLogger().info(e.getMessage(), e); } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTree.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTree.java index ca7cb38b4b..b1877fa75e 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTree.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTree.java @@ -64,11 +64,11 @@ public class TableDataTree extends UserObjectRefreshJTree { } else if (nameObject.getObject() instanceof Integer) { int num = (Integer) nameObject.getObject(); if (num == TableDataSourceOP.SERVER_TABLE_DATA) { - this.setIcon(IconUtils.readIcon(IconPathConstants.STD_SHOW_ICON_PATH)); + this.setIcon(new LazyIcon("server_database")); } else if (num == TableDataSourceOP.STORE_PRECEDURE_DATA) { - this.setIcon(IconUtils.readIcon(IconPathConstants.SP_SHOW_ICON_PATH)); + this.setIcon(new LazyIcon("store_procedure")); } else { - this.setIcon(IconUtils.readIcon(IconPathConstants.DS_QUERY_ICON_PATH)); + this.setIcon(new LazyIcon("database")); } } else { this.setIcon(new LazyIcon("store_procedure")); 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 bfad0a1850..1aaa2fb46a 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 @@ -41,11 +41,20 @@ public class LocalConnectionSource extends BaseConnectionSource { } @Override - public void testConnection(ConnectionInfoBean database) throws Exception { + public ConnectionInfoBean getByName(String name) { + try { + return ConnectionInfoBeanHelper.createConnectionInfoBean(name, ConnectionConfigProviderFactory.getConfigProvider().getConnection(name)); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @Override + public String[] testConnection(ConnectionInfoBean database) throws Exception { try { // 暂时这么处理,后续最好拉到外层包装一下 TransmissionEncryptionManager.setTransEncryptionLevel(1); - ConnectionProcessorFactory.testConnectionWithSchemaReturn(database); + return ConnectionProcessorFactory.testConnectionWithSchemaReturn(database); } catch (DriverNotFoundException e) { throw new DriverUnExistException(); } finally { diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java index 10cd4e5e2f..62e6666acd 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java @@ -146,7 +146,7 @@ public class SslPane extends BasicPane { @Override public void actionPerformed(ActionEvent e) { - FILEChooserPane fileChooser = FILEChooserPane.getInstanceWithDesignatePath(SslUtils.PREFIX, new ChooseFileFilter(true), SslUtils.CERTIFICATES); + FILEChooserPane fileChooser = FILEChooserPane.getFileCAChoosePane(new ChooseFileFilter(true)); int type = fileChooser.showOpenDialog(SslPane.this, StringUtils.EMPTY); if (type == FILEChooserPane.OK_OPTION) { final FILE file = fileChooser.getSelectedFILE(); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/ConnectionInfoBeanHelper.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/ConnectionInfoBeanHelper.java index 6ad25c57c6..26ae869fcd 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/ConnectionInfoBeanHelper.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/ConnectionInfoBeanHelper.java @@ -78,13 +78,29 @@ public class ConnectionInfoBeanHelper { return ans; } + /** + * 根据bean创建连接 + */ + public static Connection createConnection(ConnectionInfoBean infoBean) { + try { + if (JDBCConnectionProcessor.KEY.acceptConnectionTypes().contains(infoBean.getConnectionType())) { + return createJDBCConnection(infoBean); + } else { + return ConnectionProcessorFactory.createConnection(infoBean, true); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return null; + } + } + /** * 创建数据连接Bean,可自定义是否携带密码 */ public static ConnectionInfoBean createConnectionInfoBean(String name, Connection connection, boolean withPassword) throws Exception { if (connection instanceof NameDatabaseConnection) { name = ((NameDatabaseConnection) connection).getName(); - connection = ConnectionRepository.getInstance().getByName(name).getConnection(); + connection = createConnection(ConnectionRepository.getInstance().getByName(name)); } if (JDBCConnectionProcessor.KEY.acceptConnections().contains(connection.getClass())) { ConnectionInfoBean bean = new ConnectionInfoBean(); diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/LocalTableDataSource.java b/designer-base/src/main/java/com/fr/design/data/tabledata/LocalTableDataSource.java index 5c70a87536..25acc3da90 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/LocalTableDataSource.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/LocalTableDataSource.java @@ -7,9 +7,12 @@ import com.fr.decision.webservice.bean.dataset.FileDataSetBean; import com.fr.decision.webservice.bean.dataset.ServerDataSetBean; import com.fr.decision.webservice.bean.entry.FileNodeBean; import com.fr.decision.webservice.v10.datasource.dataset.processor.impl.FileProcessor; +import com.fr.decision.webservice.v10.file.FileNodeService; import com.fr.design.data.datapane.preview.TableDataBeanHelper; import com.fr.log.FineLoggerFactory; +import com.fr.stable.CommonUtils; import com.fr.stable.StringUtils; +import com.fr.stable.project.ProjectConstants; import com.fr.workspace.server.repository.tabledata.BaseTableDataSource; import java.util.ArrayList; @@ -67,6 +70,12 @@ public class LocalTableDataSource extends BaseTableDataSource { } } + @Override + public List getCertificatesFile(String keyword) throws Exception { + String pPath = CommonUtils.pathJoin(ProjectConstants.RESOURCES_NAME, ProjectConstants.CERTIFICATES_DIRECTORY); + return FileNodeService.getInstance().getAllRecursiveFileNodes(pPath, ProjectConstants.RESOURCES_NAME, keyword); + } + @Override public List getAllTableData() { diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java index a5ced9dfe0..e1d9263c90 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java @@ -20,6 +20,7 @@ import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.connect.ConnectionTableProcedurePane; import com.fr.design.data.datapane.connect.ConnectionTableProcedurePane.DoubleClickSelectedNodeOnTreeListener; +import com.fr.design.data.datapane.preview.ConnectionInfoBeanHelper; import com.fr.design.data.datapane.sqlpane.SQLEditPane; import com.fr.design.data.tabledata.ResponseDataSourceChange; import com.fr.design.data.tabledata.StoreProcedureWorkerListener; @@ -187,8 +188,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp } private boolean isAutoParameterDatabase() { - ConnectionBean bean = ConnectionRepository.getInstance().getByName(connectionTableProcedurePane.getSelectedDatabaseConnnectonName()); - Connection connection = bean == null ? null : bean.getConnection(); + Connection connection = ConnectionInfoBeanHelper.createConnection(ConnectionRepository.getInstance().getByName(connectionTableProcedurePane.getSelectedDatabaseConnnectonName())); return connection != null && ArrayUtils.contains(DRIVERS, connection.getDriver()); } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/ServerTableDataWrapper.java b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/ServerTableDataWrapper.java index fb02f1a3f8..4a07d9ab91 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/ServerTableDataWrapper.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/ServerTableDataWrapper.java @@ -6,6 +6,8 @@ import com.fr.base.svg.SVGLoader; import com.fr.data.impl.ClassTableData; import com.fr.data.impl.DBTableData; import com.fr.data.impl.EmbeddedTableData; +import com.fr.data.impl.FileTableData; +import com.fr.data.impl.MultiTDTableData; import com.fr.data.impl.RecursionTableData; import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.design.icon.WarningIcon; @@ -25,13 +27,10 @@ public final class ServerTableDataWrapper extends AbstractTableDataWrapper { @Override public Icon getIcon() { if (tabledata instanceof DBTableData) { - if (StringUtils.isBlank(((DBTableData) tabledata).getQuery())) { - return new LazyIcon("server_database_warning"); - } - else { - return new LazyIcon("server_database"); - } - } else if (tabledata instanceof ClassTableData) { + return getDBTableDataIcon(); + } + + if (tabledata instanceof ClassTableData) { return new LazyIcon("class_table_data"); } else if (tabledata instanceof EmbeddedTableData) { return new LazyIcon("data_table"); @@ -39,10 +38,23 @@ public final class ServerTableDataWrapper extends AbstractTableDataWrapper { return new LazyIcon("tree"); } else if (tabledata instanceof StoreProcedure) { return new LazyIcon("store_procedure"); - } + } else if (tabledata instanceof FileTableData) { + return new LazyIcon("file"); + } else if (tabledata instanceof MultiTDTableData) { + return new LazyIcon("multi"); + } return new LazyIcon("server_database"); } + private Icon getDBTableDataIcon() { + if (StringUtils.isBlank(((DBTableData) tabledata).getQuery())) { + return new LazyIcon("server_database_warning"); + } + else { + return new LazyIcon("server_database"); + } + } + /** * 是否异常 * @return diff --git a/designer-base/src/main/java/com/fr/design/fun/LazyIconProvider.java b/designer-base/src/main/java/com/fr/design/fun/LazyIconProvider.java new file mode 100644 index 0000000000..f51a2323d7 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/LazyIconProvider.java @@ -0,0 +1,39 @@ +package com.fr.design.fun; + +import com.fr.stable.fun.mark.Mutable; + +/** + * 插件图标适配接口 + * + * @author lemon + * @since + * Created on + */ +public interface LazyIconProvider extends Mutable { + String MARK_STRING = "LazyIconProvider"; + + int CURRENT_LEVEL = 1; + + /** + * 插件 id,icon 来源标识 + * + * @return 来源标识 + */ + String pluginId(); + + + /** + * light 主题 + * + * @return 图标注册 json 路径 + */ + String lightJsonPath(); + + /** + * dark 主题 + * + * @return 图标注册 json 路径 + */ + String darkJsonPath(); + +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractLazyIconProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractLazyIconProvider.java new file mode 100644 index 0000000000..916a100923 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractLazyIconProvider.java @@ -0,0 +1,59 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.LazyIconProvider; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; + +import java.util.List; + + +/** + * 插件图标 LazyIcon 加载适配抽象类 + * + * @author lemon + * @since + * Created on + */ +@API(level = LazyIconProvider.CURRENT_LEVEL) +public abstract class AbstractLazyIconProvider extends AbstractProvider implements LazyIconProvider { + + /** + * 当前接口的API等级,用于判断是否需要升级插件 + * @return API等级 + */ + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + /** + * 区分插件 + * + * @return 插件 id + */ + @Override + public String pluginId() { + throw new RuntimeException("plugin id is blank"); + } + + /** + * light 主题 + * + * @return 图标注册 json 路径 + */ + @Override + public String lightJsonPath() { + return ""; + } + + /** + * dark 主题 + * + * @return 图标注册 json 路径 + */ + @Override + public String darkJsonPath() { + return ""; + } + +} diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java index 7a1094ab17..a4b80242a9 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java @@ -30,6 +30,7 @@ import javax.swing.JPopupMenu; import javax.swing.ListCellRenderer; import javax.swing.ListSelectionModel; import javax.swing.SwingUtilities; +import javax.swing.UIManager; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import java.awt.BorderLayout; @@ -381,7 +382,7 @@ public abstract class JListControlPane extends JControlPane implements ListContr @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - setPreferredSize(new Dimension(list.getWidth(), FineUIScale.scale(24))); + setPreferredSize(new Dimension(list.getWidth(), FineUIScale.scale(UIManager.getInt("List.cellRender.height")))); if (value instanceof ListModelElement) { ListModelElement element = ((ListModelElement) value); Nameable nameable = element.wrapper; diff --git a/designer-base/src/main/java/com/fr/design/gui/ilist/JNameEdList.java b/designer-base/src/main/java/com/fr/design/gui/ilist/JNameEdList.java index 4c9135e151..7029fac1f8 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ilist/JNameEdList.java +++ b/designer-base/src/main/java/com/fr/design/gui/ilist/JNameEdList.java @@ -22,10 +22,10 @@ import java.util.Vector; public class JNameEdList extends UIList implements CellEditorListener { /** - * 原值为20,设计器图标由png替换为svg之后JNameEdList的icon大小为16x16 + * 原值为20,设计器图标由png替换为svg之后JNameEdList的icon大小为24x24 * 重命名是会出现左侧一部分带有背景色的渲染 */ - private static final int ICON_WIDTH = 16; + private static final int ICON_WIDTH = 24; private boolean editable = true; // kunsnat: 是否强制ListName是数字 (int型) @@ -240,7 +240,7 @@ public class JNameEdList extends UIList implements CellEditorListener { return false; } Rectangle rect = this.getCellBounds(index, index); - // alex:所有的JNameEdList都有Icon,空出前面20 * 20的位置就是放的Icon + // alex:所有的JNameEdList都有Icon,空出前面24 * 24的位置就是放的Icon rect.setRect(createRect(rect, getIconWidth())); editorComp.setBounds(rect); diff --git a/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java b/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java index b0483dfdd3..682e68be7d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java +++ b/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java @@ -104,7 +104,7 @@ public class TableViewList extends UIList { @Override protected DefaultListModel doInBackground() throws Exception { - Connection datasource = ConnectionRepository.getInstance().getByName(databaseName).getConnection(); + Connection datasource = ConnectionInfoBeanHelper.createConnection(ConnectionRepository.getInstance().getByName(databaseName)); boolean status = false; int count = 3; //总共给3次连接的机会 @@ -168,7 +168,7 @@ public class TableViewList extends UIList { */ private DefaultListModel processDataInAnotherThread(String databaseName, String searchFilter, String... typesFilter) throws Exception { DefaultListModel defaultListModel = new DefaultListModel(); - Connection datasource = ConnectionRepository.getInstance().getByName(databaseName).getConnection(); + Connection datasource = ConnectionInfoBeanHelper.createConnection(ConnectionRepository.getInstance().getByName(databaseName)); if (datasource == null) { return defaultListModel; } diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java index 0d11eb491f..1a14821d00 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java @@ -77,7 +77,7 @@ public class EnvFileTree extends RefreshableJTree { } this.setIcon(FileTreeIcon.getIconWithExpandAttr(node, expanded)); } else { - this.setIcon(FileTreeIcon.getFolderHalfImageIcon()); + this.setIcon(FileTreeIcon.getFolderHalfImageIcon(expanded)); } this.setText(name); } else if (userObj == PENDING) { diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java index ca26e435aa..92de91aa1e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java @@ -49,9 +49,10 @@ public class FileTreeIcon { public static final Icon FRM_FILE_LOCK_ICON = new LazyIcon("frm_locked"); public static final Icon FVS_FILE_LOCK_ICON = new LazyIcon("fvs_locked"); - // TODO: 以下Icon视觉暂未提供,需提供后替换 + public static final Icon FOLDER_HALF_IMAGE_ICON = new LazyIcon("folder_half_authority"); + public static final Icon FOLDER_HALF_IMAGE_ICON_OPEN = new LazyIcon("folder_half_authority_open"); + public static final Icon BLANK_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/blank.gif"); - public static final Icon FOLDER_HALF_IMAGE_ICON = IconUtils.readIcon("/com/fr/design/standard/fileicon/folder_half_authority.svg"); public static final Icon CPTX_LOCKED_ICON = IconUtils.readIcon("/com/fr/design/standard/fileicon/cptx_icon_locked.svg"); public static final LockIcon FOLDER_LOCK_ICON = @@ -130,7 +131,17 @@ public class FileTreeIcon { } public static Icon getFolderHalfImageIcon() { - return FOLDER_HALF_IMAGE_ICON; + return getFolderHalfImageIcon(false); + } + + /** + * 获取文件夹有部分权限时的图标 + * + * @param isExpand 文件夹是否已打开 + * @return 图标 + */ + public static Icon getFolderHalfImageIcon(boolean isExpand) { + return isExpand ? FOLDER_HALF_IMAGE_ICON_OPEN : FOLDER_HALF_IMAGE_ICON; } /** diff --git a/designer-base/src/main/java/com/fr/design/i18n/DesignSizeI18nManager.java b/designer-base/src/main/java/com/fr/design/i18n/DesignSizeI18nManager.java index 1dd2306b89..88c6e30b5f 100644 --- a/designer-base/src/main/java/com/fr/design/i18n/DesignSizeI18nManager.java +++ b/designer-base/src/main/java/com/fr/design/i18n/DesignSizeI18nManager.java @@ -1,5 +1,6 @@ package com.fr.design.i18n; +import com.fine.theme.utils.FineUIScale; import com.fr.design.dialog.BasicDialog; import com.fr.general.GeneralContext; import com.fr.locale.LocaleManager; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index a4239bc64c..1417bd548a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -107,6 +107,8 @@ import java.util.Set; import java.util.UUID; import java.util.concurrent.CopyOnWriteArrayList; +import static com.fine.theme.utils.FineUIScale.scale; + public class DesignerFrame extends JFrame implements JTemplateActionListener, TargetModifiedListener { private static final String DESIGNER_FRAME_NAME = "designer_frame"; @@ -115,7 +117,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta private static final long serialVersionUID = -8732559571067484460L; - private static final int MENU_HEIGHT = 26; + private static final int MENU_HEIGHT = scale(26); private static final Integer SECOND_LAYER = 100; @@ -578,8 +580,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta closeButton.setBorder(null); int x = contentWidth - EastRegionContainerPane.getInstance().getContainerWidth() - closeMode.getIconWidth() / 2; int y = MENU_HEIGHT - closeMode.getIconHeight() / 2; - closeButton.setBounds(x, y, UIConstants.CLOSE_AUTHORITY_HEIGHT_AND_WIDTH, - UIConstants.CLOSE_AUTHORITY_HEIGHT_AND_WIDTH); + closeButton.setBounds(x, y, scale(UIConstants.CLOSE_AUTHORITY_HEIGHT_AND_WIDTH), + scale(UIConstants.CLOSE_AUTHORITY_HEIGHT_AND_WIDTH)); } /** diff --git a/designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java b/designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java index dc502dcdf4..09170352fd 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.check; import com.fine.theme.icon.LazyIcon; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseUtils; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ibutton.UIButton; @@ -24,7 +25,7 @@ import javax.swing.JDialog; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; -import java.awt.FlowLayout; +import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; @@ -32,6 +33,10 @@ import java.awt.event.WindowEvent; import java.util.Set; import java.util.concurrent.ExecutionException; +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.dialog.FineJOptionPane.showConfirmDialog; import static javax.swing.JOptionPane.OK_CANCEL_OPTION; import static javax.swing.JOptionPane.OK_OPTION; @@ -73,7 +78,7 @@ public class CheckButton extends UIButton { } if (set.isEmpty()) { okButton.setEnabled(true); - imageLabel.setIcon(BaseUtils.readIcon("com/fr/design/images/correct.png")); + imageLabel.setIcon(new LazyIcon("success", 20)); message.setText("" + Toolkit.i18nText("Fine_Designer_Check_Font_Success") + ""); } else { if (dialog != null) { @@ -172,7 +177,7 @@ public class CheckButton extends UIButton { @Override public Void callHandler(RPCInvokerExceptionInfo rpcInvokerExceptionInfo) { - imageLabel.setIcon(BaseUtils.readIcon("com/fr/design/images/error.png")); + imageLabel.setIcon(new LazyIcon("error", 20)); message.setText("" + Toolkit.i18nText("Fine_Designer_Check_Font_Upgrade") + ""); okButton.setEnabled(true); return null; @@ -198,16 +203,16 @@ public class CheckButton extends UIButton { dialog.setSize(DesignSizeI18nManager.getInstance().i18nDimension(this.getClass().getName())); JPanel jp = new JPanel(); JPanel upPane = new JPanel(); - JPanel downPane = new JPanel(); - imageLabel = new UILabel(IOUtils.readIcon("com/fr/design/images/waiting.png")); - upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); - upPane.add(imageLabel); - upPane.add(message); - downPane.setLayout(new FlowLayout(FlowLayout.CENTER, 6, 0)); - downPane.add(okButton); - jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); - jp.add(upPane); - jp.add(downPane); + JPanel downPane = new JPanel(new BorderLayout()); + imageLabel = new UILabel(new LazyIcon("waiting", 20)); + upPane.add(row(10, + column(cell(imageLabel),flex()), cell(message) + ).getComponent()); + downPane.add(okButton, BorderLayout.EAST); + jp.setLayout(new BorderLayout()); + jp.add(column(flex(), cell(upPane), flex()).getComponent()); + jp.add(downPane, BorderLayout.SOUTH); + jp.setBorder(new ScaledEmptyBorder(10, 10, 10,10)); dialog.add(jp); dialog.setResizable(false); dialog.setLocationRelativeTo(SwingUtilities.getWindowAncestor(this)); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/LookAndFeelAction.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/LookAndFeelAction.java index 613fe0a0c1..3edf09d953 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/LookAndFeelAction.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/LookAndFeelAction.java @@ -5,6 +5,7 @@ package com.fr.design.mainframe.toolbar; +import com.fine.theme.icon.IconManager; import com.formdev.flatlaf.FlatLaf; import com.formdev.flatlaf.extras.FlatAnimatedLafChange; import com.fr.design.actions.UpdateAction; @@ -32,6 +33,8 @@ public class LookAndFeelAction extends UpdateAction { FlatAnimatedLafChange.showSnapshot(); try { UIManager.setLookAndFeel( lookAndFeel ); + // 多主题场景下,需要判断是否需要切换图标 + IconManager.updateIcon(); } catch (UnsupportedLookAndFeelException e) { throw new RuntimeException(e); } diff --git a/designer-base/src/main/java/com/fr/design/present/dict/DatabaseDictPane.java b/designer-base/src/main/java/com/fr/design/present/dict/DatabaseDictPane.java index 5c157a7cd9..aa126574ea 100644 --- a/designer-base/src/main/java/com/fr/design/present/dict/DatabaseDictPane.java +++ b/designer-base/src/main/java/com/fr/design/present/dict/DatabaseDictPane.java @@ -6,6 +6,7 @@ import com.fr.base.TableData; import com.fr.data.core.DataCoreUtils; import com.fr.data.core.db.DBUtils; import com.fr.data.core.db.dialect.Dialect; +import com.fr.data.impl.Connection; import com.fr.data.impl.DatabaseDictionary; import com.fr.data.impl.NameDatabaseConnection; import com.fr.design.beans.FurtherBasicBeanPane; @@ -14,6 +15,7 @@ import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.ChoosePane; import com.fr.design.data.datapane.DataBaseItems; import com.fr.design.data.datapane.VerticalChoosePane; +import com.fr.design.data.datapane.preview.ConnectionInfoBeanHelper; import com.fr.design.data.datapane.preview.PreviewLabel.Previewable; import com.fr.design.editor.DoubleDeckValueEditorPane; import com.fr.design.editor.editor.ColumnIndexEditor; @@ -25,6 +27,7 @@ import com.fr.design.event.UIObserverListener; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.stable.StringUtils; +import com.fr.workspace.server.repository.connection.ConnectionRepository; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -176,8 +179,9 @@ public class DatabaseDictPane extends FurtherBasicBeanPane i if (StringUtils.isBlank(para.getDatabaseName())) { dbDict.setDatabaseConnection(null); } else { - database = DBUtils.checkDBConnection(para.getDatabaseName()); - if (database != null) { + Connection connection = ConnectionInfoBeanHelper.createConnection(ConnectionRepository.getInstance().getByName(para.getDatabaseName())); + if (connection != null) { + database = new NameDatabaseConnection(para.getDatabaseName()); dbDict.setDatabaseConnection(database); } } diff --git a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java index 9d21751c28..8b6d645fb3 100644 --- a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java +++ b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java @@ -252,6 +252,21 @@ public class FILEChooserPane extends BasicPane { return chooserPane; } + /** + * 获取CA证书的文件选择面板 + */ + public static FILEChooserPane getFileCAChoosePane(FILEFilter filter) { + FILEChooserPane chooserPane = new FILEChooserPane(); + chooserPane.showEnv = true; + chooserPane.showLoc = false; + chooserPane.showWebReport = false; + // 替换掉 PlaceListModel + chooserPane.setFileCAPlaceListModel(); + chooserPane.removeAllFilter(); + chooserPane.addChooseFILEFilter(filter, 0); + return chooserPane; + } + /** * @param showEnv @@ -1077,7 +1092,29 @@ public class FILEChooserPane extends BasicPane { String lastDirectoryPath = DesignerEnvManager.getEnvManager().getDialogCurrentDirectory(); String prefix = DesignerEnvManager.getEnvManager().getCurrentDirectoryPrefix(); FILE lastDirectory = FILEFactory.createFolder(prefix + lastDirectoryPath); + dealCurrentDirectory(model, lastDirectory) ; + } + + + private void setPlaceListModel4DataFile(AbstractPlaceListModel model) { + if (placesList == null) { + return; + } + placesList.setModel(model); + String lastDirectoryPath = FILEFactory.ENV_PREFIX; + String prefix = ProjectConstants.REPORTLETS_NAME; + FILE lastDirectory; + if (model instanceof FileDataPlaceListModel) { + FileDataFILE file = new FileDataFILE(new FileNode(), false, StringUtils.EMPTY, ((FileDataPlaceListModel) model).getType()); + lastDirectory = FILEFactory.createFolder(file, prefix + lastDirectoryPath); + } else { + lastDirectory = FILEFactory.createFolder(prefix + lastDirectoryPath); + } + dealCurrentDirectory(model, lastDirectory); + } + + private void dealCurrentDirectory(AbstractPlaceListModel model, FILE lastDirectory) { model.setCD(lastDirectory); if (currentDirectory != null) { @@ -1094,6 +1131,7 @@ public class FILEChooserPane extends BasicPane { } } + private void setPlaceListModel() { if (placesList == null) { return; @@ -1125,7 +1163,14 @@ public class FILEChooserPane extends BasicPane { if (placesList == null) { return; } - setPlaceListModel(new FileDataPlaceListModel(type)); + setPlaceListModel4DataFile(new FileDataPlaceListModel(type)); + } + + protected void setFileCAPlaceListModel() { + if (placesList == null) { + return; + } + setPlaceListModel(new FileCAPlaceListModel()); } /* @@ -1362,6 +1407,7 @@ public class FILEChooserPane extends BasicPane { private class FileDataPlaceListModel extends AbstractPlaceListModel { private FileDataFILE envFILE; + private String type; FileDataPlaceListModel(String type) { envFILE = new FileDataFILE(new FileNode(StableUtils.pathJoin(ProjectConstants.ASSETS_NAME, FileDataFILE.FILE_DATASET_NAME), true), false, StableUtils.pathJoin(ProjectConstants.ASSETS_NAME, FileDataFILE.FILE_DATASET_NAME)) { @@ -1371,6 +1417,45 @@ public class FILEChooserPane extends BasicPane { } }; envFILE.setType(type); + FileDataPlaceListModel.this.setType(type); + } + + @Override + public FILE getElementAt(int index) { + return envFILE; + } + + @Override + public int getSize() { + return 1 + filesOfSystem.size(); + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + protected void setCD(FILE lastDirectory) { + super.setCD(lastDirectory); + if (lastDirectory instanceof FileDataFILE) { + ((FileDataFILE)lastDirectory).setType(type); + } + } + } + + private class FileCAPlaceListModel extends AbstractPlaceListModel { + private FileCAFILE envFILE; + FileCAPlaceListModel() { + envFILE = new FileCAFILE(new FileNode(StableUtils.pathJoin(ProjectConstants.RESOURCES_NAME, ProjectConstants.CERTIFICATES_DIRECTORY), true), false, StableUtils.pathJoin(ProjectConstants.RESOURCES_NAME, ProjectConstants.CERTIFICATES_DIRECTORY)) { + @Override + public String getName() { + return getEnvProjectName(); + } + }; } @Override @@ -1385,6 +1470,7 @@ public class FILEChooserPane extends BasicPane { } + private class MultiLocalEnvPlaceListModel extends AbstractPlaceListModel { private static final long serialVersionUID = 6300018896958532154L; @@ -1596,7 +1682,7 @@ public class FILEChooserPane extends BasicPane { this.buttonList.add(createBlankButton((new SetDirectoryAction(btn_text + '/', // alex:dir.prefix不和btn_path一起参与pathJoin,因为btn_path是否以/打头在unix,linux // OS中意义很不一样 - FILEFactory.createFolder(dir.prefix() + StableUtils.pathJoin(btn_path, "/")), !needTopPath)))); + FILEFactory.createFolder(dir, dir.prefix() + StableUtils.pathJoin(btn_path, "/")), !needTopPath)))); } maxPathIndex = calculateMaxPathIndex(); diff --git a/designer-base/src/main/java/com/fr/file/FILEFactory.java b/designer-base/src/main/java/com/fr/file/FILEFactory.java index 4d5fe6548d..3e7113f35a 100644 --- a/designer-base/src/main/java/com/fr/file/FILEFactory.java +++ b/designer-base/src/main/java/com/fr/file/FILEFactory.java @@ -9,6 +9,7 @@ public class FILEFactory { public static final String FILE_PREFIX = "file://"; public static final String ENV_PREFIX = "env://"; public static final String FILE_DATA_PREFIX = "filedata://"; + public static final String FILE_CA_PREFIX = "ca://"; public static final String WEBREPORT_PREFIX = "webreport://"; public static final String SEPARATOR = "/"; @@ -38,12 +39,22 @@ public class FILEFactory { return new FileFILE(new java.io.File(path.substring(FILE_PREFIX.length()))); } else if (path.startsWith(FILE_DATA_PREFIX)) { return new FileDataFILE(new FileNode(path.substring(FILE_DATA_PREFIX.length()), false), false, path.substring(FILE_DATA_PREFIX.length())); + } else if (path.startsWith(FILE_CA_PREFIX)) { + return new FileCAFILE(new FileNode(path.substring(FILE_CA_PREFIX.length()), false), false, path.substring(FILE_CA_PREFIX.length())); } else { return new FileNodeFILE(new FileNode(path, WorkContext.getWorkResource().isDirectory(path))); } } public static FILE createFolder(String path) { + return createFolder(null, path); + } + + + /** + * 传递依据的基础文件并创建文件夹 + */ + public static FILE createFolder(FILE origin, String path) { if (path == null) { return null; } else if (path.startsWith(MEM_PREFIX)) { @@ -57,8 +68,15 @@ public class FILEFactory { } else if (path.startsWith(FILE_PREFIX)) { return new FileFILE(new java.io.File(path.substring(FILE_PREFIX.length()))); } else if (path.startsWith(FILE_DATA_PREFIX)) { - return new FileDataFILE(new FileNode(path.substring(FILE_DATA_PREFIX.length()), true), false, path.substring(FILE_DATA_PREFIX.length())); - } else { + FileDataFILE file = new FileDataFILE(new FileNode(path.substring(FILE_DATA_PREFIX.length()), true), false, path.substring(FILE_DATA_PREFIX.length())); + if (origin instanceof FileDataFILE) { + file.setType(((FileDataFILE) origin).getType()); + } + return file; + } else if (path.startsWith(FILE_CA_PREFIX)) { + return new FileCAFILE(new FileNode(path.substring(FILE_CA_PREFIX.length()), true), false, path.substring(FILE_CA_PREFIX.length())); + } + else { return new FileNodeFILE(new FileNode(path, WorkContext.getWorkResource().isDirectory(path))); } } diff --git a/designer-base/src/main/java/com/fr/file/FileCAFILE.java b/designer-base/src/main/java/com/fr/file/FileCAFILE.java new file mode 100644 index 0000000000..2ecf3c39b0 --- /dev/null +++ b/designer-base/src/main/java/com/fr/file/FileCAFILE.java @@ -0,0 +1,167 @@ +package com.fr.file; + +import com.fr.decision.webservice.bean.entry.FileNodeBean; +import com.fr.file.filetree.FileNode; +import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.CoreConstants; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.project.ProjectConstants; +import com.fr.workspace.server.repository.tabledata.TableDataRepository; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * CA证书文件相关 + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/9/8 + */ +public class FileCAFILE extends FileNodeFILE{ + public static final String ROOT = ProjectConstants.CERTIFICATES_DIRECTORY; + private List children = new ArrayList<>(); + private boolean builded = false; + private String id = StringUtils.EMPTY; + + public FileCAFILE(FileNode node) { + super(node); + } + + public FileCAFILE(FileNode node, boolean builded, String id) { + super(node); + this.builded = builded; + this.id = id; + } + + /** + * 添加子 + */ + private void addChild(FileCAFILE file) { + children.add(file); + } + + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + } + + public boolean isBuilded() { + return builded; + } + + public void setBuilded(boolean builded) { + this.builded = builded; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @Override + public FILE[] listFiles() { + + if (ComparatorUtils.equals(node, null)) { + node = new FileNode(CoreConstants.SEPARATOR, true); + } + if (!node.isDirectory()) { + return new FILE[]{this}; + } + try { + FileCAFILE root = null; + if (!this.builded) { + root = buildTree(); + FileCAFILE dataFILE = root.getFileCAFILE(this.id); + this.setChildren(dataFILE.getChildren()); + this.builded = true; + } + return this.getChildren().toArray(new FILE[0]); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return new FILE[0]; + } + } + + private List getBeans() { + try { + return TableDataRepository.getInstance().getCertificatesFile(StringUtils.EMPTY); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * 递归获取指定id的文件 + */ + public FileCAFILE getFileCAFILE(String id) { + if (StringUtils.equals(this.id, id) || StringUtils.equals(StableUtils.pathJoin(this.id, StringUtils.EMPTY), id)) { + return this; + } + for (FileCAFILE file : getChildren()) { + return file.getFileCAFILE(id); + } + return null; + } + + private FileCAFILE buildTree() { + List beans = getBeans(); + Map tree = new HashMap<>(); + FileCAFILE root = null; + // id , 父 + for (FileNodeBean bean : beans) { + FileNode fileNode = new FileNode(); + fileNode.setEnvPath(bean.getPath()); + fileNode.setDirectory(bean.getIsParent()); + tree.putIfAbsent(bean.getId(), new FileCAFILE(fileNode, true, bean.getId())); + if (StringUtils.isEmpty(bean.getpId())) { + root = tree.get(bean.getId()); + } else { + tree.putIfAbsent(bean.getpId(), createParent(bean.getpId(), beans)); + FileCAFILE file = tree.get(bean.getpId()); + if (file != null) { + file.addChild(tree.get(bean.getId())); + } + } + } + for (Map.Entry entry : tree.entrySet()) { + if (entry.getKey().endsWith(ROOT)) { + root = entry.getValue(); + root.setId(StableUtils.pathJoin(ProjectConstants.RESOURCES_NAME, ProjectConstants.CERTIFICATES_DIRECTORY)); + break; + } + } + return root; + } + + private FileCAFILE createParent(String s, List beans) { + for (FileNodeBean bean : beans) { + if (StringUtils.equals(bean.getId(), s)) { + FileNode fileNode = new FileNode(); + fileNode.setEnvPath(bean.getPath()); + fileNode.setDirectory(bean.getIsParent()); + return new FileCAFILE(fileNode, true, bean.getId()); + } + } + FileNode fileNode = new FileNode(); + fileNode.setEnvPath(s); + fileNode.setDirectory(true); + return new FileCAFILE(fileNode, true, ROOT); + } + + @Override + public String prefix() { + return FILEFactory.FILE_CA_PREFIX; + } + +} 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 434faeee03..11fba58b6a 100644 --- a/designer-base/src/main/java/com/fr/file/FileDataFILE.java +++ b/designer-base/src/main/java/com/fr/file/FileDataFILE.java @@ -42,6 +42,13 @@ public class FileDataFILE extends FileNodeFILE{ this.id = id; } + public FileDataFILE(FileNode node, boolean builded, String id, String type) { + super(node); + this.builded = builded; + this.id = id; + this.type = type; + } + private void addChild(FileDataFILE file) { children.add(file); } @@ -127,7 +134,7 @@ public class FileDataFILE extends FileNodeFILE{ FileNode fileNode = new FileNode(); fileNode.setEnvPath(bean.getPath()); fileNode.setDirectory(bean.getIsParent()); - tree.putIfAbsent(bean.getId(), new FileDataFILE(fileNode, true, bean.getId())); + tree.putIfAbsent(bean.getId(), new FileDataFILE(fileNode, true, bean.getId(), type)); if (StringUtils.isEmpty(bean.getpId())) { root = tree.get(bean.getId()); } else { @@ -147,7 +154,7 @@ public class FileDataFILE extends FileNodeFILE{ FileNode fileNode = new FileNode(); fileNode.setEnvPath(bean.getPath()); fileNode.setDirectory(bean.getIsParent()); - return new FileDataFILE(fileNode, true, bean.getId()); + return new FileDataFILE(fileNode, true, bean.getId(), type); } } return null; diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/folder_half_authority.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/folder_half_authority.svg new file mode 100644 index 0000000000..438cd6c89b --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/folder_half_authority.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/folder_half_authority_open.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/folder_half_authority_open.svg new file mode 100644 index 0000000000..c919f1a181 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/folder_half_authority_open.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/tip/waiting.svg b/designer-base/src/main/resources/com/fine/theme/icon/tip/waiting.svg new file mode 100644 index 0000000000..d28bde3384 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/tip/waiting.svg @@ -0,0 +1,4 @@ + + + + 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 aaa6df6d59..97a5bc70d7 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 @@ -439,6 +439,7 @@ "top": "border/top.svg", "all":"border/all.svg", "error":"tip/error.svg", + "waiting":"tip/waiting.svg", "information":"tip/information.svg", "new_information":"tip/new_information.svg", "success":"tip/success.svg", @@ -448,7 +449,9 @@ "layout_left": "layout/layout_left.svg", "layout_right": "layout/layout_right.svg", "layout_top_right": "layout/layout_top_right.svg", - "theme_edit": "theme_edit.svg" + "theme_edit": "theme_edit.svg", + "folder_half_authority" : "filetree/folder_half_authority.svg", + "folder_half_authority_open" : "filetree/folder_half_authority_open.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 e9b966dcd7..5b3fbc9c06 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 @@ -450,6 +450,7 @@ List.showCellFocusIndicator = false List.cellRender.background = #FFF List.cellRender.button.width = 28 List.cellRender.button.height = 24 +List.cellRender.height = 24 List.wrapper.text.fontColor = #0a1c3877 #---- Menu ---- diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties index bc6f1a8810..1e30edaf4e 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties @@ -1,5 +1,5 @@ # \u9ED8\u8BA4\u4E3A\u7C7B\u7684\u5168\u9650\u5B9A\u540D\uFF08\u53EF\u81EA\u5B9A\u4E49key\uFF09= width * height -com.fr.design.mainframe.check.CheckButton=250*118 +com.fr.design.mainframe.check.CheckButton=360*160 com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=360*185 com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=325*31 com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=360*280 diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateFloatLinkPane.java b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateFloatLinkPane.java index e1b5a40612..8846dc0cc3 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateFloatLinkPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateFloatLinkPane.java @@ -74,7 +74,7 @@ public class ChartHyperRelateFloatLinkPane extends AbstractHyperLinkPane { } protected JPanel getContentPane () { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] row = {p, p, p, p, p}; - double[] col = {p, f}; - - return TableLayoutHelper.createTableLayoutPane(getComponent(), row, col); + return FineLayoutBuilder.compatibleTableLayout(10, getComponent(), new double[]{1.2, 3}); } protected Component[][] getComponent () { return new Component[][]{ - new Component[]{null, null}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Min_Diameter")), minDiameter}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Diameter")), maxDiameter}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Shadow")), shadow}, diff --git a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java index 57176c256c..7822cb3443 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java @@ -79,7 +79,7 @@ public class VanChartColumnSeriesPane extends VanChartAbstractPlotSeriesPane { isFixedWidth.addActionListener(e -> checkColumnWidth()); isFillWithImage.addActionListener(e -> checkImagePane()); - return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Filled_With_Image"), borderPane); + return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Filled_With_Image"), borderPane, true); } private void checkAll() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java index 86766676b4..6ff6f35b67 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java @@ -1,29 +1,26 @@ package com.fr.van.chart.column; +import com.fine.theme.utils.FineLayoutBuilder; +import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.data.condition.AbstractCondition; import com.fr.data.condition.ListCondition; import com.fr.design.beans.BasicBeanPane; import com.fr.design.condition.LiteConditionPane; import com.fr.design.gui.ibutton.UIButtonGroup; -import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.plugin.chart.base.AttrSeriesStackAndAxis; import com.fr.van.chart.designer.style.series.VanChartSeriesConditionPane; -import javax.swing.BorderFactory; -import javax.swing.BoxLayout; import javax.swing.JPanel; -import javax.swing.ScrollPaneConstants; +import java.awt.BorderLayout; import java.awt.Component; -import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; + /** * 堆积和坐标轴设置 */ @@ -42,36 +39,26 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_YES"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_NO")}); isPercentStacked = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_YES"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_NO")}); - double p = TableLayout.PREFERRED; - double[] columnSize = {p, p}; - double[] rowSize = {p, p, p, p}; - return TableLayoutHelper.createTableLayoutPane(getDeployComponents(), rowSize, columnSize); + return FineLayoutBuilder.compatibleTableLayout(10, getDeployComponents(), new double[]{1.2, 3}); } protected Component[][] getDeployComponents() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartAreaSeriesFillColorPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartAreaSeriesFillColorPane.java index 241798bef3..7d4ad238f6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartAreaSeriesFillColorPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartAreaSeriesFillColorPane.java @@ -1,14 +1,14 @@ package com.fr.van.chart.designer.component; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.TableLayout; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.base.AttrAreaSeriesFillColorBackground; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.background.VanChartMarkerBackgroundPane; import javax.swing.JPanel; @@ -24,14 +24,9 @@ public class VanChartAreaSeriesFillColorPane extends BasicPane { private UINumberDragPane transparent; public VanChartAreaSeriesFillColorPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] row = {p,p}; - double[] col = {f}; fillColorPane = new VanChartMarkerBackgroundPane(){ protected Component[][] getPaneComponents() { return new Component[][]{ - new Component[]{null, null}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Fill_Color")), typeComboBox}, new Component[]{null, centerPane}, }; @@ -39,9 +34,10 @@ public class VanChartAreaSeriesFillColorPane extends BasicPane { }; transparent = new UINumberDragPaneWithPercent(0, 100); - JPanel transparentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha"), transparent); + JPanel transparentPane = FineLayoutBuilder.createHorizontalLayout(0, new double[]{1.2, 3}, + new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha")), transparent); - this.setLayout(new BorderLayout()); + this.setLayout(FRGUIPaneFactory.createScaledBorderLayout(0, 10)); this.add(fillColorPane, BorderLayout.NORTH); this.add(transparentPane, BorderLayout.CENTER); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java index 1c02408a3f..54445cceab 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java @@ -38,7 +38,6 @@ import com.fr.stable.Constants; import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.van.chart.config.DefaultStyleHelper4Van; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartHtmlLabelPane; import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.axis.component.VanChartCategoryStylePaneWithCheckBox; @@ -372,19 +371,15 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { maxProportion = new UINumberDragPaneWithPercent(0, 100, 1); axisLimitSize = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Limit"), Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); - JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Area_Size"), axisLimitSize); - maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"), maxProportion, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); - maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); - JPanel panel = new JPanel(new BorderLayout()); - panel.add(limitSizePane, BorderLayout.NORTH); - panel.add(maxProportionPane, BorderLayout.CENTER); + JPanel limitSizePane = FineLayoutBuilder.createHorizontalLayout(10, new double[]{1.2, 3}, + new UILabel(Toolkit.i18nText("Fine-Design_Chart_Area_Size")), axisLimitSize); + maxProportionPane = FineLayoutBuilder.createHorizontalLayout(10, new double[]{1.2, 3}, + new UILabel(Toolkit.i18nText("Fine-Design_Chart_Max_Proportion")), maxProportion); + JPanel panel = column(10, + cell(limitSizePane), cell(maxProportionPane) + ).getComponent(); - axisLimitSize.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - checkMaxProPortionUse(); - } - }); + axisLimitSize.addActionListener(e -> checkMaxProPortionUse()); return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel, true); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java index 1664b21ecf..368c9bfddf 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java @@ -10,6 +10,7 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIPopupMenu; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.VanChartAttrHelper; @@ -56,7 +57,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane { public VanChartAxisButtonPane(VanChartAxisPane vanChartAxisPane) { this.parent = vanChartAxisPane; - this.setLayout(new BorderLayout()); + this.setLayout(FRGUIPaneFactory.createScaledBorderLayout(10, 0)); addButton = new AddButton(new LazyIcon("add_popup")); JPanel eastPane = new JPanel(new BorderLayout()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java index e4ceae7fa9..62afe15d2e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java @@ -1,5 +1,8 @@ package com.fr.van.chart.designer.style.background; +import com.fine.swing.ui.layout.Column; +import com.fine.theme.utils.FineLayoutBuilder; +import com.fine.theme.utils.FineUIUtils; import com.fr.base.BaseFormula; import com.fr.base.Utils; import com.fr.chart.base.AttrColor; @@ -14,12 +17,8 @@ import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; import com.fr.design.gui.style.FRFontPane; import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.style.color.ColorSelectBox; import com.fr.design.utils.DesignUtils; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; import com.fr.general.GeneralUtils; import com.fr.plugin.chart.VanChartAttrHelper; @@ -29,10 +28,10 @@ import com.fr.stable.Constants; import com.fr.stable.StableUtils; import com.fr.van.chart.designer.component.LineTypeComboBox; -import javax.swing.BoxLayout; import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; @@ -108,26 +107,24 @@ public class VanChartAlertValuePane extends BasicBeanPane { private void doLayoutPane() { this.removeAll(); - this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + this.setLayout(new BorderLayout()); + Column column = new Column(); + column.setSpacing(10); + this.add(column, BorderLayout.CENTER); + //警戒线设置 - JPanel top = FRGUIPaneFactory.createBorderLayout_L_Pane(); - this.add(top); - top.setBorder(GUICoreUtils.createTitledBorder(Toolkit.i18nText("Fine-Design_Chart_Alert_Set") + ":", null)); - top.add(createTopPane()); + Component top = FineUIUtils.wrapComponentWithTitle(createTopPane(), Toolkit.i18nText("Fine-Design_Chart_Alert_Set")); + column.add(top); + //提示文字 - JPanel bottom = FRGUIPaneFactory.createBorderLayout_L_Pane(); - this.add(bottom); - bottom.setBorder(GUICoreUtils.createTitledBorder(Toolkit.i18nText("Fine-Design_Chart_Alert_Text") + ":", null)); - bottom.add(createBottomPane()); + Component bottom = FineUIUtils.wrapComponentWithTitle(createBottomPane(), Toolkit.i18nText("Fine-Design_Chart_Alert_Text")); + column.add(bottom); } protected JPanel createTopPane() { - double p = TableLayout.PREFERRED; - double[] columnSize = {p, p}; - double[] rowSize = {p, p, p, p, p}; Component[][] components = getTopPaneComponents(); - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.2, 3}); } protected Component[][] getTopPaneComponents() { @@ -141,10 +138,6 @@ public class VanChartAlertValuePane extends BasicBeanPane { } private JPanel createBottomPane() { - alertTextPosition.setSelectedIndex(0); - double p = TableLayout.PREFERRED; - double[] columnSize = {p, p}; - double[] rowSize = {p, p, p, p, p}; Component[][] components = new Component[][]{ new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Layout_Position")), alertTextPosition}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Content")), alertText}, @@ -153,7 +146,7 @@ public class VanChartAlertValuePane extends BasicBeanPane { new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), fontColor}, }; - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.2, 3}); } private void checkPositionPane() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java index 9c332c3e5e..70049a4422 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java @@ -1,12 +1,14 @@ package com.fr.van.chart.designer.style.background; import com.fine.theme.utils.FineLayoutBuilder; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.van.chart.designer.AbstractVanChartScrollPane; @@ -15,7 +17,6 @@ import com.fr.van.chart.designer.component.background.VanChartBackgroundPaneWith import com.fr.van.chart.designer.component.border.VanChartBorderWithRadiusPane; import com.fr.van.chart.designer.style.background.radar.VanChartRadarAxisAreaPane; -import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Color; @@ -44,7 +45,7 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane" + Toolkit.i18nText("Fine-Design_Chart_Background_Tooltip") + ""); tooltipLabel.setForeground(Color.gray); - tooltipLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 5, 10)); contentPane.add(tooltipLabel, BorderLayout.NORTH); tooltipLabel.setVisible(false); } @@ -87,7 +87,8 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane { checkCardPane(); } }); - JPanel intervalPane = new JPanel(new BorderLayout(0, 6)); + JPanel intervalPane = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(0, 10)); JPanel panel1 = FineLayoutBuilder.createHorizontalLayout(0, new double[]{1.2, 3}, new UILabel(Toolkit.i18nText("Fine-Design_Chart_Interval_Background")), isDefaultIntervalBackground); intervalPane.add(panel1, BorderLayout.NORTH); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartCustomIntervalBackgroundPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartCustomIntervalBackgroundPane.java index 42fcdad8eb..f561ce2626 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartCustomIntervalBackgroundPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartCustomIntervalBackgroundPane.java @@ -1,5 +1,7 @@ package com.fr.van.chart.designer.style.background; +import com.fine.theme.utils.FineLayoutBuilder; +import com.fine.theme.utils.FineUIUtils; import com.fr.base.BaseFormula; import com.fr.base.Utils; import com.fr.design.beans.BasicBeanPane; @@ -9,19 +11,14 @@ import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.style.color.ColorSelectBox; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.attr.axis.VanChartCustomIntervalBackground; import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import javax.swing.BoxLayout; import javax.swing.JPanel; +import java.awt.BorderLayout; import java.awt.Component; -import java.awt.Dimension; /** * 自定义间隔背景设置 @@ -38,25 +35,17 @@ public class VanChartCustomIntervalBackgroundPane extends BasicBeanPane { } JPanel mapDataTreePanel = new JPanel(new BorderLayout()); - mapDataTreePanel.add(mapDataTree); + UIScrollPane treeScrollPane = new UIScrollPane(mapDataTree); + treeScrollPane.setBorder(FineBorderFactory.createWrappedRoundBorder()); + mapDataTreePanel.add(treeScrollPane, BorderLayout.CENTER); Component[][] components = new Component[][]{ new Component[]{new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layer_Tree"), mapDataTreePanel, true)}, @@ -78,28 +78,23 @@ public class DrillMapLayerPane extends BasicScrollPane { } private JPanel createLayerDetailPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {f, p, p}; - double[] rowSize = new double[depth + 1]; detailComps = new Component[depth + 1][3]; - rowSize[0] = p; detailComps[0] = new Component[]{ new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Descriptor")), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Zoom_Layer")), + null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layer_Map_Type")) }; for (int i = 0; i < depth; i++) { - rowSize[i + 1] = p; int d = i + 1; UILabel label = new UILabel(String.format("%s%d%s", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Index_Article"), d, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Index_Layer"))); UIComboBox level = new UIComboBox(MapStatusPane.ZOOM_LEVELS); level.setEnabled(i != 0); UIComboBox type = new UIComboBox(TEMP.get(oldMapType)); - detailComps[i + 1] = new Component[]{label, level, type}; + detailComps[i + 1] = new Component[]{label, level, null, type}; } - return TableLayoutHelper.createGapTableLayoutPane(detailComps, rowSize, columnSize, 5, 6); + return FineLayoutBuilder.compatibleTableLayout(10, detailComps, new double[]{1.2, 1.4, 0.2, 1.4}); } /** diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java index 5ebfea2320..1ce78b7e70 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java @@ -1,7 +1,6 @@ package com.fr.van.chart.drillmap.designer.data.comp; import com.fine.theme.icon.LazyIcon; -import com.fr.design.border.FineBorderFactory; import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.map.designer.type.GEOJSONTreeHelper; import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; @@ -35,7 +34,6 @@ public class MapDataTree extends JTree { this.setShowsRootHandles(true); this.setInvokesStopCellEditing(true); this.setCellRenderer(treeCellRenderer); - setBorder(FineBorderFactory.createWrappedRoundBorder()); setStyle(this, PURE_TREE); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java index 5d8c896072..f08d81a636 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java @@ -1,15 +1,14 @@ package com.fr.van.chart.funnel.designer.style; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.chart.chartattr.Plot; +import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.plugin.chart.funnel.FunnelSortType; import com.fr.plugin.chart.funnel.VanChartFunnelPlot; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; import javax.swing.JPanel; @@ -27,16 +26,12 @@ public class VanChartFunnelSeriesPane extends VanChartAbstractPlotSeriesPane { } protected JPanel getContentInPlotType() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {f}; - double[] rowSize = {p,p,p,p,p,p,p,p,p,p}; Component[][] components = new Component[][]{ new Component[]{createFunnelStylePane()}, new Component[]{createBorderPane()}, }; - contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + contentPane = FineLayoutBuilder.compatibleTableLayout(0, components, new double[]{1}); return contentPane; } @@ -57,20 +52,14 @@ public class VanChartFunnelSeriesPane extends VanChartAbstractPlotSeriesPane { Toolkit.i18nText("Fine-Design_Chart_Origin_Sort") }); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] columnSize = {f, e}; - double[] rowSize = {p,p,p}; Component[][] components = new Component[][]{ - new Component[]{null, null}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Continuity")), useSameSlantAngle}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Sort")), sort}, }; - JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + JPanel panel = FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.2, 3}); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Style_Name"), panel); + return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Style_Name"), panel, true); } public void populateBean(Plot plot) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java index ad553d7b9c..b31055edca 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java @@ -11,6 +11,7 @@ import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.style.color.ColorSelectBox; import com.fr.design.utils.gui.GUICoreUtils; @@ -273,7 +274,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { //获取颜色面板 private JPanel getColorPane(MapType paneType) { - JPanel panel = new JPanel(new BorderLayout()); + JPanel panel = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(0, 10)); stylePane = createStylePane(); mapType = ((VanChartMapPlot) plot).getAllLayersMapType(); if (mapType != MapType.CUSTOM && mapType != MapType.DRILL_CUSTOM) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java index 1afffc8964..0b7716faa2 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java @@ -1,10 +1,11 @@ package com.fr.van.chart.map.designer.style.label; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.jxbrowser.JxUIPane; -import com.fr.design.layout.TableLayout; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat; @@ -13,7 +14,6 @@ import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.plugin.chart.type.TextAlign; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; @@ -67,18 +67,12 @@ public class VanChartMapLabelContentPane extends VanChartLabelContentPane { protected JPanel getLabelContentPane(JPanel contentPane) { showAllSeries = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Show_All_Series")); - double f = TableLayout.FILL; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] columnSize = {f, e}; - double p = TableLayout.PREFERRED; - double[] row = {p, p}; Component[][] components = { - new Component[]{null, null}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy")), showAllSeries} }; - checkPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, columnSize); + checkPane = FineLayoutBuilder.compatibleTableLayout(0, components, new double[]{1.2, 3}); - JPanel panel = new JPanel(new BorderLayout()); + JPanel panel = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(0, 10)); panel.add(contentPane, BorderLayout.CENTER); panel.add(checkPane, BorderLayout.SOUTH); return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Content"), panel); diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java index 218dd02294..cac695bf17 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java @@ -1,6 +1,7 @@ package com.fr.van.chart.map.designer.type; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; @@ -9,11 +10,10 @@ import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.plugin.chart.base.GisLayer; import com.fr.plugin.chart.map.layer.WMSLayer; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.JPanel; import javax.swing.SwingConstants; @@ -55,24 +55,19 @@ public class WMSLayerPane extends JPanel implements UIObserver { public WMSLayerPane() { - final double p = TableLayout.PREFERRED; - double[] rowSize = {p}; - double[] COLUMN_SIZE = {TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH, 84, 44}; - wmsUrl = new UITextArea(); connectButton = new UIButton(Toolkit.i18nText("Fine-Design_Chart_Connect_WMP")); Component[][] comps = new Component[][]{ - new Component[]{new UILabel("url"), wmsUrl, connectButton} + new Component[]{new UILabel("url"), wmsUrl, null, connectButton} }; - JPanel northPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, rowSize, COLUMN_SIZE); - northPane.setBorder(TableLayout4VanChartHelper.SECOND_EDIT_AREA_BORDER); + JPanel northPane = FineLayoutBuilder.compatibleTableLayout(10, comps, new double[]{1.2, 1.4, 0.2, 1.4}); wmsLayerPane = new JPanel(new BorderLayout()); resetWMSLayerPane(new ArrayList<>()); - this.setLayout(new BorderLayout(0, 6)); + this.setLayout(FRGUIPaneFactory.createScaledBorderLayout(0, 10)); this.add(northPane, BorderLayout.NORTH); this.add(wmsLayerPane, BorderLayout.CENTER); addListener(); @@ -136,7 +131,7 @@ public class WMSLayerPane extends JPanel implements UIObserver { wmsLayerCheckBoxs.add(checkBox); } - wmsLayerPane.add(TableLayoutHelper.createCommonTableLayoutPane(comps, rowSize, COLUMN_SIZE, 0), BorderLayout.CENTER); + wmsLayerPane.add(FineLayoutBuilder.compatibleTableLayout(10, comps, new double[]{1.2, 3}), BorderLayout.CENTER); updateUI(); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieSeriesPane.java index 6c1575cfdf..dd3923bc9d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieSeriesPane.java @@ -1,15 +1,15 @@ package com.fr.van.chart.multilayer.style; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.chart.chartattr.Plot; +import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.plugin.chart.multilayer.VanChartMultiPiePlot; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartBeautyPane; import com.fr.van.chart.pie.VanChartPieSeriesPane; @@ -39,7 +39,7 @@ public class VanChartMultiPieSeriesPane extends VanChartPieSeriesPane { new Component[]{createBorderPane()}, }; - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1}); } protected JPanel createSeriesStylePane(double[] row, double[] col) { @@ -54,7 +54,6 @@ public class VanChartMultiPieSeriesPane extends VanChartPieSeriesPane { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); Component[][] components = new Component[][]{ - new Component[]{null,null}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Gradual_Level") ),gradualLevel}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Angle") ),startAngle}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Angle")),endAngle}, @@ -63,8 +62,8 @@ public class VanChartMultiPieSeriesPane extends VanChartPieSeriesPane { new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Rotation")),supportRotation} }; - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel); + JPanel panel = FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.2, 3}); + return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel, true); } protected void populatePieAttr() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java index 52f865356d..f17cb9bcde 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java @@ -1,6 +1,7 @@ package com.fr.van.chart.pie; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.chart.chartattr.Plot; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.frpane.UINumberDragPane; @@ -9,7 +10,6 @@ import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.i18n.Toolkit; @@ -48,7 +48,7 @@ public class VanChartPieSeriesPane extends VanChartAbstractPlotSeriesPane { new Component[]{createBorderPane()}, }; - return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1}); } @@ -60,7 +60,6 @@ public class VanChartPieSeriesPane extends VanChartAbstractPlotSeriesPane { Component[][] components = new Component[][]{ - new Component[]{null,null}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Start_Angle")),startAngle}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_End_Angle")),endAngle}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Inner_Radius")),innerRadius}, @@ -69,7 +68,7 @@ public class VanChartPieSeriesPane extends VanChartAbstractPlotSeriesPane { }; - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); + JPanel panel = FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.2, 3}); return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel, true); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/radar/VanChartRadarSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/radar/VanChartRadarSeriesPane.java index 1026b99367..ffe75a7d58 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/radar/VanChartRadarSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/radar/VanChartRadarSeriesPane.java @@ -1,15 +1,15 @@ package com.fr.van.chart.radar; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.chart.chartattr.Plot; +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.gui.ibutton.UIButtonGroup; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.plugin.chart.radar.VanChartRadarPlot; import com.fr.plugin.chart.type.RadarType; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartLineTypePane; import com.fr.van.chart.designer.component.VanChartLineWidthPane; import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; @@ -32,12 +32,8 @@ public class VanChartRadarSeriesPane extends VanChartAbstractPlotSeriesPane { } protected JPanel getContentInPlotType(){ - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] row = {p,p,p,p,p,p,p}; - double[] col = {f}; - contentPane = TableLayoutHelper.createTableLayoutPane(getPaneComponents(), row, col); + contentPane = FineLayoutBuilder.compatibleTableLayout(10, getPaneComponents(), new double[]{1}); return contentPane; } @@ -67,8 +63,9 @@ public class VanChartRadarSeriesPane extends VanChartAbstractPlotSeriesPane { private JPanel createRadarTypePane() { radarType = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Circle"), Toolkit.i18nText("Fine-Design_Chart_Polygonal")}, new String[]{RadarType.CIRCLE.getType(), RadarType.POLYGON.getType()}); - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Shape"), radarType); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Style_Present"), panel); + JPanel panel = FineLayoutBuilder.createHorizontalLayout(0, new double[]{1.2, 3}, + new UILabel(Toolkit.i18nText("Fine-Design_Chart_Shape")), radarType); + return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Style_Present"), panel, true); } protected VanChartLineTypePane getLineTypePane() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/range/component/GradualIntervalConfigPane.java b/designer-chart/src/main/java/com/fr/van/chart/range/component/GradualIntervalConfigPane.java index f1cdc5b62e..5fdf0d5a0f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/range/component/GradualIntervalConfigPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/range/component/GradualIntervalConfigPane.java @@ -1,11 +1,10 @@ package com.fr.van.chart.range.component; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.ilable.BoldFontTextLabel; -import com.fr.design.layout.TableLayout; import com.fr.design.mainframe.chart.gui.ColorSelectBoxWithOutTransparent; import com.fr.plugin.chart.range.GradualIntervalConfig; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.style.axis.component.MinMaxValuePaneWithOutTick; import javax.swing.JPanel; @@ -51,16 +50,10 @@ public class GradualIntervalConfigPane extends JPanel { legendGradientBar = createLegendGradientBar(); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] col = new double[]{f, e}; - double[] row = new double[]{p, p, p, p}; - Component[][] components = getPaneComponents(minMaxValuePane, colorSelectBox, numberDragPane, legendGradientBar); //控件承载面板 - JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); + JPanel contentPane = FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.2, 3}); this.setLayout(new BorderLayout()); this.add(contentPane, BorderLayout.CENTER); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/range/component/LegendLabelFormatPane.java b/designer-chart/src/main/java/com/fr/van/chart/range/component/LegendLabelFormatPane.java index eec9225f58..478d7d13d1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/range/component/LegendLabelFormatPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/range/component/LegendLabelFormatPane.java @@ -1,12 +1,12 @@ package com.fr.van.chart.range.component; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.chart.base.LegendLabelFormat; +import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.style.FormatPane; -import com.fr.design.layout.TableLayout; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartHtmlLabelPaneWithOutWidthAndHeight; import com.fr.van.chart.designer.component.format.FormatPaneWithOutFont; import com.fr.van.chart.designer.style.VanChartStylePane; @@ -47,7 +47,6 @@ public class LegendLabelFormatPane extends JPanel { } }; htmlLabelPane = new VanChartHtmlLabelPaneWithOutWidthAndHeight(); - htmlLabelPane.setBorder(BorderFactory.createEmptyBorder(0, (int) TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH + TableLayout4VanChartHelper.COMPONENT_INTERVAL, 0, 0)); centerPane = new JPanel(new CardLayout()) { @Override @@ -63,17 +62,11 @@ public class LegendLabelFormatPane extends JPanel { centerPane.add(htmlLabelPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] columnSize = {f, e}; - double[] rowSize = {p, p, p}; Component[][] components = new Component[][]{ - new Component[]{null, null}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Label_Format"), SwingConstants.LEFT), labelFormatStyle}, new Component[]{centerPane, null}, }; - JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); + JPanel contentPane = FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.2, 3}); labelFormatStyle.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -82,7 +75,7 @@ public class LegendLabelFormatPane extends JPanel { }); labelFormatStyle.setSelectedIndex(0); - JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Format"), contentPane); + JPanel panel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Format"), contentPane, true); this.setLayout(new BorderLayout()); this.add(panel, BorderLayout.CENTER); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/treemap/style/VanChartTreeMapSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/treemap/style/VanChartTreeMapSeriesPane.java index db8bfa94b1..7998a088e7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/treemap/style/VanChartTreeMapSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/treemap/style/VanChartTreeMapSeriesPane.java @@ -1,11 +1,13 @@ package com.fr.van.chart.treemap.style; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.chart.chartattr.Plot; +import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.plugin.chart.treemap.VanChartTreeMapPlot; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.multilayer.style.VanChartMultiPieSeriesPane; import javax.swing.JPanel; @@ -22,8 +24,9 @@ public class VanChartTreeMapSeriesPane extends VanChartMultiPieSeriesPane { protected JPanel createSeriesStylePane(double[] row, double[] col) { supportDrill = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Drill"), supportDrill); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel); + JPanel panel = FineLayoutBuilder.createHorizontalLayout(0, new double[]{1.2, 3}, + new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Drill")), supportDrill); + return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel, true); } protected void populatePieAttr() { diff --git a/designer-form/src/main/java/com/fr/design/widgettheme/BaseStyleSettingPane.java b/designer-form/src/main/java/com/fr/design/widgettheme/BaseStyleSettingPane.java index 14183ed2e6..280ebcb9f2 100644 --- a/designer-form/src/main/java/com/fr/design/widgettheme/BaseStyleSettingPane.java +++ b/designer-form/src/main/java/com/fr/design/widgettheme/BaseStyleSettingPane.java @@ -1,10 +1,11 @@ package com.fr.design.widgettheme; import com.fine.swing.ui.layout.Column; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.base.background.ColorBackground; import com.fr.base.theme.TemplateTheme; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.designer.IntervalConstants; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.frpane.FontSizeComboPane; import com.fr.design.gui.frpane.UIPercentDragPane; @@ -18,15 +19,12 @@ import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.style.FRFontPane; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.JTemplate; import com.fr.design.style.color.NewColorSelectBox; import com.fr.design.utils.DesignUtils; import com.fr.design.widget.FRWidgetFactory; import com.fr.form.ui.Widget; import com.fr.general.FRFont; -import com.fr.general.IOUtils; import com.fr.util.ColorUtils; import com.fr.widgettheme.theme.bean.ButtonBackground; import com.fr.widgettheme.theme.panel.ButtonStyleDefinedPane; @@ -38,7 +36,6 @@ import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants; import com.fr.widgettheme.util.WidgetStyleComponentCombiner; import com.fr.widgettheme.util.WidgetThemeDesignerUtils; -import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Color; @@ -130,8 +127,9 @@ public abstract class BaseStyleSettingPane extends BasicBeanPa protected void initPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.add(createHeadPane(), BorderLayout.NORTH); - this.add(createCustomPane(), BorderLayout.CENTER); + this.add(column(10, + cell(createHeadPane()), cell(createCustomPane()) + ).getComponent(), BorderLayout.CENTER); } @@ -145,8 +143,8 @@ public abstract class BaseStyleSettingPane extends BasicBeanPa fontNameSelectBox = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report()); fontSizePane = new FontSizeComboPane(); fontColorButton = new UIColorButton(); - bold = new UIToggleButton(IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); - italic = new UIToggleButton(IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); + bold = new UIToggleButton(new LazyIcon("bold")); + italic = new UIToggleButton(new LazyIcon("italic")); widgetBgColorSelectBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, true); widgetBgAlphaDragPane = new UIPercentDragPane(); paneMap.put(StyleSetting.THEME_COLOR, colorSelectBox); @@ -180,34 +178,14 @@ public abstract class BaseStyleSettingPane extends BasicBeanPa switchCard(); } }; - JPanel headPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ - new Component[]{headLabel, styleSettingHead}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); - headPane.setBorder(BorderFactory.createEmptyBorder(0, 0, IntervalConstants.INTERVAL_L1, 0)); - return headPane; + + return FineLayoutBuilder.createHorizontalLayout(0, new double[] {1.2, 3}, headLabel, styleSettingHead); } protected JPanel createCustomPane() { int size = styleSettingList.size(); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - int columnCount = 2; - double[] rowSize = new double[size]; - for (int i = 0; i < size; i++) { - rowSize[i] = p; - } - - double[] columnSize = {p, f}; - - int[][] rowCount = new int[size][columnCount]; - for (int i = 0; i < size; i++) { - for (int j = 0; j < columnCount; j++) { - rowCount[i][j] = 1; - } - } - - customPane = TableLayoutHelper.createGapTableLayoutPane(createComponents(size), rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); - customPane.setBorder(BorderFactory.createEmptyBorder(0, 0, IntervalConstants.INTERVAL_L1, 0)); + customPane = FineLayoutBuilder.compatibleTableLayout(10, createComponents(size), new double[]{1.2, 3}); return customPane; } diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java index 0ed7554075..93a47a9280 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java @@ -244,27 +244,27 @@ public class DesignEnvComponent { * ----------- logger -------- */ private void startLogger() { - String realPath = Carina.properties(LoggerProperties.class).getXml(); - URI uri = Log4jUtils.buildUserConfigURI(realPath); + URI uri = Log4jUtils.buildUserConfigURI(StringUtils.EMPTY); FRLogger.getLogger().config(uri); // 日志配置更新的监听在FRLogger里面,fbp去掉了但是设计器本地还是需要这个监听的,初始化的时候监听一下 listenConfig(); } private void listenConfig() { - ValidateConfigManger.getInstance().registerListener(new ConfigChangeListener() { - - @Override - public boolean accept(Class configClass) { - return configClass.equals(Log4jConfig.class); - } - - @Override - public void change() { - // The root logger is the topmost logger with a name of "" (the empty string). - Configurator.setAllLevels("", Log4jConfig.getInstance().getRootLevel()); - } - }); +/// 等fbp改完,现在先配合打包注释掉 +// ValidateConfigManger.getInstance().registerListener(new ConfigChangeListener() { +// +// @Override +// public boolean accept(Class configClass) { +// return configClass.equals(Log4jConfig.class); +// } +// +// @Override +// public void change() { +// // The root logger is the topmost logger with a name of "" (the empty string). +// Configurator.setAllLevels("", Log4jConfig.getInstance().getRootLevel()); +// } +// }); } 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 6c584ca3a3..63de9d0d27 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 @@ -7,7 +7,7 @@ import com.fanruan.carina.annotions.Start; import com.fanruan.messenger.ums.config.email.FineEmailSecurityProviderImpl; import com.fr.base.email.EmailCenter; import com.fr.base.email.impl.EmailAccountManagerImpl; -import com.fr.base.email.impl.FREmailDispatcherImpl; +import com.fr.base.email.impl.EmailDispatcherImpl; import com.fr.base.email.impl.FineEmailExtensionProviderImpl; import com.fr.base.email.impl.FineEmailResourceProviderImpl; import com.fr.base.email.provider.FineEmailExtensionProvider; @@ -78,7 +78,7 @@ public class DesignFunctionComponent { fineEmailExtensionProvider, fineEmailResourceProvider, new FineEmailSecurityProviderImpl()); - EmailCenter.setDispatcher(new FREmailDispatcherImpl()); + EmailCenter.setDispatcher(new EmailDispatcherImpl()); EmailCenter.setAccountManager(new EmailAccountManagerImpl()); EmailTaskManagement.getInstance().start(); } 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 eca6315272..06459b8fe3 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 @@ -61,7 +61,7 @@ import com.fr.tenant.config.TenantConfigProvider; import com.fr.tenant.context.CurrentTenantProviderStater; import com.fr.tenant.context.TenantContext; import com.fr.tenant.context.provider.CurrentTenantKey; -import com.fr.tenant.store.impl.DefaultTenantStorage; +import com.fr.tenant.store.impl.MemoryTenantStorage; import com.fr.workspace.WorkContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -208,7 +208,7 @@ public class DesignPreStartComponent { private void startTenant() { - TenantContext.registerStorage(new DefaultTenantStorage()); + TenantContext.registerStorage(new MemoryTenantStorage()); TenantContext.registerConfigProvider(new TenantConfigProvider() { @Override public boolean isMultiTenantOpen() { diff --git a/designer-realize/src/main/java/com/fanruan/data/ConnectionConfigWrapper.java b/designer-realize/src/main/java/com/fanruan/data/ConnectionConfigWrapper.java index 8c4a9e7b6b..68516dd7b8 100644 --- a/designer-realize/src/main/java/com/fanruan/data/ConnectionConfigWrapper.java +++ b/designer-realize/src/main/java/com/fanruan/data/ConnectionConfigWrapper.java @@ -3,10 +3,13 @@ package com.fanruan.data; import com.fanruan.config.impl.data.ConnectionConfigProvider; import com.fanruan.config.impl.data.ConnectionConfigWriter; import com.fr.data.impl.Connection; +import com.fr.design.data.datapane.preview.ConnectionInfoBeanHelper; import com.fr.file.ConnectionConfig; import com.fr.log.FineLoggerFactory; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerAdaptor; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.repository.connection.ConnectionRepository; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -106,7 +109,7 @@ public class ConnectionConfigWrapper implements ConnectionConfigProvider, Connec @Override public @Nullable Connection getConnection(@NotNull String connectionName) { - Connection connection = ConnectionConfig.getInstance().getConnection(connectionName); + Connection connection = WorkContext.getCurrent().isLocal() ? ConnectionConfig.getInstance().getConnection(connectionName) : ConnectionInfoBeanHelper.createConnection(ConnectionRepository.getInstance().getByName(connectionName));; if (connection != null) { connection.setConnectionName(connectionName); } diff --git a/designer-realize/src/main/java/com/fanruan/fs/DesignFileRepository.java b/designer-realize/src/main/java/com/fanruan/fs/DesignFileRepository.java index 07c68918fa..7947989a0a 100644 --- a/designer-realize/src/main/java/com/fanruan/fs/DesignFileRepository.java +++ b/designer-realize/src/main/java/com/fanruan/fs/DesignFileRepository.java @@ -7,6 +7,9 @@ import com.fr.stable.project.ProjectConstants; import com.fr.workspace.server.entity.resource.ResourceBean; import com.fr.workspace.server.repository.resource.PublicResourceRepository; +import java.io.ByteArrayInputStream; +import java.io.InputStream; + /** * DesignFileRepository @@ -31,4 +34,9 @@ public class DesignFileRepository extends LocalFileRepository { public FineFileEntry[] listEntry(String dir) { return PublicResourceRepository.getInstance().listEntry(new ResourceBean(dir)); } + + @Override + public InputStream openStream(String path) { + return new ByteArrayInputStream(PublicResourceRepository.getInstance().openStream(path)); + } } diff --git a/designer-realize/src/main/java/com/fr/design/cell/editor/BiasTextPainterCellEditor.java b/designer-realize/src/main/java/com/fr/design/cell/editor/BiasTextPainterCellEditor.java index 1a578638c8..57f29e2c71 100644 --- a/designer-realize/src/main/java/com/fr/design/cell/editor/BiasTextPainterCellEditor.java +++ b/designer-realize/src/main/java/com/fr/design/cell/editor/BiasTextPainterCellEditor.java @@ -4,8 +4,8 @@ package com.fr.design.cell.editor; import com.fine.swing.ui.layout.Layouts; -import com.fine.theme.light.ui.FineRoundBorder; import com.fine.theme.utils.FineUIScale; +import com.fr.design.border.FineBorderFactory; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIRadioButton; @@ -84,7 +84,7 @@ public class BiasTextPainterCellEditor extends AbstractCellEditor { Window parentWindow = SwingUtilities.getWindowAncestor(grid); this.biasTextPainterPane = new BiasTextPainterPane(); - Dimension wrapDimension = FineUIScale.scale(new Dimension(360, 172)); + Dimension wrapDimension = FineUIScale.scale(new Dimension(360, 212)); this.biasTextPainterPane.populate(biasTextPainter); return this.biasTextPainterPane.showWindowWithCustomSize(parentWindow, new DialogActionAdapter() { @@ -113,7 +113,7 @@ public class BiasTextPainterCellEditor extends AbstractCellEditor { formulaTextArea = new UITextArea(); JScrollPane scrollPane = new JScrollPane(formulaTextArea); - scrollPane.setBorder(new FineRoundBorder()); + scrollPane.setBorder(FineBorderFactory.createWrappedRoundBorder()); formulaTextArea.setBorder(null); String leftToLowerText = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Slope_Line_Upper_Left_To_Lower_Right"); @@ -130,8 +130,8 @@ public class BiasTextPainterCellEditor extends AbstractCellEditor { group.add(choice2); add(Layouts.column(10, - Layouts.cell(formulaLabel).weight(0.1), Layouts.cell(scrollPane).weight(0.12), - Layouts.row(5, Layouts.cell(choice1).weight(1), Layouts.cell(choice2).weight(1)).weight(0.12)).getComponent()); + Layouts.cell(formulaLabel), Layouts.cell(scrollPane).weight(1), + Layouts.row(5, Layouts.cell(choice1).weight(1), Layouts.cell(choice2).weight(1))).getComponent()); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java index 5fdc4b011b..27d0a202a4 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.form; +import com.formdev.flatlaf.ui.FlatRoundBorder; import com.fr.base.DynamicUnitList; import com.fr.base.ScreenResolution; import com.fr.design.cell.bar.DynamicScrollBar; @@ -11,9 +12,7 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerUIModeConfig; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.JDashboard; -import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.JFormSliderPane; -import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplateProvider; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.form.FormElementCaseContainerProvider; @@ -59,6 +58,7 @@ public class FormReportComponentComposite extends JComponent implements TargetMo this.elementCaseDesigner.elementCasePane.getGrid().addMouseWheelListener(new FormReportComponentCompositeMouseWheelHandler(this)); elementCaseDesigner.addTargetModifiedListener(this); this.jSliderContainer.setShowValue((ScreenResolution.getScreenResolution() * HUND) / Constants.DEFAULT_WEBWRITE_AND_SCREEN_RESOLUTION); + setBorder(new FlatRoundBorder()); } public FormReportComponentComposite(BaseJForm jform, FormElementCaseDesigner elementCaseDesign, FormElementCaseContainerProvider ecContainer) { diff --git a/designer-realize/src/main/java/com/fr/design/report/freeze/FormECRepeatAndFreezeSettingPane.java b/designer-realize/src/main/java/com/fr/design/report/freeze/FormECRepeatAndFreezeSettingPane.java index 6e53599492..7ccc8771c6 100644 --- a/designer-realize/src/main/java/com/fr/design/report/freeze/FormECRepeatAndFreezeSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/freeze/FormECRepeatAndFreezeSettingPane.java @@ -30,6 +30,7 @@ public class FormECRepeatAndFreezeSettingPane extends RepeatAndFreezeSettingPane protected void addWriteFrozen(JPanel freezePanel, JPanel pagePanel) { super.initWriteFrozenPane(); + this.add(pagePanel); } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/CheckBoxDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/CheckBoxDefinePane.java index 85e5272eb5..51a4c6e117 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/CheckBoxDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/CheckBoxDefinePane.java @@ -7,7 +7,6 @@ import com.fr.design.fun.WidgetAdvancedPaneProvider; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; import com.fr.design.widgettheme.processor.WidgetThemeCreatorPaneAdder; import com.fr.form.ui.CheckBox; import com.fr.general.GeneralContext; @@ -37,8 +36,6 @@ public class CheckBoxDefinePane extends AbstractDataModify { protected final List> extraPaneList = new ArrayList<>(); protected JPanel extraPane; - protected static double F = TableLayout.FILL; - protected static double P = TableLayout.PREFERRED; public CheckBoxDefinePane() { this.iniComponents(); @@ -51,24 +48,16 @@ public class CheckBoxDefinePane extends AbstractDataModify { JPanel content = new JPanel(new BorderLayout()); - if (extraPane == null) { - content.add( - row( - cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text"))).weight(LEFT_WEIGHT), - cell(text).weight(RIGHT_WEIGHT) - ).getComponent() - ); - } else { - content.add( - column( - 10, - row( - cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text"))).weight(LEFT_WEIGHT), - cell(text)).weight(RIGHT_WEIGHT), - row(cell(extraPane)) - ).getComponent() - ); - } + content.add( + column( + 10, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text"))).weight(LEFT_WEIGHT), + cell(text).weight(RIGHT_WEIGHT) + ), + cell(extraPane) + ).getComponent() + ); UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 24, content); this.add(uiExpandablePane); } diff --git a/designer-realize/src/main/java/com/fr/start/module/optimized/ConfigurationActivator4Designer.java b/designer-realize/src/main/java/com/fr/start/module/optimized/ConfigurationActivator4Designer.java index 5a01fed354..60ad6922bb 100644 --- a/designer-realize/src/main/java/com/fr/start/module/optimized/ConfigurationActivator4Designer.java +++ b/designer-realize/src/main/java/com/fr/start/module/optimized/ConfigurationActivator4Designer.java @@ -1,11 +1,7 @@ package com.fr.start.module.optimized; import com.fr.config.activator.ConfigurationActivator; -import com.fr.config.dao.DaoContext; import com.fr.config.dao.DaoSelectorFactory; -import com.fr.config.dao.impl.remote.PropertiesClassHelperDao; -import com.fr.config.dao.impl.remote.PropertiesEntityDao; -import com.fr.config.dao.impl.remote.PropertiesXmlEntityDao; import com.fr.transaction.PropertiesTransactor; import com.fr.transaction.TransactorFactory; @@ -20,9 +16,6 @@ public class ConfigurationActivator4Designer extends ConfigurationActivator { protected void initLocalDao() { if (DaoSelectorFactory.getDaoSelector().useCacheDao()) { TransactorFactory.setTransactor(new PropertiesTransactor()); - DaoContext.setClassHelperDao(new PropertiesClassHelperDao()); - DaoContext.setEntityDao(new PropertiesEntityDao()); - DaoContext.setXmlEntityDao(new PropertiesXmlEntityDao()); } else { super.initLocalDao(); }