Browse Source

REPORT-16517 交互修改

research/10.0
XiaXiang 6 years ago
parent
commit
471a2852af
  1. 13
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 35
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  3. 5
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  4. 10
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java

13
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -132,6 +132,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private String jdkHome; private String jdkHome;
private boolean vcsEnable; private boolean vcsEnable;
private boolean saveCommit; private boolean saveCommit;
private boolean useInterval;
private int saveInterval; private int saveInterval;
@ -1608,7 +1609,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.setUndoLimit(reader.getAttrAsInt("undoLimit", 5)); this.setUndoLimit(reader.getAttrAsInt("undoLimit", 5));
this.setDefaultStringToFormula(reader.getAttrAsBoolean("defaultStringToFormula", false)); this.setDefaultStringToFormula(reader.getAttrAsBoolean("defaultStringToFormula", false));
this.setVcsEnable(reader.getAttrAsBoolean("supportVcs", true)); this.setVcsEnable(reader.getAttrAsBoolean("supportVcs", true));
this.setSaveCommit(reader.getAttrAsBoolean("saveCommit", false)); this.setSaveCommit(reader.getAttrAsBoolean("saveCommit", true));
this.setUseInterval(reader.getAttrAsBoolean("userInterval", true));
this.setSaveInterval(reader.getAttrAsInt("saveInterval", 60)); this.setSaveInterval(reader.getAttrAsInt("saveInterval", 60));
if ((tmpVal = reader.getAttrAsString("gridLineColor", null)) != null) { if ((tmpVal = reader.getAttrAsString("gridLineColor", null)) != null) {
this.setGridLineColor(new Color(Integer.parseInt(tmpVal))); this.setGridLineColor(new Color(Integer.parseInt(tmpVal)));
@ -1947,6 +1949,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
.attr("supportCellEditorDef", this.isSupportCellEditorDef()) .attr("supportCellEditorDef", this.isSupportCellEditorDef())
.attr("supportVcs", this.isVcsEnable()) .attr("supportVcs", this.isVcsEnable())
.attr("saveInterval", this.getSaveInterval()) .attr("saveInterval", this.getSaveInterval())
.attr("userInterval", this.isUseInterval())
.attr("saveCommit", this.isSaveCommit()) .attr("saveCommit", this.isSaveCommit())
.attr("isDragPermited", this.isDragPermited()) .attr("isDragPermited", this.isDragPermited())
.attr("gridLineColor", this.getGridLineColor().getRGB()) .attr("gridLineColor", this.getGridLineColor().getRGB())
@ -1982,4 +1985,12 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
public void setSaveInterval(int saveInterval) { public void setSaveInterval(int saveInterval) {
this.saveInterval = saveInterval; this.saveInterval = saveInterval;
} }
public boolean isUseInterval() {
return useInterval;
}
public void setUseInterval(boolean useInterval) {
this.useInterval = useInterval;
}
} }

35
designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java

