From 5a71342bc002be3b339c721aec7e4dedf6704669 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 16 Oct 2019 09:14:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-17779=20=E8=BF=9C=E7=A8=8B=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E8=AE=BE=E8=AE=A1=E5=99=A8=E7=A6=81=E7=94=A8=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E7=BA=A7=E5=88=AB=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/PreferencePane.java | 105 +++++++++++------- 1 file changed, 65 insertions(+), 40 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index d308cbe009..19ee5631ab 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -46,10 +46,36 @@ import com.fr.workspace.WorkContext; import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.git.config.GcConfig; -import javax.swing.*; -import javax.swing.event.*; -import java.awt.*; -import java.awt.event.*; +import javax.swing.BorderFactory; +import javax.swing.BoxLayout; +import javax.swing.JDialog; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.KeyStroke; +import javax.swing.SwingUtilities; +import javax.swing.SwingWorker; +import javax.swing.Timer; +import javax.swing.UIManager; +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.Dialog; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; import java.io.File; import java.text.DecimalFormat; import java.util.Locale; @@ -61,7 +87,7 @@ import static com.fr.design.i18n.Toolkit.i18nText; /** * 选项对话框 * - * @editor zhou + * @author zhou * @since 2012-3-28下午3:39:48 */ public class PreferencePane extends BasicPane { @@ -144,10 +170,12 @@ public class PreferencePane extends BasicPane { private UICheckBox saveCommitCheckBox; private UICheckBox useIntervalCheckBox; private IntegerEditor saveIntervalEditor; + private UICheckBox gcEnableCheckBox; private UIButton gcButton; private UILabel remindVcsLabel; + private JDialog gcDialog; private UILabel gcMessage = new UILabel(); private JPanel gcDialogDownPane = new JPanel(); @@ -194,6 +222,7 @@ public class PreferencePane extends BasicPane { oracleSpace = new UICheckBox(i18nText("Fine-Design_Basic_Show_All_Oracle_Tables")); oraclePane.add(oracleSpace); + JPanel debuggerPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Develop_Tools")); openDebugComboBox = new UICheckBox(i18nText("Fine-Design_Basic_Open_Debug_Window")); debuggerPane.add(openDebugComboBox, BorderLayout.CENTER); @@ -213,8 +242,10 @@ public class PreferencePane extends BasicPane { joinProductImproveCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Join_Product_Improve")); improvePane.add(joinProductImproveCheckBox); - if(SupportOSImpl.AUTOPUSHUPDATE.support()){ + if (SupportOSImpl.AUTOPUSHUPDATE.support()) { autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update")); + + improvePane.add(autoPushUpdateCheckBox); } /* @@ -239,7 +270,9 @@ public class PreferencePane extends BasicPane { private void createVcsSettingPane(JPanel generalPane) { JPanel vcsPane = FRGUIPaneFactory.createVerticalTitledBorderPane(i18nText("Fine-Design_Vcs_Title")); generalPane.add(vcsPane); + remindVcsLabel = new UILabel(i18nText("Fine-Design_Vcs_Remind")); + remindVcsLabel.setVisible(!VcsHelper.getInstance().needInit()); vcsEnableCheckBox = new UICheckBox(i18nText("Fine-Design_Vcs_SaveAuto")); saveCommitCheckBox = new UICheckBox(i18nText("Fine-Design_Vcs_No_Delete")); @@ -496,23 +529,8 @@ public class PreferencePane extends BasicPane { JPanel logLevelPane = FRGUIPaneFactory.createTitledBorderPane("log" + i18nText("Fine-Design_Basic_Level_Setting")); logPane.add(logLevelPane); logLevelComboBox = new UIComboBox(LOG); + logLevelComboBox.setEnabled(WorkContext.getCurrent().isLocal()); logLevelPane.add(logLevelComboBox); - logLevelComboBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - Configurations.update(new Worker() { - @Override - public void run() { - Log4jConfig.getInstance().setRootLevel((Level) logLevelComboBox.getSelectedItem()); - } - - @Override - public Class[] targets() { - return new Class[]{Log4jConfig.class}; - } - }); - } - }); } private void createLanPane(JPanel generalPane) { @@ -540,8 +558,8 @@ public class PreferencePane extends BasicPane { }); UILabel noticeLabel = new UILabel(i18nText("Fine-Design_Basic_Work_After_Restart_Designer"));//sail:提示重启后生效 double p = TableLayout.PREFERRED; - double rowSize[] = {p}; - double columnSize[] = {p, p, p}; + double[] rowSize = {p}; + double[] columnSize = {p, p, p}; Component[][] components = { {languageLabel, languageComboBox, noticeLabel}, }; @@ -581,7 +599,7 @@ public class PreferencePane extends BasicPane { private void createLengthPane(JPanel advancePane) { double p = TableLayout.PREFERRED; - double rowSize[] = {p}; + double[] rowSize = {p}; // 长度单位选择 JPanel lengthPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Setting_Ruler_Units")); @@ -603,8 +621,8 @@ public class PreferencePane extends BasicPane { private void createServerPane(JPanel advancePane) { double p = TableLayout.PREFERRED; - double rowSize[] = {p}; - double columnSize[] = {p, p, p}; + double[] rowSize = {p}; + double[] columnSize = {p, p, p}; JPanel serverPortPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Web_Preview_Port_Setting")); advancePane.add(serverPortPane); @@ -643,7 +661,7 @@ public class PreferencePane extends BasicPane { /** * The method of populate. * - * @param designerEnvManager + * @param designerEnvManager 设计器环境管理器 */ public void populate(DesignerEnvManager designerEnvManager) { if (designerEnvManager == null) { @@ -705,7 +723,7 @@ public class PreferencePane extends BasicPane { this.pageLengthComboBox.setSelectedIndex(designerEnvManager.getPageLengthUnit()); this.reportLengthComboBox.setSelectedIndex(designerEnvManager.getReportLengthUnit()); - this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort())); + this.portEditor.setValue(designerEnvManager.getEmbedServerPort()); openDebugComboBox.setSelected(designerEnvManager.isOpenDebug()); useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM()); @@ -775,7 +793,7 @@ public class PreferencePane extends BasicPane { designerEnvManager.setPageLengthUnit((short) pageLengthComboBox.getSelectedIndex()); designerEnvManager.setReportLengthUnit((short) reportLengthComboBox.getSelectedIndex()); - designerEnvManager.setJettyServerPort(portEditor.getValue().intValue()); + designerEnvManager.setJettyServerPort(portEditor.getValue()); designerEnvManager.setOpenDebug(openDebugComboBox.isSelected()); @@ -809,17 +827,24 @@ public class PreferencePane extends BasicPane { designerEnvManager.setUndoLimit(MAX_UNDO_LIMIT_50); } - Configurations.update(new Worker() { - @Override - public void run() { - Log4jConfig.getInstance().setRootLevel(((Level) logLevelComboBox.getSelectedItem())); - } + if (WorkContext.getCurrent().isLocal()) { + Configurations.update(new Worker() { + @Override + public void run() { + Level level = (Level) logLevelComboBox.getSelectedItem(); + if (level != null) { + Log4jConfig.getInstance().setRootLevel(level); + } + } - @Override - public Class[] targets() { - return new Class[]{Log4jConfig.class}; - } - }); + @Override + public Class[] targets() { + @SuppressWarnings("unchecked") + Class[] classes = new Class[]{Log4jConfig.class}; + return classes; + } + }); + } Configurations.update(new Worker() { @Override From a822e7f8b0de1b81f7d4208ebc946bd4d73b78ac Mon Sep 17 00:00:00 2001 From: pengda Date: Fri, 18 Oct 2019 15:41:53 +0800 Subject: [PATCH 2/2] =?UTF-8?q?sonar=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D,?= =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/PreferencePane.java | 6 --- .../actions/server/ConnectionListAction.java | 43 ------------------- .../actions/server/PluginManagerAction.java | 1 - .../mainframe/loghandler/LogHandlerBarUI.java | 2 +- .../design/scrollruler/VerticalRulerUI.java | 4 +- .../style/color/CustomChooserPanel.java | 4 +- 6 files changed, 5 insertions(+), 55 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index d308cbe009..6e4520eade 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -217,12 +217,6 @@ public class PreferencePane extends BasicPane { autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update")); improvePane.add(autoPushUpdateCheckBox); } - /* - if (DesignerPushUpdateManager.getInstance().isAutoPushUpdateSupported()) { - autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update")); - improvePane.add(autoPushUpdateCheckBox); - }*/ - JPanel spaceUpPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); spaceUpPane.add(oraclePane, BorderLayout.NORTH); spaceUpPane.add(createMemoryPane(), BorderLayout.CENTER); diff --git a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java index 15c6cb705c..50ecd0ea6d 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java @@ -57,49 +57,6 @@ public class ConnectionListAction extends UpdateAction { osBasedAction.execute(); } - /* private void openDesignDatabaseManager() { - DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); - final ConnectionConfig datasourceManager = ConnectionConfig.getInstance(); - final ConnectionManagerPane databaseManagerPane = new ConnectionManagerPane() { - public void complete() { - ConnectionConfig connectionConfig = datasourceManager.mirror(); - populate(connectionConfig); - } - - protected void renameConnection(String oldName, String newName) { - datasourceManager.renameConnection(oldName, newName); - } - }; - final BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null); - databaseListDialog.addDialogActionListener(new DialogActionAdapter() { - public void doOk() { - if (!databaseManagerPane.isNamePermitted()) { - databaseListDialog.setDoOKSucceed(false); - return; - } - Configurations.modify(new WorkerFacade(ConnectionConfig.class) { - @Override - public void run() { - databaseManagerPane.update(datasourceManager); - } - }.addCallBack(new CallBackAdaptor() { - @Override - public boolean beforeCommit() { - //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面 - return doWithDatasourceManager(datasourceManager, databaseManagerPane, databaseListDialog); - } - - @Override - public void afterCommit() { - DesignerContext.getDesignerBean("databasename").refreshBeanElement(); - } - })); - } - }); - databaseListDialog.setVisible(true); - } -*/ - /** * 更新datasourceManager * diff --git a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java index 7b41f6fd81..d000dbbbb0 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java @@ -16,7 +16,6 @@ import java.awt.event.ActionEvent; * @since 8.0 */ public class PluginManagerAction extends UpdateAction { - private static String PLUGIN_MANAGER_ROUTE = "#management/plugin"; public PluginManagerAction() { this.setMenuKeySet(PLUGIN_MANAGER); this.setName(getMenuKeySet().getMenuKeySetName()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java index a41f03a9db..bbb9eed346 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java @@ -69,7 +69,7 @@ public class LogHandlerBarUI extends ComponentUI implements MouseListener, Focus int w = button.getWidth(); int h = button.getHeight(); Graphics2D g2d = (Graphics2D) g; - GradientPaint gp = new GradientPaint(1, 1, darkColor, 1, h - 1f, darkColor); + GradientPaint gp = new GradientPaint(1, 1, darkColor, 1, (float)(h - 1), darkColor); g2d.setPaint(gp); g2d.fillRect(0, 0, w, h); } diff --git a/designer-base/src/main/java/com/fr/design/scrollruler/VerticalRulerUI.java b/designer-base/src/main/java/com/fr/design/scrollruler/VerticalRulerUI.java index 3e0a9eb068..2cd482e1e3 100644 --- a/designer-base/src/main/java/com/fr/design/scrollruler/VerticalRulerUI.java +++ b/designer-base/src/main/java/com/fr/design/scrollruler/VerticalRulerUI.java @@ -20,7 +20,7 @@ public class VerticalRulerUI extends RulerUI{ @Override protected void paintRuler(Graphics g, int showText, int extra, Dimension size, int ratio) { int k = pxToLength(extra) * ratio; - for (int i = k; i < (pxToLength(size.height + extra) + 1) * ratio; i++) { + for (int i = k; i < (pxToLength( (double)size.height + extra) + 1) * ratio; i++) { g.setColor(BaseRuler.UNIT_SIGN_COLOR); if (i % BaseRuler.SCALE_10 == 0) { double times = (double) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution() / ScreenResolution.getScreenResolution(); @@ -44,7 +44,7 @@ public class VerticalRulerUI extends RulerUI{ @Override protected void paintPTRuler(Graphics g, int extra, Dimension size, int unit) { int k = pxToLength(extra); - for (int i = unit * (k/unit); i < pxToLength(size.height + extra); i += unit) { + for (int i = unit * (k/unit); i < pxToLength((double)size.height + extra); i += unit) { g.setColor(BaseRuler.UNIT_SIGN_COLOR); if (i % BaseRuler.SCALE_100 == 0) { GraphHelper.drawLine(g, size.width, toPX(i) - extra, 0, toPX(i) - extra); diff --git a/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java b/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java index c7cf4f7831..6d8d267445 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java +++ b/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java @@ -314,8 +314,8 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec * @param p The point where the MouseEvent occurred. */ private void updateH(Point p) { - float s = (IMG_WIDTH - p.x * 1f) / IMG_WIDTH; - float b = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT; + double s = (IMG_WIDTH - p.x * 1D) / IMG_WIDTH; + double b = (IMG_HEIGHT - p.y * 1D) / IMG_HEIGHT; // Avoid two changes to the model by changing internalChange to true. internalChange = true;