Browse Source

Merge remote-tracking branch 'origin/feature/10.0' into feature/10.0

research/11.0
Bryant 5 years ago
parent
commit
298f851c20
  1. 93
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  2. 43
      designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java
  3. 1
      designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java
  4. 2
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java
  5. 4
      designer-base/src/main/java/com/fr/design/scrollruler/VerticalRulerUI.java
  6. 4
      designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java

93
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.VcsOperator;
import com.fr.workspace.server.vcs.git.config.GcConfig; import com.fr.workspace.server.vcs.git.config.GcConfig;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.event.*; import javax.swing.BoxLayout;
import java.awt.*; import javax.swing.JDialog;
import java.awt.event.*; 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.io.File;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.Locale; 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 * @since 2012-3-28下午3:39:48
*/ */
public class PreferencePane extends BasicPane { public class PreferencePane extends BasicPane {
@ -144,10 +170,12 @@ public class PreferencePane extends BasicPane {
private UICheckBox saveCommitCheckBox; private UICheckBox saveCommitCheckBox;
private UICheckBox useIntervalCheckBox; private UICheckBox useIntervalCheckBox;
private IntegerEditor saveIntervalEditor; private IntegerEditor saveIntervalEditor;
private UICheckBox gcEnableCheckBox; private UICheckBox gcEnableCheckBox;
private UIButton gcButton; private UIButton gcButton;
private UILabel remindVcsLabel; private UILabel remindVcsLabel;
private JDialog gcDialog; private JDialog gcDialog;
private UILabel gcMessage = new UILabel(); private UILabel gcMessage = new UILabel();
private JPanel gcDialogDownPane = new JPanel(); 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")); oracleSpace = new UICheckBox(i18nText("Fine-Design_Basic_Show_All_Oracle_Tables"));
oraclePane.add(oracleSpace); oraclePane.add(oracleSpace);
JPanel debuggerPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Develop_Tools")); JPanel debuggerPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Develop_Tools"));
openDebugComboBox = new UICheckBox(i18nText("Fine-Design_Basic_Open_Debug_Window")); openDebugComboBox = new UICheckBox(i18nText("Fine-Design_Basic_Open_Debug_Window"));
debuggerPane.add(openDebugComboBox, BorderLayout.CENTER); debuggerPane.add(openDebugComboBox, BorderLayout.CENTER);
@ -215,14 +244,10 @@ public class PreferencePane extends BasicPane {
if (SupportOSImpl.AUTOPUSHUPDATE.support()) { if (SupportOSImpl.AUTOPUSHUPDATE.support()) {
autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update")); autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update"));
improvePane.add(autoPushUpdateCheckBox); 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(); JPanel spaceUpPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
spaceUpPane.add(oraclePane, BorderLayout.NORTH); spaceUpPane.add(oraclePane, BorderLayout.NORTH);
spaceUpPane.add(createMemoryPane(), BorderLayout.CENTER); spaceUpPane.add(createMemoryPane(), BorderLayout.CENTER);
@ -239,7 +264,9 @@ public class PreferencePane extends BasicPane {
private void createVcsSettingPane(JPanel generalPane) { private void createVcsSettingPane(JPanel generalPane) {
JPanel vcsPane = FRGUIPaneFactory.createVerticalTitledBorderPane(i18nText("Fine-Design_Vcs_Title")); JPanel vcsPane = FRGUIPaneFactory.createVerticalTitledBorderPane(i18nText("Fine-Design_Vcs_Title"));
generalPane.add(vcsPane); generalPane.add(vcsPane);
remindVcsLabel = new UILabel(i18nText("Fine-Design_Vcs_Remind")); remindVcsLabel = new UILabel(i18nText("Fine-Design_Vcs_Remind"));
remindVcsLabel.setVisible(!VcsHelper.getInstance().needInit()); remindVcsLabel.setVisible(!VcsHelper.getInstance().needInit());
vcsEnableCheckBox = new UICheckBox(i18nText("Fine-Design_Vcs_SaveAuto")); vcsEnableCheckBox = new UICheckBox(i18nText("Fine-Design_Vcs_SaveAuto"));
saveCommitCheckBox = new UICheckBox(i18nText("Fine-Design_Vcs_No_Delete")); saveCommitCheckBox = new UICheckBox(i18nText("Fine-Design_Vcs_No_Delete"));
@ -496,23 +523,8 @@ public class PreferencePane extends BasicPane {
JPanel logLevelPane = FRGUIPaneFactory.createTitledBorderPane("log" + i18nText("Fine-Design_Basic_Level_Setting")); JPanel logLevelPane = FRGUIPaneFactory.createTitledBorderPane("log" + i18nText("Fine-Design_Basic_Level_Setting"));
logPane.add(logLevelPane); logPane.add(logLevelPane);
logLevelComboBox = new UIComboBox(LOG); logLevelComboBox = new UIComboBox(LOG);
logLevelComboBox.setEnabled(WorkContext.getCurrent().isLocal());
logLevelPane.add(logLevelComboBox); 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<? extends Configuration>[] targets() {
return new Class[]{Log4jConfig.class};
}
});
}
});
} }
private void createLanPane(JPanel generalPane) { private void createLanPane(JPanel generalPane) {
@ -540,8 +552,8 @@ public class PreferencePane extends BasicPane {
}); });
UILabel noticeLabel = new UILabel(i18nText("Fine-Design_Basic_Work_After_Restart_Designer"));//sail:提示重启后生效 UILabel noticeLabel = new UILabel(i18nText("Fine-Design_Basic_Work_After_Restart_Designer"));//sail:提示重启后生效
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double rowSize[] = {p}; double[] rowSize = {p};
double columnSize[] = {p, p, p}; double[] columnSize = {p, p, p};
Component[][] components = { Component[][] components = {
{languageLabel, languageComboBox, noticeLabel}, {languageLabel, languageComboBox, noticeLabel},
}; };
@ -581,7 +593,7 @@ public class PreferencePane extends BasicPane {
private void createLengthPane(JPanel advancePane) { private void createLengthPane(JPanel advancePane) {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double rowSize[] = {p}; double[] rowSize = {p};
// 长度单位选择 // 长度单位选择
JPanel lengthPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Setting_Ruler_Units")); JPanel lengthPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Setting_Ruler_Units"));
@ -603,8 +615,8 @@ public class PreferencePane extends BasicPane {
private void createServerPane(JPanel advancePane) { private void createServerPane(JPanel advancePane) {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double rowSize[] = {p}; double[] rowSize = {p};
double columnSize[] = {p, p, p}; double[] columnSize = {p, p, p};
JPanel serverPortPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Web_Preview_Port_Setting")); JPanel serverPortPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Web_Preview_Port_Setting"));
advancePane.add(serverPortPane); advancePane.add(serverPortPane);
@ -643,7 +655,7 @@ public class PreferencePane extends BasicPane {
/** /**
* The method of populate. * The method of populate.
* *
* @param designerEnvManager * @param designerEnvManager 设计器环境管理器
*/ */
public void populate(DesignerEnvManager designerEnvManager) { public void populate(DesignerEnvManager designerEnvManager) {
if (designerEnvManager == null) { if (designerEnvManager == null) {
@ -705,7 +717,7 @@ public class PreferencePane extends BasicPane {
this.pageLengthComboBox.setSelectedIndex(designerEnvManager.getPageLengthUnit()); this.pageLengthComboBox.setSelectedIndex(designerEnvManager.getPageLengthUnit());
this.reportLengthComboBox.setSelectedIndex(designerEnvManager.getReportLengthUnit()); this.reportLengthComboBox.setSelectedIndex(designerEnvManager.getReportLengthUnit());
this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort())); this.portEditor.setValue(designerEnvManager.getEmbedServerPort());
openDebugComboBox.setSelected(designerEnvManager.isOpenDebug()); openDebugComboBox.setSelected(designerEnvManager.isOpenDebug());
useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM()); useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM());
@ -775,7 +787,7 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setPageLengthUnit((short) pageLengthComboBox.getSelectedIndex()); designerEnvManager.setPageLengthUnit((short) pageLengthComboBox.getSelectedIndex());
designerEnvManager.setReportLengthUnit((short) reportLengthComboBox.getSelectedIndex()); designerEnvManager.setReportLengthUnit((short) reportLengthComboBox.getSelectedIndex());
designerEnvManager.setJettyServerPort(portEditor.getValue().intValue()); designerEnvManager.setJettyServerPort(portEditor.getValue());
designerEnvManager.setOpenDebug(openDebugComboBox.isSelected()); designerEnvManager.setOpenDebug(openDebugComboBox.isSelected());
@ -809,17 +821,24 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setUndoLimit(MAX_UNDO_LIMIT_50); designerEnvManager.setUndoLimit(MAX_UNDO_LIMIT_50);
} }
if (WorkContext.getCurrent().isLocal()) {
Configurations.update(new Worker() { Configurations.update(new Worker() {
@Override @Override
public void run() { public void run() {
Log4jConfig.getInstance().setRootLevel(((Level) logLevelComboBox.getSelectedItem())); Level level = (Level) logLevelComboBox.getSelectedItem();
if (level != null) {
Log4jConfig.getInstance().setRootLevel(level);
}
} }
@Override @Override
public Class<? extends Configuration>[] targets() { public Class<? extends Configuration>[] targets() {
return new Class[]{Log4jConfig.class}; @SuppressWarnings("unchecked")
Class<? extends Configuration>[] classes = new Class[]{Log4jConfig.class};
return classes;
} }
}); });
}
Configurations.update(new Worker() { Configurations.update(new Worker() {
@Override @Override

43
designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java

@ -57,49 +57,6 @@ public class ConnectionListAction extends UpdateAction {
osBasedAction.execute(); 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 * 更新datasourceManager
* *

1
designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java

@ -16,7 +16,6 @@ import java.awt.event.ActionEvent;
* @since 8.0 * @since 8.0
*/ */
public class PluginManagerAction extends UpdateAction { public class PluginManagerAction extends UpdateAction {
private static String PLUGIN_MANAGER_ROUTE = "#management/plugin";
public PluginManagerAction() { public PluginManagerAction() {
this.setMenuKeySet(PLUGIN_MANAGER); this.setMenuKeySet(PLUGIN_MANAGER);
this.setName(getMenuKeySet().getMenuKeySetName()); this.setName(getMenuKeySet().getMenuKeySetName());

2
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 w = button.getWidth();
int h = button.getHeight(); int h = button.getHeight();
Graphics2D g2d = (Graphics2D) g; 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.setPaint(gp);
g2d.fillRect(0, 0, w, h); g2d.fillRect(0, 0, w, h);
} }

4
designer-base/src/main/java/com/fr/design/scrollruler/VerticalRulerUI.java

@ -20,7 +20,7 @@ public class VerticalRulerUI extends RulerUI{
@Override @Override
protected void paintRuler(Graphics g, int showText, int extra, Dimension size, int ratio) { protected void paintRuler(Graphics g, int showText, int extra, Dimension size, int ratio) {
int k = pxToLength(extra) * 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); g.setColor(BaseRuler.UNIT_SIGN_COLOR);
if (i % BaseRuler.SCALE_10 == 0) { if (i % BaseRuler.SCALE_10 == 0) {
double times = (double) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution() / ScreenResolution.getScreenResolution(); double times = (double) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution() / ScreenResolution.getScreenResolution();
@ -44,7 +44,7 @@ public class VerticalRulerUI extends RulerUI{
@Override @Override
protected void paintPTRuler(Graphics g, int extra, Dimension size, int unit) { protected void paintPTRuler(Graphics g, int extra, Dimension size, int unit) {
int k = pxToLength(extra); 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); g.setColor(BaseRuler.UNIT_SIGN_COLOR);
if (i % BaseRuler.SCALE_100 == 0) { if (i % BaseRuler.SCALE_100 == 0) {
GraphHelper.drawLine(g, size.width, toPX(i) - extra, 0, toPX(i) - extra); GraphHelper.drawLine(g, size.width, toPX(i) - extra, 0, toPX(i) - extra);

4
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. * @param p The point where the MouseEvent occurred.
*/ */
private void updateH(Point p) { private void updateH(Point p) {
float s = (IMG_WIDTH - p.x * 1f) / IMG_WIDTH; double s = (IMG_WIDTH - p.x * 1D) / IMG_WIDTH;
float b = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT; double b = (IMG_HEIGHT - p.y * 1D) / IMG_HEIGHT;
// Avoid two changes to the model by changing internalChange to true. // Avoid two changes to the model by changing internalChange to true.
internalChange = true; internalChange = true;

Loading…
Cancel
Save