@ -23,6 +23,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.update.push.DesignerPushUpdateManager; import com.fr.design.update.push.DesignerPushUpdateManager;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
@ -139,7 +140,9 @@ public class PreferencePane extends BasicPane {
private UICheckBox vcsEnableCheckBox; private UICheckBox vcsEnableCheckBox;
private UICheckBox saveCommitCheckBox; private UICheckBox saveCommitCheckBox;
private UICheckBox useIntervalCheckBox;
private IntegerEditor saveIntervalEditor; private IntegerEditor saveIntervalEditor;
private UILabel remindVcsLabel;
@ -205,15 +208,22 @@ public class PreferencePane extends BasicPane {
private void createVcsSettingPane(JPanel generalPane) { private void createVcsSettingPane(JPanel generalPane) {
JPanel vcsPane = FRGUIPaneFactory.createVerticalTitledBorderPane(Toolkit.i18nText("Fine-Design_Vcs_Title")); JPanel vcsPane = FRGUIPaneFactory.createVerticalTitledBorderPane(Toolkit.i18nText("Fine-Design_Vcs_Title"));
generalPane.add(vcsPane); generalPane.add(vcsPane);
remindVcsLabel = new UILabel("Fine-Design_Vcs_Remind");
remindVcsLabel.setVisible(!VcsHelper.needInit());
vcsEnableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Vcs_SaveAuto")); vcsEnableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Vcs_SaveAuto"));
saveCommitCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Vcs_No_Delete")); saveCommitCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Vcs_No_Delete"));
saveIntervalEditor = new IntegerEditor(30); saveIntervalEditor = new IntegerEditor(30);
JPanel memorySpace = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); useIntervalCheckBox = new UICheckBox();
JPanel enableVcsPanel = new JPanel(FRGUIPaneFactory.createLeftZeroLayout());
enableVcsPanel.add(vcsEnableCheckBox);
enableVcsPanel.add(remindVcsLabel);
JPanel intervalPanel = new JPanel(FRGUIPaneFactory.createLeftZeroLayout());
UILabel everyLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Every")); UILabel everyLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Every"));
UILabel delayLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Delay")); UILabel delayLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Delay"));
memorySpace.add(everyLabel); intervalPanel.add(useIntervalCheckBox);
memorySpace.add(saveIntervalEditor); intervalPanel.add(everyLabel);
memorySpace.add(delayLabel); intervalPanel.add(saveIntervalEditor);
intervalPanel.add(delayLabel);
vcsEnableCheckBox.addChangeListener(new ChangeListener() { vcsEnableCheckBox.addChangeListener(new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
@ -221,14 +231,16 @@ public class PreferencePane extends BasicPane {
if (selected) { if (selected) {
saveCommitCheckBox.setEnabled(true); saveCommitCheckBox.setEnabled(true);
saveIntervalEditor.setEnabled(true); saveIntervalEditor.setEnabled(true);
useIntervalCheckBox.setEnabled(true);
} else { } else {
saveCommitCheckBox.setEnabled(false); saveCommitCheckBox.setEnabled(false);
saveIntervalEditor.setEnabled(false); saveIntervalEditor.setEnabled(false);
useIntervalCheckBox.setEnabled(false);
} }
} }
}); });
vcsPane.add(vcsEnableCheckBox); vcsPane.add(enableVcsPanel);
vcsPane.add(memorySpace); vcsPane.add(intervalPanel);
vcsPane.add(saveCommitCheckBox); vcsPane.add(saveCommitCheckBox);
} }
@ -581,13 +593,21 @@ public class PreferencePane extends BasicPane {
defaultStringToFormulaBox.setEnabled(false); defaultStringToFormulaBox.setEnabled(false);
defaultStringToFormulaBox.setSelected(false); defaultStringToFormulaBox.setSelected(false);
} }
if (VcsHelper.needInit()) {
vcsEnableCheckBox.setSelected(designerEnvManager.isVcsEnable()); vcsEnableCheckBox.setSelected(designerEnvManager.isVcsEnable());
} else {
vcsEnableCheckBox.setEnabled(false);
vcsEnableCheckBox.setSelected(false);
}
if (!vcsEnableCheckBox.isSelected()) { if (!vcsEnableCheckBox.isSelected()) {
saveIntervalEditor.setEnabled(false);
saveCommitCheckBox.setEnabled(false); saveCommitCheckBox.setEnabled(false);
saveIntervalEditor.setEnabled(false);
useIntervalCheckBox.setEnabled(false);
} }
saveIntervalEditor.setValue(designerEnvManager.getSaveInterval()); saveIntervalEditor.setValue(designerEnvManager.getSaveInterval());
saveCommitCheckBox.setSelected(designerEnvManager.isSaveCommit()); saveCommitCheckBox.setSelected(designerEnvManager.isSaveCommit());
useIntervalCheckBox.setSelected(designerEnvManager.isUseInterval());
supportCellEditorDefCheckBox.setSelected(designerEnvManager.isSupportCellEditorDef()); supportCellEditorDefCheckBox.setSelected(designerEnvManager.isSupportCellEditorDef());
@ -680,6 +700,7 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setSaveInterval(this.saveIntervalEditor.getValue()); designerEnvManager.setSaveInterval(this.saveIntervalEditor.getValue());
designerEnvManager.setVcsEnable(this.vcsEnableCheckBox.isSelected()); designerEnvManager.setVcsEnable(this.vcsEnableCheckBox.isSelected());
designerEnvManager.setSaveCommit(this.saveCommitCheckBox.isSelected()); designerEnvManager.setSaveCommit(this.saveCommitCheckBox.isSelected());
designerEnvManager.setUseInterval(this.useIntervalCheckBox.isSelected());
if (this.autoPushUpdateCheckBox != null) { if (this.autoPushUpdateCheckBox != null) {
designerEnvManager.setAutoPushUpdateEnabled(this.autoPushUpdateCheckBox.isSelected()); designerEnvManager.setAutoPushUpdateEnabled(this.autoPushUpdateCheckBox.isSelected());
} }

