diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java b/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java index c749bf5f3c..fdf9b4cbe2 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java @@ -44,6 +44,9 @@ import static com.formdev.flatlaf.util.UIScale.scale; */ public class FineUIUtils { + public static final String LEFT = "LEFT"; + public static final String RIGHT = "RIGHT"; + public static final int RETINA_SCALE_FACTOR = 2; /** @@ -212,17 +215,48 @@ public class FineUIUtils { */ public static void paintPartRoundButtonBorder(Component c, Graphics2D g2, int x, int y, int width, int height, float borderWidth, float arc) { + if (isLeftRoundButton(c)) { + paintPartRoundButtonBorder(g2, x, y, width, height, borderWidth, arc, LEFT, false); + } else { + paintPartRoundButtonBorder(g2, x, y, width, height, borderWidth, arc, RIGHT, false); + } + } + + /** + * 绘制部分圆角矩形边框 + * + * @param g2 Graphics2D + * @param x x坐标 + * @param y y坐标 + * @param width 宽度 + * @param height 高度 + * @param borderWidth 边框宽度 + * @param arc 圆角 + * @param roundPart 圆角的方位,当前只能设置一侧 + * @param closedPath 是否封闭,非圆角那一侧是否有边框,是为有边框 + */ + public static void paintPartRoundButtonBorder(Graphics2D g2, int x, int y, int width, int height, + float borderWidth, float arc, String roundPart, boolean closedPath) { FlatUIUtils.setRenderingHints(g2); arc = scale(arc); float t = scale(borderWidth); float t2x = t * 2; Path2D path2D = new Path2D.Float(Path2D.WIND_EVEN_ODD); - if (isLeftRoundButton(c)) { - path2D.append(createLeftRoundRectangle(x, y, width, height, arc), false); - path2D.append(createLeftRoundRectangle(x + t, y + t, width - t, height - t2x, arc - t), false); - } else { - path2D.append(createRightRoundRectangle(x, y, width, height, arc), false); - path2D.append(createRightRoundRectangle(x, y + t, width - t, height - t2x, arc - t), false); + switch (roundPart) { + + case LEFT: { + path2D.append(createLeftRoundRectangle(x, y, width, height, arc), false); + path2D.append(createLeftRoundRectangle(x + t, y + t, + width - (closedPath ? t2x : t), height - t2x, arc - t), false); + break; + } + case RIGHT: + default: { + path2D.append(createRightRoundRectangle(x, y, width, height, arc), false); + path2D.append(createRightRoundRectangle(x + (closedPath ? t : 0), y + t, + width - (closedPath ? t2x : t), height - t2x, arc - t), false); + break; + } } g2.fill(path2D); } @@ -452,6 +486,7 @@ public class FineUIUtils { /** * 创建一个支持自动换行的提示文本 + * * @param text 显示的文本内容 * @return 自动换行提示文本 */ diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 387c01bb9b..89b0b9fac0 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -104,12 +104,12 @@ import java.util.concurrent.atomic.AtomicBoolean; * The manager of Designer GUI. * 下面的作者日期都是随手写的,具体作者已经无法考究。 * - * @author anonymous - * @version 11.0 + * @author anonymous + * @version 11.0 * created by anonymous on 2002/11/08 */ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReadable { - + private static final int MAX_SHOW_NUM = 10; private static final String VERSION_80 = "80"; private static final String VERSION_90 = "90"; @@ -122,26 +122,26 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada * 指定默认工作空间 */ public static final String DEFAULT_WORKSPACE_PATH = "fr.designer.workspace.default"; - + public static final String LAST_EAST_REGION_LAYOUT = "LastEastRegionLayout"; public static final String LAST_WEST_REGION_LAYOUT = "LastWestRegionLayout"; - + private static DesignerEnvManager designerEnvManager; // gui. private String activationKey = null; private String logLocation = null; private Rectangle windowBounds = null; // window bounds. private String DialogCurrentDirectory = null; private String CurrentDirectoryPrefix = null; - + private Map> recentOpenedFileListMap = new HashMap<>(); private List tempRecentOpenedFilePathList = new ArrayList(); private XmlElement>> recentOpenedMapping = SimpleXmlElement.of(recentOpenedFileListMap); - + private boolean showPaintToolBar = true; private int maxNumberOrPreviewRow = 200; - + private XmlElement envConfig = SimpleXmlElement.of(new EnvConfiguration()); - + private boolean showProjectPane = true; private boolean showDataPane = true; //p:这是当前选择的数据库连接的名字,这个在新建数据源的时候用到. @@ -195,12 +195,12 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada private boolean embedServerLazyStartup = false; //最近使用的颜色 private ColorSelectConfigManager configManager = new ColorSelectConfigManager(); - + /** * 环境检测配置 */ private EnvDetectorConfig envDetectorConfig = EnvDetectorConfig.getInstance(); - + /** * alphafine */ @@ -214,11 +214,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada private DesignerPushUpdateConfigManager designerPushUpdateConfigManager = DesignerPushUpdateConfigManager.getInstance(); private VcsConfigManager vcsConfigManager = VcsConfigManager.getInstance(); - + private DesignerStartupConfig designerStartupConfig = DesignerStartupConfig.getInstance(); private SwitchForSwingChecker switchForSwingChecker = SwitchForSwingChecker.getInstance(); - + public static final String CAS_CERTIFICATE_PATH = "certificatePath"; public static final String CAS_CERTIFICATE_PASSWORD = "certificatePass"; @@ -267,7 +267,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada designerEnvManager = new DesignerEnvManager(); //REPORT-15332有一个国际化调用比较早,需要在这边就设置好locale,由于后台GeneralContext默认是China GeneralContext.setLocale(designerEnvManager.getLanguage()); - + if (!asyncInitEnvManager()) { // 如果异步读取失败, 则恢复原来的逻辑 compatibleInitEnvManager(); @@ -287,9 +287,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada return designerEnvManager; } - + private static void compatibleInitEnvManager() { - + try { XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile()); } catch (FileNotFoundException e) { @@ -299,7 +299,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada FineLoggerFactory.getLogger().error(e.getMessage(), e); } } - + /** * 异步初始化环境管理, 提供配置, 帮助处理预期外的问题 * 1-当优化开启时,才走异步逻辑 @@ -308,7 +308,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada * @return 是/否 */ private static boolean asyncInitEnvManager() { - + AtomicBoolean noEx = new AtomicBoolean(false); OptimizeUtil.initiateOpen(DesignerEnvManager.class.getSimpleName().toLowerCase(), () -> { try { @@ -326,7 +326,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada } public static void checkNameEnvMap() { - + if (designerEnvManager == null || designerEnvManager.getNameEnvMap().size() > 0) { return; } @@ -1060,11 +1060,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada public void setLanguage(Locale locale) { this.language = locale; } - + public boolean isStartupPageEnabled() { return this.designerStartupConfig.isEnabled(); } - + public void setStartupPageEnabled(boolean enabled) { this.designerStartupConfig.setEnabled(enabled); } @@ -1191,9 +1191,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada public void setCurrentDirectoryPrefix(String prefix) { this.CurrentDirectoryPrefix = prefix; } - + public List getRecentOpenedFilePathList4Env(String envName) { - + if (StringUtils.isEmpty(envName)) { return tempRecentOpenedFilePathList; } else { @@ -1201,7 +1201,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada recentOpenedMapping.getValue().put(envName, tempRecentOpenedFilePathList); } } - + return recentOpenedMapping.getValue().get(envName); } @@ -1209,7 +1209,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada * 返回最近打开的文件路径列表 */ public List getRecentOpenedFilePathList() { - + return this.getRecentOpenedFilePathList4Env(getCurEnvName()); } @@ -1713,7 +1713,16 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada } } } - Carina.config(LanguageConfigProvider.class).setLocale(CommonUtils.localeToString(designerEnvManager.getLanguage())); + setLocale(); + } + + private static void setLocale() { + try { + Carina.config(LanguageConfigProvider.class) + .setLocale(CommonUtils.localeToString(designerEnvManager.getLanguage())); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } } @@ -1853,10 +1862,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada public void setLayoutTemplateStyle(int layoutTemplateStyle) { this.layoutTemplateStyle = layoutTemplateStyle; } - + @Override public void initElements(File xmlFile) throws XmlException { - + try { backupOldXmlFile(); XmlInitialFactory xmlInitialFactory = XmlInitialFactory.create(xmlFile); @@ -1876,7 +1885,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada }); }) .init("EnvConfigMap", (e) -> { - + final EnvConfiguration previousConfig = this.envConfig.getValue(); this.envConfig = AsyncXmlElement.of(DesignerStartupPool.common(), () -> { DesignerEnvManager.this.readEnvConfigMap(e, previousConfig); @@ -1928,13 +1937,13 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada throw new XmlException(e); } } - + /** * 备份老的 xml 文件, 防止第一次修改存在问题 * 但是,只备份一次。其他都走老逻辑 */ private void backupOldXmlFile() { - + try { File oldFile = getEnvFile(); String newFilePath = ProductConstants.getEnvHome() + File.separator + ProductConstants.APP_NAME + "Env_backup.xml"; @@ -1948,7 +1957,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada } catch (Exception ignored) { } } - + /** * Read XML.
* The method will be invoked when read data from XML file.
@@ -2040,16 +2049,16 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada } private void readAlphaFineAttr(XMLableReader reader) { - + AlphaFineConfigManager config = AlphaFineConfigManager.getInstance(); reader.readXMLObject(config); this.alphaFineConfigManager = SimpleXmlElement.of(config); } - + private void readEnvDetectorConfig(XMLableReader reader) { reader.readXMLObject(this.envDetectorConfig); } - + private void readStartupConfig(XMLableReader reader) { reader.readXMLObject(this.designerStartupConfig); } @@ -2165,9 +2174,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada this.setPaginationLineColor(new Color(Integer.parseInt(tmpVal))); } } - + private void readEnvConfigMap(XMLableReader reader, EnvConfiguration envConfigs) { - + String currentEnv = reader.getAttrAsString("currentEnv", StringUtils.EMPTY); envConfigs.setCurEnvName(currentEnv); reader.readXMLObject(new XMLReadable() { @@ -2232,15 +2241,15 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada } }); } - + private void readRecentOpenFileList(XMLableReader reader) { - + readRecentOpenFileList0(reader); checkRecentOpenedFileNum(); } private void readRecentOpenFileList0(XMLableReader reader) { - + reader.readXMLObject(new XMLReadable() { @Override public void readXML(XMLableReader reader) { @@ -2358,13 +2367,13 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada writer.end(); } } - + private void writeEnvDetectorConfig(XMLPrintWriter writer) { if (this.envDetectorConfig != null) { this.envDetectorConfig.writeXML(writer); } } - + private void writeStartupConfig(XMLPrintWriter writer) { if (this.designerStartupConfig != null) { this.designerStartupConfig.writeXML(writer); @@ -2630,7 +2639,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada } private void readFvsDesignerConfig(XMLableReader reader) { - + SimpleDesignerConfig config = fvsDesignerConfig.getValue(); reader.readXMLObject(config); fvsDesignerConfig = SimpleXmlElement.of(config); @@ -2672,39 +2681,39 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada public SnapChatConfig getSnapChatConfig() { return snapChatConfig; } - + private EnvConfiguration getEnvConfig() { - + return envConfig.getValue(); } - + private Map getNameEnvMap() { - + return getEnvConfig().getNameEnvMap(); } - + private static class EnvConfiguration { - + // name和Env的键值对 private Map nameEnvMap = new ListMap<>(); // marks: 当前报表服务器名字 private String curEnvName = null; - + public Map getNameEnvMap() { return nameEnvMap; } - + public void setNameEnvMap(Map nameEnvMap) { this.nameEnvMap = nameEnvMap; } - + public String getCurEnvName() { return curEnvName; } - + public void setCurEnvName(String curEnvName) { this.curEnvName = curEnvName; } } - + } diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 4761002648..e2a08bbbc3 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -180,8 +180,9 @@ public class EnvChangeEntrance { private boolean doSwitch2Env(final String envName, PopTipStrategy strategy) { DesignerWorkspaceInfo selectedEnv = getSelectedEnv(envName); - EnvBackupHelper.getInstance().backup(); + try { + EnvBackupHelper.getInstance().backup(); Workspace workspace = DesignerWorkspaceGenerator.generate(selectedEnv); if (notValid(workspace, selectedEnv)) { return false; diff --git a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java index 34daece1dd..138ab32295 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java @@ -25,6 +25,7 @@ import com.fr.esd.event.DSMapping; import com.fr.esd.event.DsNameTarget; import com.fr.esd.event.StrategyEventsNotifier; +import com.fr.log.FineLoggerFactory; import com.fr.report.LockItem; import com.fr.security.encryption.transmission.TransmissionEncryptionManager; import com.fr.workspace.server.repository.connection.ConnectionRepository; @@ -86,14 +87,13 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS final List beans = TableDataRepository.getInstance().getAllTableData(); final Map connectionMap = ConnectionInfoBeanHelper.createConnectionMap(ConnectionRepository.getInstance().getAll()); final Map tableDataMap = new HashMap<>(); - try { - for (ServerDataSetBean bean : beans) { + for (ServerDataSetBean bean : beans) { + try { tableDataMap.put(bean.getDatasetName() , TableDataBeanHelper.getTableDataSet(connectionMap, bean.getDatasetType(), bean.getDatasetData())); + } catch (Exception e) { + FineLoggerFactory.getLogger().error("[TableData] getTableData :{} failed!", bean.getDatasetName(), e); } - } catch (Exception e) { - throw new RuntimeException(e); } - final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() { public void complete() { populate(tableDataMap); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java index 96b9cd2cb0..5efb20ff34 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java @@ -1022,7 +1022,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { @Override public void actionPerformed(ActionEvent e) { - dgEdit(getTableDataInstance().creatTableDataPane(), createDsName(getNamePrefix()), false); + DesignCacheManager.processByCacheTableData(() -> dgEdit(getTableDataInstance().creatTableDataPane(), createDsName(getNamePrefix()), false)); } } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java index a7f606a141..fed8b1269e 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java @@ -349,25 +349,6 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh } } - private boolean saveByOldWay(List removedConnNames, List addedOrUpdatedConnections) { - final int remaining = ConnectionConfigProviderFactory.getConfigProvider().getRemainingCon(removedConnNames.size(), addedOrUpdatedConnections.size()); - try { - removedConnNames.forEach(n -> ConnectionConfigWriterFactory.getConfigWriter().removeConnection(n)); - int innerRemaining = remaining; - for (ConnectionBean cb : addedOrUpdatedConnections) { - if (innerRemaining > 0) { - ConnectionConfigWriterFactory.getConfigWriter().addConnectionWithoutCheck(cb.getName(), cb.getConnection()); - innerRemaining--; - } else { - break; - } - } - return true; - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - return false; - } public static void showDialog(Window parent) { final Map connectionMap = ConnectionInfoBeanHelper.createConnectionMap(ConnectionRepository.getInstance().getAll()); 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 33e085beb3..2fb5832c57 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 @@ -82,16 +82,19 @@ public class ConnectionInfoBeanHelper { * 根据bean创建连接 */ public static Connection createConnection(ConnectionInfoBean infoBean) { + Connection connection = null; try { if (JDBCConnectionProcessor.KEY.acceptConnectionTypes().contains(infoBean.getConnectionType())) { - return createJDBCConnection(infoBean); + connection = createJDBCConnection(infoBean); } else { - return ConnectionProcessorFactory.createConnection(infoBean, true); + connection = ConnectionProcessorFactory.createConnection(infoBean, true); } + connection.setConnectionName(infoBean.getConnectionName()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); - return null; + return connection; } + return connection; } /** 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 e1d9263c90..650291ba36 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 @@ -188,6 +188,10 @@ public class ProcedureDataPane extends AbstractTableDataPane imp } private boolean isAutoParameterDatabase() { + String name = connectionTableProcedurePane.getSelectedDatabaseConnnectonName(); + if (StringUtils.isEmpty(name)) { + return false; + } 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/gui/columnrow/ColumnRowPane.java b/designer-base/src/main/java/com/fr/design/gui/columnrow/ColumnRowPane.java index d23a1fd22f..6f0fd085aa 100644 --- a/designer-base/src/main/java/com/fr/design/gui/columnrow/ColumnRowPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/columnrow/ColumnRowPane.java @@ -1,32 +1,22 @@ package com.fr.design.gui.columnrow; -import com.fine.theme.utils.FineUIUtils; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; -import com.fr.design.gui.ispinner.ColumnRowSpinner; -import com.fr.design.gui.ispinner.UIBasicSpinner; -import com.fr.design.gui.ispinner.UpperCaseSpinner; -import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.design.gui.ispinner.FineUpperCaseSpinner; +import com.fr.design.gui.ispinner.UISpinner; + import com.fr.general.ComparatorUtils; import com.fr.stable.ColumnRow; import com.fr.stable.StableUtils; -import com.fr.stable.StringUtils; -import javax.swing.JFormattedTextField; import javax.swing.JPanel; -import javax.swing.SpinnerListModel; -import javax.swing.JSpinner.DefaultEditor; + import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import javax.swing.text.AbstractDocument; -import javax.swing.text.AttributeSet; -import javax.swing.text.BadLocationException; -import javax.swing.text.DocumentFilter; + import java.awt.BorderLayout; -import java.awt.Dimension; import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.fix; @@ -40,29 +30,17 @@ import static com.fine.swing.ui.layout.Layouts.row; public class ColumnRowPane extends JPanel implements UIObserver { private static final long serialVersionUID = 1L; - private static String[] columnarray = new String[1000]; - private static String[] rowarray = new String[5000]; - - protected UpperCaseSpinner columnSpinner; - protected UIBasicSpinner rowSpinner; - - static { - for (int i = 1; i <= 1000; i++) { - columnarray[i - 1] = StableUtils.convertIntToABC(i); - } - for (int i = 1; i <= 5000; i++) { - rowarray[i - 1] = StringUtils.EMPTY + i; - } - } + protected FineUpperCaseSpinner columnSpinner; + protected UISpinner rowSpinner; protected DocumentListener d = new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { - String rolText = ((DefaultEditor) columnSpinner.getEditor()).getTextField().getText(); - String rowText = ((DefaultEditor) rowSpinner.getEditor()).getTextField().getText(); + String rolText = columnSpinner.getTextFieldNew().getText(); + String rowText = rowSpinner.getTextField().getText(); if (rolText == null || rolText.length() == 0 || rowText == null || rowText.length() == 0) { return; } @@ -73,8 +51,8 @@ public class ColumnRowPane extends JPanel implements UIObserver { @Override public void insertUpdate(DocumentEvent e) { - int col = StableUtils.convertABCToInt(((DefaultEditor) columnSpinner.getEditor()).getTextField().getText()) - 1; - int row = Integer.parseInt(((DefaultEditor) rowSpinner.getEditor()).getTextField().getText()) - 1; + int col = StableUtils.convertABCToInt(columnSpinner.getTextFieldNew().getText()) - 1; + int row = Integer.parseInt(rowSpinner.getTextField().getText()) - 1; setColumnRow(ColumnRow.valueOf(col, row)); } @@ -128,58 +106,21 @@ public class ColumnRowPane extends JPanel implements UIObserver { protected void initRowSpinner() { - rowSpinner = new ColumnRowSpinner((new SpinnerListModel(rowarray))) { - public boolean shouldResponseChangeListener() { - return false; - } - - }; - rowSpinner.setBackground(FineUIUtils.getUIColor("background.normal", "background.normal")); - JFormattedTextField rftf = GUICoreUtils.getSpinnerTextField(rowSpinner); - if (rftf != null) { - rftf.setColumns(4); // specify more width than we need - rftf.setHorizontalAlignment(UITextField.LEFT); - } + rowSpinner = new UISpinner(1, 5000, 1); } protected void initColSpinner() { - SpinnerListModel columnSpinnerListModel = new SpinnerListModel(columnarray); - columnSpinner = new UpperCaseSpinner(columnSpinnerListModel) { - public boolean shouldResponseChangeListener() { - return false; - } - }; - columnSpinner.setBackground(FineUIUtils.getUIColor("background.normal", "background.normal")); - JFormattedTextField cftf = GUICoreUtils.getSpinnerTextField(columnSpinner); - if (cftf != null) { - cftf.setColumns(3); // specify more width than we need - cftf.setHorizontalAlignment(UITextField.LEFT); - }else { - throw new IllegalArgumentException("Spinner'Editor can not be null!"); - } - - ((AbstractDocument) cftf.getDocument()).setDocumentFilter(new DocumentFilter() { - public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr) throws BadLocationException { - fb.insertString(offset, string.toUpperCase(), attr); - } - - public void replace(FilterBypass fb, int offset, int length, String string, AttributeSet attr) throws BadLocationException { - if (string != null) { - string = string.toUpperCase(); - } - fb.replace(offset, length, string, attr); - } - }); + columnSpinner = new FineUpperCaseSpinner(1, 5000, 1); } protected void addDocumentListener(DocumentListener l) { - ((DefaultEditor) columnSpinner.getEditor()).getTextField().getDocument().addDocumentListener(l); - ((DefaultEditor) rowSpinner.getEditor()).getTextField().getDocument().addDocumentListener(l); + columnSpinner.getTextFieldNew().getDocument().addDocumentListener(l); + rowSpinner.getTextField().getDocument().addDocumentListener(l); } private void removeDocumentListener(DocumentListener l) { - ((DefaultEditor) columnSpinner.getEditor()).getTextField().getDocument().removeDocumentListener(l); - ((DefaultEditor) rowSpinner.getEditor()).getTextField().getDocument().removeDocumentListener(l); + columnSpinner.getTextFieldNew().getDocument().removeDocumentListener(l); + rowSpinner.getTextField().getDocument().removeDocumentListener(l); } /** @@ -208,17 +149,13 @@ public class ColumnRowPane extends JPanel implements UIObserver { column = 0; } removeDocumentListener(d); - String colValue = StableUtils.convertIntToABC(column + 1); - columnSpinner.setValue(colValue); - ((DefaultEditor) columnSpinner.getEditor()).getTextField().setText(colValue); + columnSpinner.setValue(column+1); int row = columnRow.getRow(); // shoc 小于0就蹦了 if (row < 0) { row = 0; } - String rowValue = Integer.toString(row + 1); - rowSpinner.setValue(rowValue); - ((DefaultEditor) rowSpinner.getEditor()).getTextField().setText(rowValue); + rowSpinner.setValue(row+1); addDocumentListener(d); fireChanged(); } 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 682e68be7d..50c050b013 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 @@ -123,7 +123,7 @@ public class TableViewList extends UIList { if (refresh) { clearCache(datasource); } - return processDataInAnotherThread(databaseName, searchFilter, typesFilter); + return processDataInAnotherThread(datasource, searchFilter, typesFilter); } @Override @@ -144,7 +144,7 @@ public class TableViewList extends UIList { } private void clearCache(Connection datasource) { - String[] schemas = DataCoreUtils.getDatabaseSchema(datasource); + String[] schemas = DataCoreUtils.getDatabaseSchemaByName(datasource); schemas = (schemas == null || schemas.length == 0) ? new String[]{null} : schemas; for (String schema : schemas) { doClearCache(datasource, schema); @@ -166,18 +166,17 @@ public class TableViewList extends UIList { * @param searchFilter * @param typesFilter */ - private DefaultListModel processDataInAnotherThread(String databaseName, String searchFilter, String... typesFilter) throws Exception { + private DefaultListModel processDataInAnotherThread(Connection datasource, String searchFilter, String... typesFilter) throws Exception { DefaultListModel defaultListModel = new DefaultListModel(); - Connection datasource = ConnectionInfoBeanHelper.createConnection(ConnectionRepository.getInstance().getByName(databaseName)); if (datasource == null) { return defaultListModel; } - String[] schemas = DataCoreUtils.getDatabaseSchema(datasource); + String[] schemas = DataCoreUtils.getDatabaseSchemaByName(datasource); searchFilter = searchFilter.toLowerCase(); boolean isOracleSystemSpace = DesignerEnvManager.getEnvManager().isOracleSystemSpace(); // oracle不勾选显示所有表,则只显示用户下的(包括存储过程和table表) - DataBaseDetail detail = DataOperator.getInstance().getDataBaseDetail(datasource, isOracleSystemSpace); + DataBaseDetail detail = DataOperator.getInstance().getDataBaseDetail(datasource.getConnectionName(), isOracleSystemSpace); if (ArrayUtils.isNotEmpty(detail.getSchemas())) { schemas = detail.getSchemas(); } diff --git a/designer-base/src/main/java/com/fr/design/gui/ispinner/FineUpperCaseSpinner.java b/designer-base/src/main/java/com/fr/design/gui/ispinner/FineUpperCaseSpinner.java new file mode 100644 index 0000000000..72929d6c76 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ispinner/FineUpperCaseSpinner.java @@ -0,0 +1,152 @@ +package com.fr.design.gui.ispinner; + +import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; + +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import javax.swing.text.AbstractDocument; +import javax.swing.text.AttributeSet; +import javax.swing.text.BadLocationException; +import javax.swing.text.DocumentFilter; +import java.awt.BorderLayout; +import java.awt.Insets; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/** + * 字母spinner + * + * @author Renekton + * @since 11.0 + * @Created on 2024/09/11 + */ +public class FineUpperCaseSpinner extends UISpinner { + + private UITextField textField; + + public FineUpperCaseSpinner(double minValue, double maxValue, double dierta) { + super(minValue, maxValue, dierta); + } + + protected void initComponents() { + setLayout(new BorderLayout()); + textField = initTextField(); + Insets insets = FineUIUtils.getUIInsets("InputTextField.borderInsets", defaultInsets); + textField.setBorder(new ScaledEmptyBorder(insets.top, insets.left, insets.bottom, insets.right)); + textField.setOpaque(false); + add(textField, BorderLayout.CENTER); + setValue(value); + + initArrowPane(); + componentInitListeners(); + } + + protected void setTextField(double value) { + textField.getDocument().removeDocumentListener(docListener); + textField.setText(StableUtils.convertIntToABC((int)value).toUpperCase()); + textField.getDocument().addDocumentListener(docListener); + } + + + protected UITextField initTextField() { + int columns = this.numberFieldColumns == 0 ? DEFAULT_NUMBERFIELD_COLUMNS : this.numberFieldColumns; + UITextField textField = new UITextField(columns) { + public boolean shouldResponseChangeListener() { + return false; + } + }; + ((AbstractDocument) textField.getDocument()).setDocumentFilter(new DocumentFilter() { + public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr) throws BadLocationException { + fb.insertString(offset, string.toUpperCase(), attr); + } + + public void replace(FilterBypass fb, int offset, int length, String string, AttributeSet attr) throws BadLocationException { + if (string != null) { + string = string.toUpperCase(); + } + fb.replace(offset, length, string, attr); + } + }); + return textField; + } + + protected DocumentListener docListener = new DocumentListener() { + @Override + public void removeUpdate(DocumentEvent e) { + setTextFieldValue(getTextValue()); + } + + @Override + public void insertUpdate(DocumentEvent e) { + setTextFieldValue(getTextValue()); + } + + @Override + public void changedUpdate(DocumentEvent e) { + setTextFieldValue(getTextValue()); + } + }; + + + protected void initTextFiledListeners() { + textField.getDocument().removeDocumentListener(docListener); + textField.getDocument().addDocumentListener(docListener); + textField.addFocusListener(new FocusAdapter() { + @Override + public void focusGained(FocusEvent e) { + textFieldFocus = true; + } + + @Override + public void focusLost(FocusEvent e) { + textFieldFocus = false; + textField.getDocument().removeDocumentListener(docListener); + if (!preAction && !nextAction) { + textField.setText(StableUtils.convertIntToABC((int)value).toUpperCase()); + } + textField.getDocument().addDocumentListener(docListener); + preAction = false; + nextAction = false; + } + }); + } + + protected void initTextMouseListener() { + textField.addMouseListener(new MouseAdapter() { + @Override + public void mouseEntered(MouseEvent e) { + hover = true; + repaint(); + } + + @Override + public void mouseExited(MouseEvent e) { + hover = false; + repaint(); + } + }); + } + + public UITextField getTextFieldNew() { + return textField; + } + + private double getTextValue() { + try { + if (StringUtils.isEmpty(textField.getText())) { + return 1; + } else if (StringUtils.isNumber(textField.getText())) { + return Double.parseDouble(textField.getText()); + } + return StableUtils.convertABCToInt(textField.getText()); + } catch (NumberFormatException numberFormatException) { + return 1; + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java b/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java index f6b75b7c4f..e95d1d3ef4 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java +++ b/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java @@ -13,7 +13,6 @@ import com.fr.design.gui.itextfield.UINumberField; import com.fr.stable.CommonUtils; import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JPanel; import javax.swing.event.ChangeEvent; @@ -46,11 +45,11 @@ import static com.fine.theme.utils.FineUIStyle.setStyle; */ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver, HoverAware { - private final Insets defaultInsets = new Insets(0, 6, 0, 6); + protected final Insets defaultInsets = new Insets(0, 6, 0, 6); private final int defaultButtonSize = 24; private final int ICON_WIDTH = 12; protected double value; - private static final int DEFAULT_NUMBERFIELD_COLUMNS = 2; + protected static final int DEFAULT_NUMBERFIELD_COLUMNS = 2; private UINumberField textField; private UIButton preButton; private UIButton nextButton; @@ -64,10 +63,14 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver, /** * Spinner内的数字文本框长度 */ - private int numberFieldColumns; - private boolean textFieldFocus = false; + protected int numberFieldColumns; + protected boolean textFieldFocus = false; - private boolean hover; + protected boolean hover; + + protected boolean preAction; + + protected boolean nextAction; private static final String UI_CLASS_ID = "InputUI"; @@ -116,6 +119,11 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver, }); } + initTextMouseListener(); + + } + + protected void initTextMouseListener() { textField.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { @@ -129,7 +137,6 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver, repaint(); } }); - } /** @@ -281,19 +288,24 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver, return hover; } - private void initComponents() { + protected void initComponents() { + setLayout(new BorderLayout()); textField = initNumberField(); textField.setMaxValue(maxValue); textField.setMinValue(minValue); Insets insets = FineUIUtils.getUIInsets("InputTextField.borderInsets", defaultInsets); textField.setBorder(new ScaledEmptyBorder(insets.top, insets.left, insets.bottom, insets.right)); textField.setOpaque(false); + add(textField, BorderLayout.CENTER); setValue(value); + initArrowPane(); + componentInitListeners(); + } + + protected void initArrowPane() { preButton = createArrowButton(new LazyIcon("up_arrow", ICON_WIDTH)); nextButton = createArrowButton(new LazyIcon("down_arrow", ICON_WIDTH)); - setLayout(new BorderLayout()); - add(textField, BorderLayout.CENTER); JPanel arrowPane = new JPanel(); arrowPane.setLayout(new GridLayout(2, 1)); arrowPane.add(preButton); @@ -304,7 +316,6 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver, int buttonHeight = FineUIUtils.getAndScaleInt("InputButton.height", defaultButtonSize); arrowPane.setPreferredSize(new Dimension(buttonWidth, buttonHeight)); add(arrowPane, BorderLayout.EAST); - componentInitListeners(); } private UIButton createArrowButton(Icon icon) { @@ -337,16 +348,18 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver, textField.setMinValue(minValue); } - private void componentInitListeners() { + protected void componentInitListeners() { preButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { + preAction = true; setValue(value + dierta); } }); nextButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { + nextAction = true; setValue(value - dierta); } }); @@ -391,7 +404,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver, return numberField; } - private DocumentListener docListener = new DocumentListener() { + protected DocumentListener docListener = new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { setTextFieldValue(textField.getValue()); diff --git a/designer-base/src/main/java/com/fr/design/write/submit/CustomJobPane.java b/designer-base/src/main/java/com/fr/design/write/submit/CustomJobPane.java index 7b67d5137d..ba56aa792a 100644 --- a/designer-base/src/main/java/com/fr/design/write/submit/CustomJobPane.java +++ b/designer-base/src/main/java/com/fr/design/write/submit/CustomJobPane.java @@ -3,7 +3,6 @@ package com.fr.design.write.submit; import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIUtils; import com.formdev.flatlaf.util.ScaledEmptyBorder; -import com.fr.base.GraphHelper; import com.fr.data.AbstractClassJob; import com.fr.design.data.tabledata.tabledatapane.ClassNameSelectPane; import com.fr.design.beans.BasicBeanPane; @@ -18,7 +17,7 @@ import com.fr.design.dialog.DialogActionAdapter; import com.fr.stable.ListMap; import com.fr.stable.StringUtils; -import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.design.i18n.Toolkit; import javax.swing.*; import java.awt.*; @@ -28,7 +27,6 @@ import java.awt.event.ActionListener; import static com.fine.swing.ui.layout.Layouts.column; import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.row; -import static com.fine.swing.ui.layout.Layouts.flex; /** * Author : Shockway @@ -45,11 +43,12 @@ public abstract class CustomJobPane extends BasicBeanPane { JPanel reportletNamePane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); classNameTextField = new UITextField(); - UIButton browserButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); + UIButton browserButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Select")); - UIButton editButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); + UIButton editButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Edit")); UITextArea area = new UITextArea(2, 1); + area.setText(Toolkit.i18nText("Fine-Design_Basic_Extend_Class", "com.fr.data.AbstractSubmitTask")); browserButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { @@ -60,7 +59,7 @@ public abstract class CustomJobPane extends BasicBeanPane { new DialogActionAdapter() { public void doOk() { classNameTextField.setText(bPane.getClassPath()); - area.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Extend_Class", "com.fr.data.AbstractSubmitTask")); + area.setText(Toolkit.i18nText("Fine-Design_Basic_Extend_Class", "com.fr.data.AbstractSubmitTask")); checkAddButtonEnable(); } }).setVisible(true); @@ -74,7 +73,7 @@ public abstract class CustomJobPane extends BasicBeanPane { new DialogActionAdapter() { public void doOk() { classNameTextField.setText(javaEditorPane.getClassText()); - area.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Extend_Class", "com.fr.data.AbstractSubmitTask")); + area.setText(Toolkit.i18nText("Fine-Design_Basic_Extend_Class", "com.fr.data.AbstractSubmitTask")); checkAddButtonEnable(); } }); @@ -101,9 +100,9 @@ public abstract class CustomJobPane extends BasicBeanPane { dsPane.setBorder(new ScaledEmptyBorder(10, 0, 0, 0)); dsPane.add(area); this.add(column(20, - cell(FineUIUtils.wrapComponentWithTitle(reportletNamePane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Class_Name"))), - cell(FineUIUtils.wrapComponentWithTitle(objectProperiesPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Property"))).weight(1.0), - cell(FineUIUtils.wrapComponentWithTitle(dsPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Job_Description"))) + cell(FineUIUtils.wrapComponentWithTitle(reportletNamePane, Toolkit.i18nText("Fine-Design_Basic_Class_Name"))), + cell(FineUIUtils.wrapComponentWithTitle(objectProperiesPane, Toolkit.i18nText("Fine-Design_Basic_Property"))).weight(1.0), + cell(FineUIUtils.wrapComponentWithTitle(dsPane, Toolkit.i18nText("Fine-Design_Basic_Custom_Job_Description"))) ).getComponent()); checkAddButtonEnable(); } diff --git a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java index 2767f8945b..35cf86ab94 100644 --- a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java +++ b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java @@ -7,7 +7,6 @@ import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIUtils; import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.util.ScaledEmptyBorder; -import com.fr.design.components.tooltip.ModernToolTip; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.FRGraphics2D; @@ -22,10 +21,8 @@ import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JScrollBar; -import javax.swing.JToolTip; import javax.swing.JViewport; import javax.swing.ScrollPaneConstants; -import java.awt.BasicStroke; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; @@ -57,9 +54,9 @@ public class StartupPageWorkspacePanel extends JPanel { private static final Color PATH_COLOR = new Color(51, 51, 52, (int) Math.round(255 * 0.5)); /* 长度 */ - + private static final int SCROLL_BAR_WIDTH = 20; - + private static final int CONTENT_WIDTH = scale(StartupPageConstants.CONTENT_WIDTH + SCROLL_BAR_WIDTH); private static final int BORDER_THIN = 2; @@ -140,6 +137,7 @@ public class StartupPageWorkspacePanel extends JPanel { this.contentPanel.setOpaque(false); this.add(contentPanel, BorderLayout.NORTH); } + private JComponent generateUnLimitContentPanel(List> partitions) { JComponent panel = generateUnLimitContentPanel0(partitions); @@ -228,7 +226,7 @@ public class StartupPageWorkspacePanel extends JPanel { g.fillRoundRect(0, 0, preferredSize.width, preferredSize.height, 5, 5); } } - }; + }; showAllPanel.setLayout(new BorderLayout()); UILabel fontLabel = new UILabel(Toolkit.i18nText("Fine-Design_Startup_Page_Expand_All")); @@ -287,10 +285,6 @@ public class StartupPageWorkspacePanel extends JPanel { AtomicReference borderColorRef = new AtomicReference<>(null); JPanel selectWorkspacePanel = new JPanel() { - @Override - public JToolTip createToolTip() { - return new ModernToolTip(); - } @Override protected void paintComponent(Graphics g) { @@ -316,16 +310,15 @@ public class StartupPageWorkspacePanel extends JPanel { if (borderColor != null) { g2d.setColor(borderColor); - g2d.setStroke(new BasicStroke(BORDER_THIN)); - FlatUIUtils.setRenderingHints(g2d); - Path2D path2D = FineUIUtils.createLeftRoundRectangle(0, 0, - getWidth() - BORDER_THIN, getHeight() - BORDER_THIN, ARC_DIAMETER); - g2d.draw(path2D); + FineUIUtils.paintPartRoundButtonBorder(g2d, 0, 0, + this.getWidth(), this.getHeight(), + BORDER_THIN, ARC_DIAMETER, + FineUIUtils.LEFT, true); } } }; selectWorkspacePanel.setLayout(new BorderLayout()); - selectWorkspacePanel.setToolTipText(Toolkit.i18nText("Fine-Design_Startup_Page_Double_Click_Enter_Workspace")); + selectWorkspacePanel.setToolTipText(workspaceInfo.getPath()); selectWorkspacePanel.setBorder(new ScaledEmptyBorder(10, 10, 10, 10)); { @@ -348,7 +341,7 @@ public class StartupPageWorkspacePanel extends JPanel { FineUIUtils.setFontSize(nameLabel, NAME_LABEL_SIZE); nameLabel.setPreferredSize(PATH_DIMENSION); Color nameForeground = nameLabel.getForeground(); - simpleDescPanel.add(nameLabel,BorderLayout.NORTH); + simpleDescPanel.add(nameLabel, BorderLayout.NORTH); UILabel pathLabel = new UILabel(workspaceInfo.getPath()); pathLabel.setPreferredSize(PATH_DIMENSION); @@ -369,7 +362,7 @@ public class StartupPageWorkspacePanel extends JPanel { Color hoverColor = FlatUIUtils.getUIColor("brand.normal", HOVER_COLOR); borderColorRef.set(hoverColor); nameLabel.setForeground(hoverColor); - pathLabel.setForeground(hoverColor ); + pathLabel.setForeground(hoverColor); repaintAll(); } @@ -394,12 +387,7 @@ public class StartupPageWorkspacePanel extends JPanel { }; - UILabel arrowLabel = new UILabel(new LazyIcon("more_arrow", 20)) { - @Override - public JToolTip createToolTip() { - return new ModernToolTip(); - } - }; + UILabel arrowLabel = new UILabel(new LazyIcon("more_arrow", 20)); arrowLabel.setToolTipText(Toolkit.i18nText("Fine-Design_Startup_Page_Enter_Workspace")); arrowLabel.addMouseListener(new MouseAdapter() { @Override @@ -433,10 +421,6 @@ public class StartupPageWorkspacePanel extends JPanel { // 选择并新建 AtomicReference borderColorRef = new AtomicReference<>(null); JPanel selectAndCreatePanel = new JPanel() { - @Override - public JToolTip createToolTip() { - return new ModernToolTip(); - } @Override protected void paintComponent(Graphics g) { @@ -451,11 +435,11 @@ public class StartupPageWorkspacePanel extends JPanel { Color borderColor = borderColorRef.get(); if (borderColor != null) { g2d.setColor(borderColor); - g2d.setStroke(new BasicStroke(BORDER_THIN)); - FlatUIUtils.setRenderingHints(g2d); - Path2D path2D = FineUIUtils.createRightRoundRectangle(0, 0, - getWidth() - BORDER_THIN, getHeight() - BORDER_THIN, ARC_DIAMETER); - g2d.draw(path2D); + FineUIUtils.paintPartRoundButtonBorder(g2d, 0, 0, + this.getWidth(), this.getHeight(), + BORDER_THIN, ARC_DIAMETER, + FineUIUtils.RIGHT, true + ); } } @@ -481,6 +465,7 @@ public class StartupPageWorkspacePanel extends JPanel { label.setIcon(new LazyIcon("add", 20)); repaintAll(); } + @Override public void mousePressed(MouseEvent e) { pageModel.setSelectWorkspaceInfo(workspaceInfo); diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonStoryBoard.java index 54181cf0d6..ed024099aa 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonStoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonStoryBoard.java @@ -3,9 +3,11 @@ package com.fr.design.gui.storybook.components; import com.fine.theme.icon.LazyIcon; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UICombinationButton; +import com.fr.design.gui.ibutton.UISaveForbiddenButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.storybook.Story; import com.fr.design.gui.storybook.StoryBoard; +import com.fr.design.i18n.Toolkit; import com.fr.design.style.color.UIToolbarColorButton; import javax.swing.JButton; @@ -177,7 +179,9 @@ public class ButtonStoryBoard extends StoryBoard { .with(it -> setStyle(it, STYLE_PRIMARY)), cell(new UICombinationButton("按钮2", new LazyIcon("triangle_down"))), cell(new JButton("按钮", new LazyIcon("add"))), - cell(new JButton(new LazyIcon("multi"))) + cell(new UICombinationButton( + new UISaveForbiddenButton(Toolkit.i18nText("Fine-Design_Basic_Preview"), new LazyIcon("run").white()), + new UISaveForbiddenButton(new LazyIcon("triangle_down").white()))).with(UICombinationButton::setPrimary) ), row(20, cell(new UIToolbarColorButton(new LazyIcon("foreground"))), @@ -189,7 +193,7 @@ public class ButtonStoryBoard extends StoryBoard { ); } - public JComponent toolbar(){ + public JComponent toolbar() { JToolBar bar = new JToolBar(); UIToolbarColorButton foreground = new UIToolbarColorButton(new LazyIcon("foreground")); bar.add(foreground); diff --git a/designer-realize/src/main/java/com/fr/design/write/submit/SubmitVisitorListPane.java b/designer-realize/src/main/java/com/fr/design/write/submit/SubmitVisitorListPane.java index 4cb4dea409..3dcdb44c55 100644 --- a/designer-realize/src/main/java/com/fr/design/write/submit/SubmitVisitorListPane.java +++ b/designer-realize/src/main/java/com/fr/design/write/submit/SubmitVisitorListPane.java @@ -13,8 +13,6 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.ElementCasePane; -import com.fr.design.scrollruler.ModLineBorder; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; @@ -27,6 +25,7 @@ import com.fr.stable.Nameable; import com.fr.write.BuiltInSQLSubmiterProvider; import com.fr.write.DBManipulation; import com.fr.write.WClassSubmiterProvider; +import com.fr.design.i18n.Toolkit; import javax.swing.*; import java.awt.*; @@ -53,12 +52,12 @@ public class SubmitVisitorListPane extends ObjectJControlPane { */ public NameableCreator[] createNameableCreators() { return new NameableCreator[]{ - new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Submit_Type_Build_In_Sql"), + new NameObjectCreator(Toolkit.i18nText("Fine-Design_Report_Submit_Type_Build_In_Sql"), new LazyIcon("dataLink"), BuiltInSQLSubmiter.class, BuildInSQLPane.class), new NameObjectCreator( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Submit_Type_Custom"), + Toolkit.i18nText("Fine-Design_Report_Submit_Type_Custom"), new LazyIcon("dataLink"), WClassSubmiter.class, CustomPane.class) @@ -194,12 +193,10 @@ public class SubmitVisitorListPane extends ObjectJControlPane { csjConfigComboBox = new UIComboBox(configTypes.toArray()); JPanel typePane = new JPanel(new BorderLayout()); - typePane.add(row(10, - cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Write_Choose_Submit_Type"))), - cell(csjConfigComboBox).weight(0.5)).getComponent()); + typePane.add(row(10, cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Write_Choose_Submit_Type"))), cell(csjConfigComboBox).weight(0.5), flex()).getComponent()); this.add(column( - cell(FineUIUtils.wrapComponentWithTitle(typePane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Write_Submit_Type"))), + cell(FineUIUtils.wrapComponentWithTitle(typePane, Toolkit.i18nText("Fine-Design_Report_Write_Submit_Type"))), cell(customCardPane).weight(1.0)).getComponent()); csjConfigComboBox.addItemListener(new ItemListener() { diff --git a/designer-realize/src/main/java/com/fr/start/CarinaDesigner.java b/designer-realize/src/main/java/com/fr/start/CarinaDesigner.java index 5c78d28631..5e44ed8425 100644 --- a/designer-realize/src/main/java/com/fr/start/CarinaDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/CarinaDesigner.java @@ -41,6 +41,7 @@ public class CarinaDesigner extends MainDesigner{ * main */ public static void main(String[] args) { + installUIDevModeTools(); DesignerStartupContext.getRecorder().start(); PartitionManager manager = new PartitionManagerImpl(); StateHubContext.setReady(false); @@ -66,8 +67,6 @@ public class CarinaDesigner extends MainDesigner{ DesignerStartupContext.getRecorder().stop(); SwitchForSwingChecker.initThreadMonitoring(); DesignerLatencyMetric.getInstance().start(); - - installUIDevModeTools(); } /**