5
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -197,11 +197,14 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
if (WorkContext.getCurrent().isLocal()) { if (WorkContext.getCurrent().isLocal()) {
toolbarDef.addShortCut(showInExplorerAction); toolbarDef.addShortCut(showInExplorerAction);
} }
toolbarDef.addShortCut(renameAction, delFileAction, vcsAction); toolbarDef.addShortCut(renameAction, delFileAction);
Set<ShortCut> extraShortCuts = ExtraDesignClassManager.getInstance().getExtraShortCuts(); Set<ShortCut> extraShortCuts = ExtraDesignClassManager.getInstance().getExtraShortCuts();
for (ShortCut shortCut : extraShortCuts) { for (ShortCut shortCut : extraShortCuts) {
toolbarDef.addShortCut(shortCut); toolbarDef.addShortCut(shortCut);
} }
if (VcsHelper.needInit()) {
toolbarDef.addShortCut(vcsAction);
}
toolbarDef.updateToolBar(toolBar); toolbarDef.updateToolBar(toolBar);
resetActionStatus(); resetActionStatus();
refresh(); refresh();

10
designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java

@ -7,6 +7,8 @@ import com.fr.design.gui.itree.filetree.TemplateFileTree;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.manage.PluginManager;
import com.fr.report.entity.VcsEntity; import com.fr.report.entity.VcsEntity;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
@ -27,6 +29,7 @@ public class VcsHelper {
private final static String VCS_DIR = "vcs"; private final static String VCS_DIR = "vcs";
public final static String VCS_CACHE_DIR = pathJoin(VCS_DIR, "cache"); public final static String VCS_CACHE_DIR = pathJoin(VCS_DIR, "cache");
private static final int MINUTE = 60 * 1000; private static final int MINUTE = 60 * 1000;
private final static String VCS_PLUGIN_ID = "com.fr.plugin.vcs.v10";
public final static String CURRENT_USERNAME = WorkContext.getCurrent().isLocal() public final static String CURRENT_USERNAME = WorkContext.getCurrent().isLocal()
@ -92,11 +95,16 @@ public class VcsHelper {
} }
public static boolean needDeleteVersion(VcsEntity entity) { public static boolean needDeleteVersion(VcsEntity entity) {
if (entity == null) { if (entity == null || !DesignerEnvManager.getEnvManager().isUseInterval()) {
return false; return false;
} }
return new Date().getTime() - entity.getTime().getTime() < DesignerEnvManager.getEnvManager().getSaveInterval() * MINUTE && StringUtils.isBlank(entity.getCommitMsg()); return new Date().getTime() - entity.getTime().getTime() < DesignerEnvManager.getEnvManager().getSaveInterval() * MINUTE && StringUtils.isBlank(entity.getCommitMsg());
} }
public static boolean needInit() {
PluginContext context = PluginManager.getContext(VCS_PLUGIN_ID);
return context == null || !context.isActive();
}
} }

Loading…
Cancel
Save