Browse Source

Merge branch 'release/10.0' of http://cloud.finedevelop.com:2015/scm/~mata.li/designrel into release/10.0

research/10.0
Mata.Li 6 years ago
parent
commit
a087b5561a
  1. 3
      designer-base/src/main/java/com/fr/design/DesignState.java
  2. 128
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  3. 82
      designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java
  4. 5
      designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java
  5. 4
      designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java
  6. 82
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  7. 15
      designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java
  8. 8
      designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java
  9. 14
      designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java
  10. 3
      designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java
  11. 8
      designer-base/src/main/java/com/fr/design/editor/editor/DateEditor.java
  12. 2
      designer-base/src/main/java/com/fr/design/extra/PluginUtils.java
  13. 2
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java
  14. 24
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  15. 27
      designer-base/src/main/java/com/fr/design/file/NewTemplatePane.java
  16. 3
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  17. 4
      designer-base/src/main/java/com/fr/design/formula/FunctionNAD.java
  18. 14
      designer-base/src/main/java/com/fr/design/fun/TemplateTreeShortCutProvider.java
  19. 26
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateTreeShortCutProvider.java
  20. 7
      designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java
  21. 3
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java
  22. 9
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java
  23. 5
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java
  24. 7
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java
  25. 30
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  26. 39
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  27. 20
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  28. 20
      designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java
  29. 36
      designer-base/src/main/java/com/fr/design/mainframe/ToolBarNewTemplatePane.java
  30. 5
      designer-base/src/main/java/com/fr/design/mainframe/UndoStateEdit.java
  31. 54
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  32. 46
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsScene.java
  33. 7
      designer-base/src/main/java/com/fr/design/menu/ShortCut.java
  34. 3
      designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java
  35. 2
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  36. 9
      designer-base/src/main/java/com/fr/design/utils/gui/GUIPaintUtils.java
  37. 23
      designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java
  38. 11
      designer-base/src/test/java/com/fr/design/actions/help/TutorialActionTest.java
  39. 9
      designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java
  40. 1
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  41. 1
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  42. 5
      designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java
  43. 3
      designer-form/src/main/java/com/fr/design/mainframe/FormToolBarButton.java
  44. 14
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  45. 3
      designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetButton.java
  46. 3
      designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java
  47. 5
      designer-form/src/main/java/com/fr/design/mainframe/WidgetToolBarPane.java
  48. 9
      designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java
  49. 7
      designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java
  50. 19
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  51. 3
      designer-realize/src/main/java/com/fr/design/mainframe/ReportComponent.java
  52. 3
      designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentCardPane.java
  53. 3
      designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java
  54. 3
      designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java
  55. 5
      designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java
  56. 3
      designer-realize/src/main/java/com/fr/design/webattr/ToolBarButton.java
  57. 5
      designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java
  58. 3
      designer-realize/src/main/java/com/fr/grid/GridColumnUI.java
  59. 13
      designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java
  60. 3
      designer-realize/src/main/java/com/fr/grid/GridRowUI.java
  61. 3
      designer-realize/src/main/java/com/fr/grid/GridUI.java
  62. 3
      designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java
  63. 3
      designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java
  64. 3
      designer-realize/src/main/java/com/fr/poly/PolyComponetsBar.java
  65. 7
      designer-realize/src/main/java/com/fr/poly/PolyDesigner.java
  66. 3
      designer-realize/src/main/java/com/fr/poly/actions/DeleteBlockAction.java
  67. 7
      designer-realize/src/main/java/com/fr/poly/creator/ChartBlockEditor.java
  68. 3
      designer-realize/src/main/java/com/fr/poly/creator/ECBlockEditor.java
  69. 5
      designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java
  70. 7
      designer-realize/src/main/java/com/fr/poly/hanlder/BottomCornerMouseHanlder.java
  71. 5
      designer-realize/src/main/java/com/fr/poly/hanlder/ColumnOperationMouseHandler.java
  72. 3
      designer-realize/src/main/java/com/fr/poly/hanlder/PolyDesignerDropTarget.java
  73. 5
      designer-realize/src/main/java/com/fr/poly/hanlder/RowOperationMouseHandler.java
  74. 15
      designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java
  75. 7
      designer-realize/src/main/java/com/fr/start/Designer.java
  76. 5
      designer-realize/src/main/java/com/fr/start/SplashContext.java
  77. 7
      designer-realize/src/main/java/com/fr/start/jni/SplashMac.java
  78. 2
      designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java

3
designer-base/src/main/java/com/fr/design/DesignState.java

@ -1,6 +1,7 @@
package com.fr.design; package com.fr.design;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
@ -43,7 +44,7 @@ public class DesignState {
// designState += REMOTE; // designState += REMOTE;
// } // }
// isRoot = env != null && env.isRoot(); // isRoot = env != null && env.isRoot();
isAuthority = BaseUtils.isAuthorityEditing(); isAuthority = DesignerMode.isAuthorityEditing();
} }
public int getDesignState() { public int getDesignState() {

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

@ -22,10 +22,9 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogFormatter; import com.fr.general.FRLogFormatter;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.general.xml.GeneralXMLTools; import com.fr.general.xml.GeneralXMLTools;
import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.CommonUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
import com.fr.stable.ListMap; import com.fr.stable.ListMap;
@ -43,10 +42,9 @@ import com.fr.workspace.WorkContext;
import com.fr.workspace.WorkContextCallback; import com.fr.workspace.WorkContextCallback;
import com.fr.workspace.connect.AuthException; import com.fr.workspace.connect.AuthException;
import javax.swing.SwingWorker; import javax.swing.*;
import javax.swing.SwingWorker.StateValue; import javax.swing.SwingWorker.StateValue;
import java.awt.Color; import java.awt.*;
import java.awt.Rectangle;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.FileReader; import java.io.FileReader;
@ -111,7 +109,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private Color paginationLineColor = Color.black; // line color of paper private Color paginationLineColor = Color.black; // line color of paper
private boolean supportCellEditorDef = false; private boolean supportCellEditorDef = false;
private boolean isDragPermited = false; private boolean isDragPermited = false;
private int language; private Locale language = Locale.SIMPLIFIED_CHINESE;
//2014-8-26默认显示全部, 因为以前的版本, 虽然是false, 实际上是显示所有表, 因此这边要兼容 //2014-8-26默认显示全部, 因为以前的版本, 虽然是false, 实际上是显示所有表, 因此这边要兼容
private boolean useOracleSystemSpace = true; private boolean useOracleSystemSpace = true;
private int cachingTemplateLimit = CACHINGTEMPLATE_LIMIT; private int cachingTemplateLimit = CACHINGTEMPLATE_LIMIT;
@ -553,7 +551,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
return; return;
} }
try { try {
String envName = getDefaultEnvName(); final String envName = getDefaultEnvName();
WorkContext.switchTo(DesignerWorkspaceGenerator.generate(getDefaultConfig()), new WorkContextCallback() { WorkContext.switchTo(DesignerWorkspaceGenerator.generate(getDefaultConfig()), new WorkContextCallback() {
@Override @Override
@ -715,37 +713,15 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
/** /**
* 返回语言类型 * 返回语言类型
*/ */
public int getLanguage() { public Locale getLanguage() {
return this.language; return language;
}
/**
* 返回语言类型
*/
public Locale getLocale() {
// 性能
if (language <= 1) {
return Locale.CHINA;
}
Locale[] locales = supportLocale();
if (language <= locales.length) {
return locales[language - 1];
}
return Locale.CHINA;
}
// 当前系统支持的语言
protected Locale[] supportLocale() {
Inter.getInstance();
Map<Locale, String> languageMap = InterProviderFactory.getProvider().getSupportLocaleMap();
return languageMap.keySet().toArray(new Locale[languageMap.size()]);
} }
/** /**
* 设置语言参数 * 设置语言参数
*/ */
public void setLanguage(int i) { public void setLanguage(Locale locale) {
this.language = i; this.language = locale;
} }
/** /**
@ -1312,7 +1288,34 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private void readLanguage(XMLableReader reader) { private void readLanguage(XMLableReader reader) {
String tmpVal; String tmpVal;
if ((tmpVal = reader.getElementValue()) != null) { if ((tmpVal = reader.getElementValue()) != null) {
this.setLanguage(Integer.parseInt(tmpVal)); if (!CommonUtils.isNumber(tmpVal)) {
setLanguage(CommonUtils.stringToLocale(tmpVal));
} else {
// 用于兼容10.0之前的版本
int value = Integer.parseInt(tmpVal);
switch (value) {
case 0:
setLanguage(Locale.SIMPLIFIED_CHINESE);
break;
case 1:
setLanguage(Locale.US);
break;
case 2:
setLanguage(Locale.JAPAN);
break;
case 3:
setLanguage(Locale.TRADITIONAL_CHINESE);
break;
case 4:
setLanguage(Locale.KOREA);
break;
case 5:
setLanguage(new Locale("pt", "PT"));
break;
default:
setLanguage(Locale.SIMPLIFIED_CHINESE);
}
}
} }
} }
@ -1370,6 +1373,34 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
reader.readXMLObject(this.configManager); reader.readXMLObject(this.configManager);
} }
public String getUUID() {
return StringUtils.isEmpty(uuid) ? UUID.randomUUID().toString() : uuid;
}
public int getActiveKeyStatus() {
return activeKeyStatus;
}
public void setActiveKeyStatus(int activeKeyStatus) {
this.activeKeyStatus = activeKeyStatus;
}
public AlphaFineConfigManager getAlphaFineConfigManager() {
return alphaFineConfigManager;
}
public void setAlphaFineConfigManager(AlphaFineConfigManager alphaFineConfigManager) {
this.alphaFineConfigManager = alphaFineConfigManager;
}
public boolean isImageCompress() {
return imageCompress;
}
public void setImageCompress(boolean imageCompress) {
this.imageCompress = imageCompress;
}
/** /**
* Read XML.<br> * Read XML.<br>
* The method will be invoked when read data from XML file.<br> * The method will be invoked when read data from XML file.<br>
@ -1642,17 +1673,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
} }
} }
public String getUUID() {
return StringUtils.isEmpty(uuid) ? UUID.randomUUID().toString() : uuid;
}
public int getActiveKeyStatus() {
return activeKeyStatus;
}
public void setActiveKeyStatus(int activeKeyStatus) {
this.activeKeyStatus = activeKeyStatus;
}
//写入uuid //写入uuid
private void writeUUID(XMLPrintWriter writer) { private void writeUUID(XMLPrintWriter writer) {
@ -1816,7 +1836,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
writer.textNode("" + this.lastOpenFilePath); writer.textNode("" + this.lastOpenFilePath);
writer.end(); writer.end();
writer.startTAG("Language").textNode(String.valueOf(this.language)).end() writer.startTAG("Language").textNode(CommonUtils.localeToString(language)).end()
.startTAG("JettyServerPort").textNode(String.valueOf(this.jettyServerPort)).end(); .startTAG("JettyServerPort").textNode(String.valueOf(this.jettyServerPort)).end();
} }
@ -1869,20 +1889,4 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
.end(); .end();
} }
public AlphaFineConfigManager getAlphaFineConfigManager() {
return alphaFineConfigManager;
}
public void setAlphaFineConfigManager(AlphaFineConfigManager alphaFineConfigManager) {
this.alphaFineConfigManager = alphaFineConfigManager;
}
public boolean isImageCompress() {
return imageCompress;
}
public void setImageCompress(boolean imageCompress) {
this.imageCompress = imageCompress;
}
} }

82
designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java

@ -1 +1,81 @@
package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.design.constants.UIConstants; import com.fr.design.menu.KeySetUtils; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.designer.TargetComponent; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.*; /** * Author : daisy * Date: 13-8-30 * Time: 上午10:12 */ public class AllowAuthorityEditAction extends TemplateComponentAction { public AllowAuthorityEditAction(TargetComponent t) { super(t); this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png")); } /** * 撤销 */ public void prepare4Undo() { HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().iniAuthorityUndoState(); } /** * 执行动作 * * @return 是否执行成功 */ public boolean executeActionReturnUndoRecordNeeded() { TargetComponent tc = getEditingComponent(); if (tc == null) { return false; } cleanAuthorityCondition(); //进入时是格式刷则取消格式刷 if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { tc.cancelFormat(); } BaseUtils.setAuthorityEditing(true); ReportAndFSManagePane.getInstance().refreshDockingView(); RolesAlreadyEditedPane.getInstance().refreshDockingView(); WestRegionContainerPane.getInstance().replaceDownPane(ReportAndFSManagePane.getInstance()); DesignerContext.getDesignerFrame().setCloseMode(UIConstants.CLOSE_OF_AUTHORITY); DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus()); DesignerContext.getDesignerFrame().needToAddAuhtorityPaint(); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION); EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(tc.getEastUpPane()); DesignerContext.getDesignerFrame().refreshDottedLine(); EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().removeParameterPane(); //画虚线 return true; } /** * 进入权限编辑之前将权限编辑界面重置一下工具栏 */ private void cleanAuthorityCondition() { java.util.List<JTemplate<?, ?>> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); for (int i = 0; i < opendedTemplate.size(); i++) { opendedTemplate.get(i).cleanAuthorityUndo(); } } } package com.fr.design.actions;
import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.*;
/**
* Author : daisy
* Date: 13-8-30
* Time: 上午10:12
*/
public class AllowAuthorityEditAction extends TemplateComponentAction {
public AllowAuthorityEditAction(TargetComponent t) {
super(t);
this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png"));
}
/**
* 撤销
*/
public void prepare4Undo() {
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().iniAuthorityUndoState();
}
/**
* 执行动作
*
* @return 是否执行成功
*/
public boolean executeActionReturnUndoRecordNeeded() {
TargetComponent tc = getEditingComponent();
if (tc == null) {
return false;
}
cleanAuthorityCondition();
//进入时是格式刷则取消格式刷
if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) {
tc.cancelFormat();
}
DesignerMode.setMode(DesignerMode.AUTHORITY);
ReportAndFSManagePane.getInstance().refreshDockingView();
RolesAlreadyEditedPane.getInstance().refreshDockingView();
WestRegionContainerPane.getInstance().replaceDownPane(ReportAndFSManagePane.getInstance());
DesignerContext.getDesignerFrame().setCloseMode(UIConstants.CLOSE_OF_AUTHORITY);
DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus());
DesignerContext.getDesignerFrame().needToAddAuhtorityPaint();
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION);
EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(tc.getEastUpPane());
DesignerContext.getDesignerFrame().refreshDottedLine();
EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance());
EastRegionContainerPane.getInstance().removeParameterPane();
//画虚线
return true;
}
/**
* 进入权限编辑之前将权限编辑界面重置一下工具栏
*/
private void cleanAuthorityCondition() {
java.util.List<JTemplate<?, ?>> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList();
for (int i = 0; i < opendedTemplate.size(); i++) {
opendedTemplate.get(i).cleanAuthorityUndo();
}
}
}

5
designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java

@ -1,6 +1,7 @@
package com.fr.design.actions; package com.fr.design.actions;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
@ -33,8 +34,8 @@ public class ExitAuthorityEditAction extends TemplateComponentAction {
return false; return false;
} }
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
BaseUtils.setAuthorityEditing(false); DesignerMode.setMode(DesignerMode.NORMARL);
WestRegionContainerPane.getInstance().replaceDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); WestRegionContainerPane.getInstance().replaceDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane();
DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus()); DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus());

4
designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java

@ -4,8 +4,8 @@ import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -33,7 +33,7 @@ public class VideoAction extends UpdateAction
public void actionPerformed(ActionEvent arg0) public void actionPerformed(ActionEvent arg0)
{ {
String url; String url;
if (FRContext.getLocale().equals(Locale.US)) { if (GeneralContext.getLocale().equals(Locale.US)) {
url = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en"); url = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en");
} else { } else {
url = CloudCenter.getInstance().acquireUrlByKind("bbs.video"); url = CloudCenter.getInstance().acquireUrlByKind("bbs.video");

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

@ -12,6 +12,7 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIDictionaryComboBox;
import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
@ -23,7 +24,6 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.log.Log4jConfig; import com.fr.general.log.Log4jConfig;
import com.fr.locale.InterProviderFactory; import com.fr.locale.InterProviderFactory;
import com.fr.third.apache.log4j.Level; import com.fr.third.apache.log4j.Level;
@ -32,14 +32,11 @@ import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.io.File; import java.io.File;
import java.util.ArrayList;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
@ -87,9 +84,7 @@ public class PreferencePane extends BasicPane {
private static final String DISPLAY_MINUS = "-"; private static final String DISPLAY_MINUS = "-";
private static final Level[] LOG = {Level.FATAL, Level.ERROR, Level.WARN, Level.INFO, Level.DEBUG}; private static final Level[] LOG = {Level.FATAL, Level.ERROR, Level.WARN, Level.INFO, Level.DEBUG};
private static java.util.List<String> LANGUAGE = new ArrayList<>();
private static int designerEnvLanguageIndex; // 打开设置对话框时,设计器使用的语言
private boolean languageChanged; // 是否修改了设计器语言设置 private boolean languageChanged; // 是否修改了设计器语言设置
//设置是否支持undo //设置是否支持undo
private UICheckBox supportUndoCheckBox; private UICheckBox supportUndoCheckBox;
@ -114,7 +109,8 @@ public class PreferencePane extends BasicPane {
private UITextField logExportDirectoryField; private UITextField logExportDirectoryField;
private UIComboBox logLevelComboBox, languageComboBox, pageLengthComboBox, reportLengthComboBox; private UIComboBox logLevelComboBox, pageLengthComboBox, reportLengthComboBox;
private UIDictionaryComboBox<Locale> languageComboBox;
private IntegerEditor portEditor; private IntegerEditor portEditor;
private UITextField jdkHomeTextField; private UITextField jdkHomeTextField;
private UICheckBox oracleSpace; private UICheckBox oracleSpace;
@ -123,18 +119,8 @@ public class PreferencePane extends BasicPane {
public PreferencePane() { public PreferencePane() {
this.initComponents(); this.initComponents();
this.initLanguageItems();
} }
// 语言选项
private void initLanguageItems() {
LANGUAGE.clear();
Map<Locale, String> map = InterProviderFactory.getProvider().getSupportLocaleMap();
LANGUAGE.add(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Language_Default"));
for (Locale locale : map.keySet()) {
LANGUAGE.add(getLocaledLanguage(map.get(locale), locale));
}
}
protected void initComponents() { protected void initComponents() {
JPanel contentPane = this; JPanel contentPane = this;
@ -182,13 +168,6 @@ public class PreferencePane extends BasicPane {
advancePane.add(spaceUpPane); advancePane.add(spaceUpPane);
} }
private static String getLocaledLanguage(String key, Locale locale) {
StringBuilder sb = new StringBuilder();
sb.append(com.fr.design.i18n.Toolkit.i18nText(key)).append("(");
sb.append(com.fr.design.i18n.Toolkit.i18nText(key)).append(")");
return sb.toString();
}
private void createFunctionPane(JPanel generalPane) { private void createFunctionPane(JPanel generalPane) {
JPanel functionPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Preference-Function")); JPanel functionPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Preference-Function"));
generalPane.add(functionPane); generalPane.add(functionPane);
@ -379,8 +358,9 @@ public class PreferencePane extends BasicPane {
JPanel LanguagePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Choose_Language")); JPanel LanguagePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Choose_Language"));
generalPane.add(languageAndDashBoard_pane); generalPane.add(languageAndDashBoard_pane);
languageAndDashBoard_pane.add(LanguagePane); languageAndDashBoard_pane.add(LanguagePane);
languageComboBox = new UIComboBox(LANGUAGE.toArray());
languageComboBox.setFont(FRFont.getInstance("Dialog", Font.PLAIN, 12));//为了在中文系统中显示韩文 languageComboBox = createLanguageComboBox();
ActionLabel languageLabel = new ActionLabel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Designer_Language")); ActionLabel languageLabel = new ActionLabel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Designer_Language"));
languageLabel.addActionListener(new ActionListener() { languageLabel.addActionListener(new ActionListener() {
@Override @Override
@ -402,16 +382,26 @@ public class PreferencePane extends BasicPane {
Component[][] components = { Component[][] components = {
{languageLabel, languageComboBox, noticeLabel}, {languageLabel, languageComboBox, noticeLabel},
}; };
languageComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
//Inter.fr = ResourceBundle.getBundle("com/fr/general/locale/fr", Locale.US);
}
});
JPanel choosePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel choosePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
LanguagePane.add(choosePane); LanguagePane.add(choosePane);
} }
private UIDictionaryComboBox<Locale> createLanguageComboBox() {
Map<Locale, String> map = InterProviderFactory.getProvider().getSupportLocaleMap();
int size = map.size();
Locale[] keys = new Locale[size];
String[] values = new String[size];
int i = 0;
for (Map.Entry<Locale, String> entry : map.entrySet()) {
keys[i] = entry.getKey();
values[i] = com.fr.design.i18n.Toolkit.i18nText(entry.getValue());
i++;
}
UIDictionaryComboBox<Locale> languageComboBox = new UIDictionaryComboBox<>(keys, values);
languageComboBox.setFont(FRFont.getInstance("Dialog", Font.PLAIN, 12));//为了在中文系统中显示韩文
return languageComboBox;
}
private String getDisplayShortCut(String shotrCut) { private String getDisplayShortCut(String shotrCut) {
return shotrCut.replace(TYPE, DISPLAY_TYPE).replace(BACK_SLASH, DISPLAY_BACK_SLASH).replace(SLASH, DISPLAY_SLASH) return shotrCut.replace(TYPE, DISPLAY_TYPE).replace(BACK_SLASH, DISPLAY_BACK_SLASH).replace(SLASH, DISPLAY_SLASH)
.replace(CONTROL, DISPLAY_CONTROL).replace(OPEN_BRACKET, DISPLAY_OPEN_BRACKET).replace(CLOSE_BRACKET, DISPLAY_CLOSE_BRACKET) .replace(CONTROL, DISPLAY_CONTROL).replace(OPEN_BRACKET, DISPLAY_OPEN_BRACKET).replace(CLOSE_BRACKET, DISPLAY_CLOSE_BRACKET)
@ -564,8 +554,8 @@ public class PreferencePane extends BasicPane {
this.logLevelComboBox.setSelectedItem(Log4jConfig.getInstance().getRootLevel()); this.logLevelComboBox.setSelectedItem(Log4jConfig.getInstance().getRootLevel());
this.languageComboBox.setSelectedItem(LANGUAGE.get(designerEnvManager.getLanguage())); this.languageComboBox.setSelectedItem(designerEnvManager.getLanguage());
designerEnvLanguageIndex = designerEnvManager.getLanguage();
this.pageLengthComboBox.setSelectedIndex(designerEnvManager.getPageLengthUnit()); this.pageLengthComboBox.setSelectedIndex(designerEnvManager.getPageLengthUnit());
this.reportLengthComboBox.setSelectedIndex(designerEnvManager.getReportLengthUnit()); this.reportLengthComboBox.setSelectedIndex(designerEnvManager.getReportLengthUnit());
@ -625,7 +615,7 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setPaginationLineColor(paginationLineColorTBButton.getColor()); designerEnvManager.setPaginationLineColor(paginationLineColorTBButton.getColor());
designerEnvManager.setLanguage(getLanguageInt()); designerEnvManager.setLanguage(languageComboBox.getSelectedItem());
designerEnvManager.setPageLengthUnit((short) pageLengthComboBox.getSelectedIndex()); designerEnvManager.setPageLengthUnit((short) pageLengthComboBox.getSelectedIndex());
designerEnvManager.setReportLengthUnit((short) reportLengthComboBox.getSelectedIndex()); designerEnvManager.setReportLengthUnit((short) reportLengthComboBox.getSelectedIndex());
@ -637,7 +627,6 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected()); designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected());
designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue()); designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue());
designerEnvManager.setJoinProductImprove(this.joinProductImprove.isSelected()); designerEnvManager.setJoinProductImprove(this.joinProductImprove.isSelected());
// designerEnvManager.setAutoBackUp(this.autoBackUp.isSelected());
designerEnvManager.setUndoLimit(maxUndoLimit.getSelectedIndex() * SELECTED_INDEX_5); designerEnvManager.setUndoLimit(maxUndoLimit.getSelectedIndex() * SELECTED_INDEX_5);
if (maxUndoLimit.getSelectedIndex() == SELECTED_INDEX_5) { if (maxUndoLimit.getSelectedIndex() == SELECTED_INDEX_5) {
@ -648,21 +637,6 @@ public class PreferencePane extends BasicPane {
} }
/*
* 得到所选语言的int值
*/
private int getLanguageInt() {
int l = 0;
String lang = (String) this.languageComboBox.getSelectedItem();
for (int i = 0; i < LANGUAGE.size(); i++) {
if (ComparatorUtils.equals(lang, LANGUAGE.get(i))) {
l = i;
break;
}
}
return l;
}
// 如果语言设置改变了,则显示重启对话框 // 如果语言设置改变了,则显示重启对话框
public void showRestartDialog() { public void showRestartDialog() {
@ -689,11 +663,7 @@ public class PreferencePane extends BasicPane {
return showWindow(window, new DialogActionAdapter() { return showWindow(window, new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
if (languageComboBox.getSelectedIndex() != designerEnvLanguageIndex) { languageChanged = !ComparatorUtils.equals(languageComboBox.getSelectedItem(), DesignerEnvManager.getEnvManager(false).getLanguage());
languageChanged = true;
} else {
languageChanged = false;
}
} }
}); });
} }

15
designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java

@ -9,14 +9,10 @@ import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.general.GeneralContext;
import com.fr.stable.EnvChangedListener;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.WorkContextCallback; import com.fr.workspace.WorkContextCallback;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
@ -36,17 +32,6 @@ public class SwitchExistEnv extends MenuDef {
this.setName(getMenuKeySet().getMenuName()); this.setName(getMenuKeySet().getMenuName());
this.setHasScrollSubMenu(true); this.setHasScrollSubMenu(true);
initMenuDef(); initMenuDef();
JTemplate<?, ?> t = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (t != null) {
GeneralContext.addEnvWillChangedListener(
t.getPath(),
new EnvChangedListener() {
public void envChanged() {
SwitchExistEnv.this.clearShortCuts();
initMenuDef();
}
});
}
} }
private void initMenuDef() { private void initMenuDef() {

8
designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java

@ -1,6 +1,7 @@
package com.fr.design.actions.file; package com.fr.design.actions.file;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PreviewProvider;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
@ -15,6 +16,7 @@ import com.fr.stable.web.AbstractWebletCreator;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
public final class WebPreviewUtils { public final class WebPreviewUtils {
@ -34,6 +36,12 @@ public final class WebPreviewUtils {
return; return;
} }
if (map == null || map == Collections.EMPTY_MAP) {
map = new HashMap<>();
}
if (DesignerMode.isVcsMode()) {
map.put("mode", DesignerMode.getMode().toString());
}
DesignerContext.getDesignerFrame().refreshToolbar(); DesignerContext.getDesignerFrame().refreshToolbar();
jt.stopEditing(); jt.stopEditing();

14
designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java

@ -10,8 +10,8 @@ import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
@ -72,16 +72,16 @@ public class AboutPane extends JPanel {
addPhoneAndQQPane(contentPane); addPhoneAndQQPane(contentPane);
// 官网 // 官网
JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Official_Website"), CloudCenter.getInstance().acquireUrlByKind("website." + FRContext.getLocale(), ProductConstants.WEBSITE_URL)); JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Official_Website"), CloudCenter.getInstance().acquireUrlByKind("website." + GeneralContext.getLocale(), ProductConstants.WEBSITE_URL));
// 支持邮箱 // 支持邮箱
String defaultEmail = CloudCenter.getInstance().acquireUrlByKind("support.email", ProductConstants.SUPPORT_EMAIL); String defaultEmail = CloudCenter.getInstance().acquireUrlByKind("support.email", ProductConstants.SUPPORT_EMAIL);
JPanel emailPane = getEmailActionPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Support_Email"), CloudCenter.getInstance().acquireUrlByKind("support.email." + FRContext.getLocale(), defaultEmail)); JPanel emailPane = getEmailActionPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Support_Email"), CloudCenter.getInstance().acquireUrlByKind("support.email." + GeneralContext.getLocale(), defaultEmail));
contentPane.add(urlActionPane); contentPane.add(urlActionPane);
contentPane.add(emailPane); contentPane.add(emailPane);
if (FRContext.getLocale().equals(Locale.CHINA) || FRContext.getLocale().equals(Locale.TAIWAN)){ if (GeneralContext.getLocale().equals(Locale.CHINA) || GeneralContext.getLocale().equals(Locale.TAIWAN)) {
contentPane.add(getRemarkPane()); contentPane.add(getRemarkPane());
} }
@ -93,13 +93,13 @@ public class AboutPane extends JPanel {
private void addPhoneAndQQPane(JPanel contentPane) { private void addPhoneAndQQPane(JPanel contentPane) {
BoxCenterAligmentPane boxCenterAlignmentPane; BoxCenterAligmentPane boxCenterAlignmentPane;
// 英文版不显示服务电话和QQ // 英文版不显示服务电话和QQ
if (FRContext.getLocale().equals(Locale.US)) { if (GeneralContext.getLocale().equals(Locale.US)) {
return; return;
} }
boxCenterAlignmentPane = new BoxCenterAligmentPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Service_Phone") + CloudCenter.getInstance().acquireUrlByKind("service.phone." + FRContext.getLocale(), COMPANY_TELEPHONE)); boxCenterAlignmentPane = new BoxCenterAligmentPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Service_Phone") + CloudCenter.getInstance().acquireUrlByKind("service.phone." + FRContext.getLocale(), COMPANY_TELEPHONE));
contentPane.add(boxCenterAlignmentPane); contentPane.add(boxCenterAlignmentPane);
// 繁体版不显示QQ // 繁体版不显示QQ
if (FRContext.getLocale().equals(Locale.TAIWAN)) { if (GeneralContext.getLocale().equals(Locale.TAIWAN)) {
return; return;
} }
boxCenterAlignmentPane = new BoxCenterAligmentPane("QQ: " + CloudCenter.getInstance().acquireUrlByKind("help.qq")); boxCenterAlignmentPane = new BoxCenterAligmentPane("QQ: " + CloudCenter.getInstance().acquireUrlByKind("help.qq"));
@ -110,7 +110,7 @@ public class AboutPane extends JPanel {
private boolean shouldShowThanks() { private boolean shouldShowThanks() {
Locale[] hideLocales = {Locale.US, Locale.KOREA, Locale.JAPAN}; Locale[] hideLocales = {Locale.US, Locale.KOREA, Locale.JAPAN};
for (Locale loc : hideLocales) { for (Locale loc : hideLocales) {
if (FRContext.getLocale().equals(loc)) { if (GeneralContext.getLocale().equals(loc)) {
return false; return false;
} }
} }

3
designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java

@ -6,6 +6,7 @@ import com.fr.base.Utils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.general.http.HttpToolbox; import com.fr.general.http.HttpToolbox;
import com.fr.stable.CommonUtils; import com.fr.stable.CommonUtils;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
@ -78,7 +79,7 @@ public class TutorialAction extends UpdateAction {
// 生成帮助文档 sitecenter key, help.zh_CN.10 // 生成帮助文档 sitecenter key, help.zh_CN.10
protected String createDocKey() { protected String createDocKey() {
String locale = FRContext.getLocale().toString(); String locale = GeneralContext.getLocale().toString();
return CommonUtils.join(new String[]{ "help", locale, ProductConstants.MAIN_VERSION }, "."); return CommonUtils.join(new String[]{ "help", locale, ProductConstants.MAIN_VERSION }, ".");
} }

8
designer-base/src/main/java/com/fr/design/editor/editor/DateEditor.java

@ -6,9 +6,9 @@ package com.fr.design.editor.editor;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.gui.date.UIDatePicker; import com.fr.design.gui.date.UIDatePicker;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.GeneralContext;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
@ -60,9 +60,9 @@ public class DateEditor extends Editor<Date> {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
uiDatePicker = new UIDatePicker(); uiDatePicker = new UIDatePicker();
if (format) { if (format) {
int dateStyle = (FRContext.getLocale() == Locale.ENGLISH int dateStyle = (GeneralContext.getLocale() == Locale.ENGLISH
|| FRContext.getLocale() == Locale.US || GeneralContext.getLocale() == Locale.US
|| FRContext.getLocale() == Locale.UK) ? uiDatePicker.STYLE_EN_DATE : uiDatePicker.STYLE_CN_DATE; || GeneralContext.getLocale() == Locale.UK) ? uiDatePicker.STYLE_EN_DATE : uiDatePicker.STYLE_CN_DATE;
uiDatePicker.setStyle(dateStyle); uiDatePicker.setStyle(dateStyle);
uiDatePicker.setEditable(false); uiDatePicker.setEditable(false);
} }

2
designer-base/src/main/java/com/fr/design/extra/PluginUtils.java

@ -229,7 +229,7 @@ public class PluginUtils {
jo.put("free", pluginContext.isFree()); jo.put("free", pluginContext.isFree());
jo.put("licDamaged", pluginContext.isLicDamaged()); jo.put("licDamaged", pluginContext.isLicDamaged());
jo.put("available", pluginContext.isAvailable()); jo.put("available", pluginContext.isAvailable());
jo.put("leftDays", String.valueOf(pluginContext.getLeftDays())); jo.put("leftDays", pluginContext.getLeftDays());
jo.put("trial", pluginContext.isOnTrial()); jo.put("trial", pluginContext.isOnTrial());
jo.put("deadline", getDeadline(pluginContext)); jo.put("deadline", getDeadline(pluginContext));
jo.put("registerFailed", pluginContext.isRegisterFailed()); jo.put("registerFailed", pluginContext.isRegisterFailed());

2
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java

@ -114,7 +114,6 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C
public void closeSelectedReport(JTemplate<?, ?> selected) { public void closeSelectedReport(JTemplate<?, ?> selected) {
DesignModuleFactory.clearChartPropertyPane(); DesignModuleFactory.clearChartPropertyPane();
DesignTableDataManager.closeTemplate(selected); DesignTableDataManager.closeTemplate(selected);
GeneralContext.removeEnvWillChangedListener(selected.getPath());
if (contains(selected) == -1) { if (contains(selected) == -1) {
return; return;
} }
@ -139,7 +138,6 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C
public void closeVirtualSelectedReport(JTemplate<?, ?> selected) { public void closeVirtualSelectedReport(JTemplate<?, ?> selected) {
DesignModuleFactory.clearChartPropertyPane(); DesignModuleFactory.clearChartPropertyPane();
DesignTableDataManager.closeTemplate(selected); DesignTableDataManager.closeTemplate(selected);
GeneralContext.removeEnvWillChangedListener(selected.getPath());
if (contains(selected) == -1) { if (contains(selected) == -1) {
return; return;
} }

24
designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java

@ -3,6 +3,7 @@ package com.fr.design.file;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIScrollPopUpMenu; import com.fr.design.gui.imenu.UIScrollPopUpMenu;
@ -313,6 +314,15 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
} }
public void paint(Graphics g) {
//不可见时,按钮.4f透明
AlphaComposite composite = DesignerMode.isVcsMode()
? AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.4f)
: (AlphaComposite) ((Graphics2D) g).getComposite();
((Graphics2D) g).setComposite(composite);
super.paint(g);
}
private void paintBackgroundAndLine(Graphics2D g2d, double maxWidth) { private void paintBackgroundAndLine(Graphics2D g2d, double maxWidth) {
paintDefaultBackground(g2d); paintDefaultBackground(g2d);
//最多能画的个数 //最多能画的个数
@ -359,7 +369,9 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
templateStartX += realWidth; templateStartX += realWidth;
} }
if (!DesignerMode.isVcsMode()) {
paintListDown(g2d, maxWidth); paintListDown(g2d, maxWidth);
}
paintUnderLine(templateStartX, maxWidth, g2d); paintUnderLine(templateStartX, maxWidth, g2d);
} }
@ -538,7 +550,9 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
g2d.drawString(sheetName, (int) templateStartX + sheeticon.getIconWidth() + 2 * GAP, getHeight() - GAP * 2); g2d.drawString(sheetName, (int) templateStartX + sheeticon.getIconWidth() + 2 * GAP, getHeight() - GAP * 2);
int closePosition = (int) templateStartX + realWidth - CLOSE.getIconWidth() - SMALLGAP; int closePosition = (int) templateStartX + realWidth - CLOSE.getIconWidth() - SMALLGAP;
int closeY = (getHeight() - closeIcon.getIconHeight()) / 2; int closeY = (getHeight() - closeIcon.getIconHeight()) / 2;
if (!DesignerMode.isVcsMode()) {
closeIcon.paintIcon(this, g2d, closePosition, closeY); closeIcon.paintIcon(this, g2d, closePosition, closeY);
}
return closePosition; return closePosition;
} }
@ -594,7 +608,9 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
g2d.drawString(sheetName, (int) templateStartX + sheeticon.getIconWidth() + 2 * GAP, getHeight() - GAP * 2); g2d.drawString(sheetName, (int) templateStartX + sheeticon.getIconWidth() + 2 * GAP, getHeight() - GAP * 2);
int closeY = (getHeight() - closeIcon.getIconHeight()) / 2; int closeY = (getHeight() - closeIcon.getIconHeight()) / 2;
int closePosition = (int) templateStartX + realWidth - CLOSE.getIconWidth() - SMALLGAP; int closePosition = (int) templateStartX + realWidth - CLOSE.getIconWidth() - SMALLGAP;
if (!DesignerMode.isVcsMode()) {
closeIcon.paintIcon(this, g2d, closePosition, closeY); closeIcon.paintIcon(this, g2d, closePosition, closeY);
}
return closePosition; return closePosition;
} }
@ -640,6 +656,10 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
* @param e 鼠标事件 * @param e 鼠标事件
*/ */
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
//如果在版本管理情况下,不允许切换tab
if (DesignerMode.isVcsMode()) {
return;
}
int evtX = e.getX(); int evtX = e.getX();
int evtY = e.getY(); int evtY = e.getY();
@ -672,7 +692,7 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
openedTemplate.get(selectedIndex).stopEditing(); openedTemplate.get(selectedIndex).stopEditing();
selectedIndex = getTemplateIndex(evtX); selectedIndex = getTemplateIndex(evtX);
//如果在权限编辑情况下,不允许切换到表单类型的工作簿 //如果在权限编辑情况下,不允许切换到表单类型的工作簿
if (BaseUtils.isAuthorityEditing() && !openedTemplate.get(selectedIndex).isJWorkBook()) { if (DesignerMode.isAuthorityEditing() && !openedTemplate.get(selectedIndex).isJWorkBook()) {
DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(tempSelectedIndex)); DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(tempSelectedIndex));
JOptionPane.showMessageDialog(this, com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Form-AuthorityEdited_Cannot_be_Supported") JOptionPane.showMessageDialog(this, com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Form-AuthorityEdited_Cannot_be_Supported")
+ "!", com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Alert"), JOptionPane.WARNING_MESSAGE); + "!", com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Alert"), JOptionPane.WARNING_MESSAGE);
@ -712,7 +732,7 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
filename = OperatingSystem.isWindows() ? filename.replaceAll("/", "\\\\") : filename.replaceAll("\\\\", "/"); filename = OperatingSystem.isWindows() ? filename.replaceAll("/", "\\\\") : filename.replaceAll("\\\\", "/");
if (!specifiedTemplate.isALLSaved()) { if (!specifiedTemplate.isALLSaved() && !DesignerMode.isVcsMode()) {
specifiedTemplate.stopEditing(); specifiedTemplate.stopEditing();
int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Utils-Would_you_like_to_save") + " \"" + specifiedTemplate.getEditingFILE() + "\" ?", int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Utils-Would_you_like_to_save") + " \"" + specifiedTemplate.getEditingFILE() + "\" ?",
ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);

27
designer-base/src/main/java/com/fr/design/file/NewTemplatePane.java

@ -1,6 +1,7 @@
package com.fr.design.file; package com.fr.design.file;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -20,11 +21,10 @@ import java.awt.geom.Rectangle2D;
public abstract class NewTemplatePane extends JComponent implements MouseListener, MouseMotionListener { public abstract class NewTemplatePane extends JComponent implements MouseListener, MouseMotionListener {
private static final Icon GRAY_NEW_CPT = BaseUtils.readIcon("/com/fr/design/images/buttonicon/additicon_grey.png"); private static final Icon GRAY_NEW_CPT = BaseUtils.readIcon("/com/fr/design/images/buttonicon/additicon_grey.png");
private static final int PRE_GAP = 0; private static final int ICON_START_X = 5;
private static final int HEIGHT = 26; private static final int HEIGHT = 26;
private Graphics2D g2d; private Graphics2D g2d;
private Icon newWorkBookIconMode = null; private Icon newWorkBookIconMode = null;
private int newIconStartX = PRE_GAP;
public NewTemplatePane() { public NewTemplatePane() {
@ -49,7 +49,7 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene
g2d.setColor(UIConstants.TEMPLATE_TAB_PANE_BACKGROUND); g2d.setColor(UIConstants.TEMPLATE_TAB_PANE_BACKGROUND);
g2d.fill(new Rectangle2D.Double(0, 0, getWidth(),getHeight())); g2d.fill(new Rectangle2D.Double(0, 0, getWidth(),getHeight()));
int sheetIconY = (getHeight() - newWorkBookIconMode.getIconHeight()) / 2; int sheetIconY = (getHeight() - newWorkBookIconMode.getIconHeight()) / 2;
newWorkBookIconMode.paintIcon(this, g2d, newIconStartX, sheetIconY); newWorkBookIconMode.paintIcon(this, g2d, ICON_START_X, sheetIconY);
// paintUnderLine(g2d); // paintUnderLine(g2d);
} }
@ -65,7 +65,7 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene
* @param e 事件 * @param e 事件
*/ */
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if (BaseUtils.isAuthorityEditing()) { if (needGrayNewCpt()) {
newWorkBookIconMode = GRAY_NEW_CPT; newWorkBookIconMode = GRAY_NEW_CPT;
} }
} }
@ -76,12 +76,11 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene
*/ */
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
int evtX = e.getX(); int evtX = e.getX();
if (BaseUtils.isAuthorityEditing()) { if (needGrayNewCpt()) {
newWorkBookIconMode = GRAY_NEW_CPT; newWorkBookIconMode = GRAY_NEW_CPT;
} }
if (isOverNewIcon(evtX) && newWorkBookIconMode != GRAY_NEW_CPT) { if (isOverNewIcon(evtX) && newWorkBookIconMode != GRAY_NEW_CPT) {
newWorkBookIconMode = getMousePressNew(); newWorkBookIconMode = getMousePressNew();
newIconStartX = 0;
DesignerContext.getDesignerFrame().addAndActivateJTemplate(); DesignerContext.getDesignerFrame().addAndActivateJTemplate();
} }
this.repaint(); this.repaint();
@ -92,7 +91,7 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene
* @param e 事件 * @param e 事件
*/ */
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
if (BaseUtils.isAuthorityEditing()) { if (needGrayNewCpt()) {
newWorkBookIconMode = GRAY_NEW_CPT; newWorkBookIconMode = GRAY_NEW_CPT;
} }
} }
@ -102,7 +101,7 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene
* @param e 事件 * @param e 事件
*/ */
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
if (BaseUtils.isAuthorityEditing()) { if (needGrayNewCpt()) {
newWorkBookIconMode = GRAY_NEW_CPT; newWorkBookIconMode = GRAY_NEW_CPT;
} }
} }
@ -112,8 +111,7 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene
* @param e 事件 * @param e 事件
*/ */
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
newIconStartX = PRE_GAP; if (needGrayNewCpt()) {
if (BaseUtils.isAuthorityEditing()) {
newWorkBookIconMode = GRAY_NEW_CPT; newWorkBookIconMode = GRAY_NEW_CPT;
} else { } else {
newWorkBookIconMode = getNew(); newWorkBookIconMode = getNew();
@ -135,10 +133,9 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene
*/ */
public void mouseMoved(MouseEvent e) { public void mouseMoved(MouseEvent e) {
int evtX = e.getX(); int evtX = e.getX();
if (BaseUtils.isAuthorityEditing()) { if (needGrayNewCpt()) {
newWorkBookIconMode = GRAY_NEW_CPT; newWorkBookIconMode = GRAY_NEW_CPT;
} else if (isOverNewIcon(evtX)) { } else if (isOverNewIcon(evtX)) {
newIconStartX = 0;
newWorkBookIconMode = getMouseOverNew(); newWorkBookIconMode = getMouseOverNew();
} }
@ -146,9 +143,13 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene
} }
private boolean needGrayNewCpt() {
return DesignerMode.isAuthorityEditing() || DesignerMode.isVcsMode();
}
private boolean isOverNewIcon(int evtX) { private boolean isOverNewIcon(int evtX) {
return (evtX >= PRE_GAP && evtX <= PRE_GAP + newWorkBookIconMode.getIconWidth()); return (evtX >= ICON_START_X && evtX <= ICON_START_X + newWorkBookIconMode.getIconWidth());
} }
public void setButtonGray(boolean isGray) { public void setButtonGray(boolean isGray) {

3
designer-base/src/main/java/com/fr/design/formula/FormulaPane.java

@ -20,6 +20,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.parser.FRLexer; import com.fr.parser.FRLexer;
import com.fr.parser.FRParser; import com.fr.parser.FRParser;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
@ -774,7 +775,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
desBuf = getText((TextUserObject) selectedValue, path); desBuf = getText((TextUserObject) selectedValue, path);
} }
} catch (IOException exp) { } catch (IOException exp) {
FRContext.getLogger().error(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} }
descriptionTextArea.setText(desBuf.toString()); descriptionTextArea.setText(desBuf.toString());
descriptionTextArea.moveCaretPosition(0); descriptionTextArea.moveCaretPosition(0);

4
designer-base/src/main/java/com/fr/design/formula/FunctionNAD.java

@ -1,6 +1,6 @@
package com.fr.design.formula; package com.fr.design.formula;
import com.fr.base.FRContext; import com.fr.general.GeneralContext;
import com.fr.script.CalculatorEmbeddedFunction; import com.fr.script.CalculatorEmbeddedFunction;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.script.Function; import com.fr.stable.script.Function;
@ -24,7 +24,7 @@ public class FunctionNAD extends AbstractNameAndDescription {
if (fn == null) { if (fn == null) {
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
Locale locale = FRContext.getLocale(); Locale locale = GeneralContext.getLocale();
String describtion = fn.getDescription(locale); String describtion = fn.getDescription(locale);
if (describtion.startsWith(CalculatorEmbeddedFunction.LOCALE_PREFIX)) { if (describtion.startsWith(CalculatorEmbeddedFunction.LOCALE_PREFIX)) {
// 老的自定义函数兼容, 没有重写getDescription // 老的自定义函数兼容, 没有重写getDescription

14
designer-base/src/main/java/com/fr/design/fun/TemplateTreeShortCutProvider.java

@ -0,0 +1,14 @@
package com.fr.design.fun;
import com.fr.stable.fun.mark.Aftermath;
import com.fr.stable.fun.mark.Mutable;
/**
* 左上角目录树上边工具条的插件接口
* Created by hzzz on 2017/11/30.
*/
public interface TemplateTreeShortCutProvider extends Mutable, Aftermath {
String XML_TAG = "TemplateTreeShortCut";
int CURRENT_LEVEL = 1;
}

26
designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateTreeShortCutProvider.java

@ -0,0 +1,26 @@
package com.fr.design.fun.impl;
import com.fr.design.actions.UpdateAction;
import com.fr.design.fun.TemplateTreeShortCutProvider;
import com.fr.stable.fun.mark.API;
/**
* 左上角目录树上边工具条的插件接口
* Created by hzzz on 2017/11/30.
*/
@API(level = TemplateTreeShortCutProvider.CURRENT_LEVEL)
public abstract class AbstractTemplateTreeShortCutProvider extends UpdateAction implements TemplateTreeShortCutProvider {
@Override
public String mark4Provider() {
return getClass().getName();
}
@Override
public void process() {
}
@Override
public void undo() {
}
}

7
designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java

@ -13,6 +13,7 @@ import javax.swing.plaf.basic.BasicHTML;
import javax.swing.text.View; import javax.swing.text.View;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.stable.Constants; import com.fr.stable.Constants;
@ -174,7 +175,7 @@ public class UISliderButtonUI extends BasicButtonUI {
private void fillNormal(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) { private void fillNormal(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) {
GradientPaint gp; GradientPaint gp;
if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) {
gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.AUTHORITY_DARK_BLUE); gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.AUTHORITY_DARK_BLUE);
} else if (isPressedPainted) { } else if (isPressedPainted) {
gp = new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, height - 1, UIConstants.SELECT_TAB); gp = new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, height - 1, UIConstants.SELECT_TAB);
@ -187,7 +188,7 @@ public class UISliderButtonUI extends BasicButtonUI {
private void fillRollOver(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) { private void fillRollOver(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) {
GradientPaint gp; GradientPaint gp;
if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) {
gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.HOVER_BLUE); gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.HOVER_BLUE);
} else if (isPressedPainted) { } else if (isPressedPainted) {
gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1, UIConstants.POP_DIALOG_BORDER); gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1, UIConstants.POP_DIALOG_BORDER);
@ -199,7 +200,7 @@ public class UISliderButtonUI extends BasicButtonUI {
private void fillPressed(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited) { private void fillPressed(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited) {
Color oldColor = g2d.getColor(); Color oldColor = g2d.getColor();
if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) {
g2d.setColor(UIConstants.AUTHORITY_PRESS_BLUE); g2d.setColor(UIConstants.AUTHORITY_PRESS_BLUE);
} else { } else {
g2d.setColor(UIConstants.POP_DIALOG_BORDER); g2d.setColor(UIConstants.POP_DIALOG_BORDER);

3
designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java

@ -1,6 +1,7 @@
package com.fr.design.gui.icontainer; package com.fr.design.gui.icontainer;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -281,7 +282,7 @@ public class UIEastResizableContainer extends JPanel {
} }
onResize(); onResize();
refreshContainer(); refreshContainer();
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
DesignerContext.getDesignerFrame().doResize(); DesignerContext.getDesignerFrame().doResize();
} }
} }

9
designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java

@ -1,6 +1,7 @@
package com.fr.design.gui.icontainer; package com.fr.design.gui.icontainer;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -72,7 +73,7 @@ public class UIModeControlContainer extends JLayeredPane {
public void needToShowCoverAndHidPane() { public void needToShowCoverAndHidPane() {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
this.remove(coverPane); this.remove(coverPane);
this.remove(hidePane); this.remove(hidePane);
} else { } else {
@ -115,7 +116,7 @@ public class UIModeControlContainer extends JLayeredPane {
if (isHideMode || !upEditMode) { if (isHideMode || !upEditMode) {
return; return;
} }
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
return; return;
} }
setCursor(Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR)); setCursor(Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR));
@ -142,7 +143,7 @@ public class UIModeControlContainer extends JLayeredPane {
@Override @Override
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
return; return;
} }
boolean notUpEditMode = isHideMode || !upEditMode; boolean notUpEditMode = isHideMode || !upEditMode;
@ -183,7 +184,7 @@ public class UIModeControlContainer extends JLayeredPane {
setUpPaneHeight(0); setUpPaneHeight(0);
} }
if (BaseUtils.isAuthorityEditing() && isSheeetCovered) { if (DesignerMode.isAuthorityEditing() && isSheeetCovered) {
sheetInvisibleCoverPane.setBounds(0, toolPaneY + toolPaneHeight + UIConstants.SIZE, getWidth(), getHeight() - toolPaneY - toolPaneHeight - sheetCorverGap); sheetInvisibleCoverPane.setBounds(0, toolPaneY + toolPaneHeight + UIConstants.SIZE, getWidth(), getHeight() - toolPaneY - toolPaneHeight - sheetCorverGap);
UIModeControlContainer.this.add(sheetInvisibleCoverPane); UIModeControlContainer.this.add(sheetInvisibleCoverPane);
UIModeControlContainer.this.setLayer(sheetInvisibleCoverPane, 2); UIModeControlContainer.this.setLayer(sheetInvisibleCoverPane, 2);

5
designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java

@ -1,6 +1,7 @@
package com.fr.design.gui.icontainer; package com.fr.design.gui.icontainer;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.stable.Constants; import com.fr.stable.Constants;
@ -443,7 +444,7 @@ public class UIResizableContainer extends JPanel {
containerWidth = toolPaneHeight; containerWidth = toolPaneHeight;
} }
refreshContainer(); refreshContainer();
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
DesignerContext.getDesignerFrame().doResize(); DesignerContext.getDesignerFrame().doResize();
} }
@ -476,7 +477,7 @@ public class UIResizableContainer extends JPanel {
containerWidth = toolPaneHeight; containerWidth = toolPaneHeight;
} }
refreshContainer(); refreshContainer();
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
DesignerContext.getDesignerFrame().doResize(); DesignerContext.getDesignerFrame().doResize();
} }
} }

7
designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java

@ -179,6 +179,7 @@ public class TemplateFileTree extends EnvFileTree {
@Override @Override
protected ExpandMutableTreeNode[] loadChildTreeNodes(ExpandMutableTreeNode treeNode) { protected ExpandMutableTreeNode[] loadChildTreeNodes(ExpandMutableTreeNode treeNode) {
FileNode[] fnArray = listFileNodes(treeNode); FileNode[] fnArray = listFileNodes(treeNode);
return fileNodeArray2TreeNodeArray(fnArray); return fileNodeArray2TreeNodeArray(fnArray);
@ -189,13 +190,14 @@ public class TemplateFileTree extends EnvFileTree {
*/ */
private ExpandMutableTreeNode[] fileNodeArray2TreeNodeArray(FileNode[] fileNodes) { private ExpandMutableTreeNode[] fileNodeArray2TreeNodeArray(FileNode[] fileNodes) {
boolean isLocal = WorkContext.getCurrent().isLocal(); boolean isLocal = WorkContext.getCurrent().isLocal();
boolean isRoot = WorkContext.getCurrent().isRoot();
ExpandMutableTreeNode[] res = new ExpandMutableTreeNode[fileNodes.length]; ExpandMutableTreeNode[] res = new ExpandMutableTreeNode[fileNodes.length];
for (int i = 0; i < res.length; i++) { for (int i = 0; i < res.length; i++) {
FileNode fn = fileNodes[i]; FileNode fn = fileNodes[i];
res[i] = new ExpandMutableTreeNode(fn); res[i] = new ExpandMutableTreeNode(fn);
if (fn.isDirectory()) { if (fn.isDirectory()) {
res[i].add(new ExpandMutableTreeNode()); res[i].add(new ExpandMutableTreeNode());
if (isLocal || WorkContext.getCurrent().isRoot()) { if (isLocal || isRoot) {
res[i].setFullAuthority(true); res[i].setFullAuthority(true);
} else { } else {
boolean hasFullAuthority = isContained(fn); boolean hasFullAuthority = isContained(fn);
@ -203,7 +205,6 @@ public class TemplateFileTree extends EnvFileTree {
} }
} }
} }
return res; return res;
} }
@ -269,6 +270,7 @@ public class TemplateFileTree extends EnvFileTree {
* 求当前TreeNode下所有的FileNode. * 求当前TreeNode下所有的FileNode.
*/ */
private FileNode[] listFileNodes(ExpandMutableTreeNode currentTreeNode) { private FileNode[] listFileNodes(ExpandMutableTreeNode currentTreeNode) {
if (currentTreeNode == null) { if (currentTreeNode == null) {
return new FileNode[0]; return new FileNode[0];
} }
@ -276,6 +278,7 @@ public class TemplateFileTree extends EnvFileTree {
Object object = currentTreeNode.getUserObject(); Object object = currentTreeNode.getUserObject();
if (object instanceof FileNode) { if (object instanceof FileNode) {
return this.listFileNodes(((FileNode) object).getEnvPath()); return this.listFileNodes(((FileNode) object).getEnvPath());
} }

30
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -4,6 +4,7 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
@ -22,6 +23,7 @@ import com.fr.design.file.NewTemplatePane;
import com.fr.design.file.SaveSomeTemplatePane; import com.fr.design.file.SaveSomeTemplatePane;
import com.fr.design.file.TemplateTreePane; import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.TitlePlaceProcessor; import com.fr.design.fun.TitlePlaceProcessor;
import com.fr.design.fun.impl.AbstractTemplateTreeShortCutProvider;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenuHighLight; import com.fr.design.gui.imenu.UIMenuHighLight;
import com.fr.design.gui.iprogressbar.ProgressDialog; import com.fr.design.gui.iprogressbar.ProgressDialog;
@ -32,6 +34,7 @@ import com.fr.design.mainframe.loghandler.LogMessageBar;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.MenuManager; import com.fr.design.menu.MenuManager;
import com.fr.design.menu.ShortCut;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.FILE; import com.fr.file.FILE;
@ -97,6 +100,7 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Set;
public class DesignerFrame extends JFrame implements JTemplateActionListener, TargetModifiedListener { public class DesignerFrame extends JFrame implements JTemplateActionListener, TargetModifiedListener {
@ -218,9 +222,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} }
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
if (DesignerMode.isAuthorityEditing()) {
if (BaseUtils.isAuthorityEditing()) { DesignerMode.setMode(DesignerMode.NORMARL);
BaseUtils.setAuthorityEditing(false);
WestRegionContainerPane.getInstance().replaceDownPane( WestRegionContainerPane.getInstance().replaceDownPane(
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane();
@ -303,7 +306,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
public void componentResized(ComponentEvent e) { public void componentResized(ComponentEvent e) {
reCalculateFrameSize(); reCalculateFrameSize();
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
doResize(); doResize();
} }
} }
@ -526,7 +529,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
*/ */
public void refreshDottedLine() { public void refreshDottedLine() {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
populateAuthorityArea(); populateAuthorityArea();
populateCloseButton(); populateCloseButton();
addDottedLine(); addDottedLine();
@ -589,7 +592,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
for (int i = 0; i < fixButtons.length; i++) { for (int i = 0; i < fixButtons.length; i++) {
combineUp.add(fixButtons[i]); combineUp.add(fixButtons[i]);
} }
if (!BaseUtils.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
combineUp.addSeparator(new Dimension(2, 16)); combineUp.addSeparator(new Dimension(2, 16));
if (toolbar4Form != null) { if (toolbar4Form != null) {
for (int i = 0; i < toolbar4Form.length; i++) { for (int i = 0; i < toolbar4Form.length; i++) {
@ -706,7 +709,15 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
*/ */
public void needToAddAuhtorityPaint() { public void needToAddAuhtorityPaint() {
newWorkBookPane.setButtonGray(BaseUtils.isAuthorityEditing()); newWorkBookPane.setButtonGray(DesignerMode.isAuthorityEditing());
// 进入或退出权限编辑模式,通知插件
Set<ShortCut> extraShortCuts = ExtraDesignClassManager.getInstance().getExtraShortCuts();
for (ShortCut shortCut : extraShortCuts) {
if (shortCut instanceof AbstractTemplateTreeShortCutProvider) {
((AbstractTemplateTreeShortCutProvider) shortCut).notifyFromAuhtorityChange(DesignerMode.isAuthorityEditing());
}
}
} }
/** /**
@ -797,6 +808,11 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
TemplateTreePane.getInstance().refreshDockingView(); TemplateTreePane.getInstance().refreshDockingView();
DesignTableDataManager.clearGlobalDs(); DesignTableDataManager.clearGlobalDs();
EastRegionContainerPane.getInstance().refreshDownPane(); EastRegionContainerPane.getInstance().refreshDownPane();
JTemplate template = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (template != null) {
template.refreshToolArea();
}
} }
/** /**

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

@ -2,6 +2,7 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
@ -31,21 +32,30 @@ import com.fr.file.FILE;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.io.utils.ResourceIOUtils; import com.fr.io.utils.ResourceIOUtils;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -60,6 +70,8 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
private JPanel cardPane; private JPanel cardPane;
private java.util.List<FileToolbarStateChangeListener> otherToobarStateChangeListeners = new ArrayList<>();
private FileOperations selectedOperation; private FileOperations selectedOperation;
private UIToolbar toolBar; private UIToolbar toolBar;
@ -130,7 +142,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
HistoryTemplateListPane.getInstance().setCurrentEditingTemplate(jt); HistoryTemplateListPane.getInstance().setCurrentEditingTemplate(jt);
//处理自动新建的模板 //处理自动新建的模板
MutilTempalteTabPane.getInstance().doWithtemTemplate(); MutilTempalteTabPane.getInstance().doWithtemTemplate();
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
RolesAlreadyEditedPane.getInstance().refreshDockingView(); RolesAlreadyEditedPane.getInstance().refreshDockingView();
} }
@ -244,6 +256,21 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
selectedOperation.refresh(); selectedOperation.refresh();
stateChange(); stateChange();
}
}
public void addToobarStateChangeListener(FileToolbarStateChangeListener toobarStateChangeListener) {
this.otherToobarStateChangeListeners.add(toobarStateChangeListener);
}
public void removeToobarStateChangeListener(FileToolbarStateChangeListener toobarStateChangeListener) {
this.otherToobarStateChangeListeners.remove(toobarStateChangeListener);
}
private void otherStateChange() {
for (FileToolbarStateChangeListener toobarStateChangeListener : otherToobarStateChangeListeners) {
toobarStateChangeListener.stateChange();
} }
} }
@ -313,6 +340,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
delFileAction.setEnabled(true); delFileAction.setEnabled(true);
} }
otherStateChange();
} }
/** /**
@ -578,4 +606,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
return null; return null;
} }
public FileOperations getSelectedOperation() {
return selectedOperation;
}
} }

20
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -6,6 +6,7 @@ import com.fr.base.Parameter;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.io.BaseBook; import com.fr.base.io.BaseBook;
import com.fr.base.iofile.attr.TemplateIdAttrMark; import com.fr.base.iofile.attr.TemplateIdAttrMark;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
@ -32,6 +33,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; import com.fr.design.mainframe.templateinfo.TemplateInfoCollector;
import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; import com.fr.design.mainframe.templateinfo.TemplateProcessInfo;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.mainframe.toolbar.VcsScene;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.NameSeparator; import com.fr.design.menu.NameSeparator;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
@ -274,7 +276,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
* @return 是则返回true * @return 是则返回true
*/ */
public boolean isSaved() { public boolean isSaved() {
return BaseUtils.isAuthorityEditing() ? this.authoritySaved : this.saved; return DesignerMode.isAuthorityEditing() ? this.authoritySaved : this.saved;
} }
/** /**
@ -297,7 +299,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} }
public void setSaved(boolean isSaved) { public void setSaved(boolean isSaved) {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
authoritySaved = isSaved; authoritySaved = isSaved;
} else { } else {
saved = isSaved; saved = isSaved;
@ -308,7 +310,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
* @return * @return
*/ */
public UndoManager getUndoManager() { public UndoManager getUndoManager() {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
if (this.authorityUndoManager == null) { if (this.authorityUndoManager == null) {
this.authorityUndoManager = new UndoManager(); this.authorityUndoManager = new UndoManager();
int limit = DesignerEnvManager.getEnvManager().getUndoLimit(); int limit = DesignerEnvManager.getEnvManager().getUndoLimit();
@ -383,7 +385,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
return; return;
} }
//如果是在不同的模式下产生的 //如果是在不同的模式下产生的
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
this.getUndoManager().addEdit(new UndoStateEdit(authorityUndoState, newState)); this.getUndoManager().addEdit(new UndoStateEdit(authorityUndoState, newState));
authorityUndoState = newState; authorityUndoState = newState;
} else { } else {
@ -412,7 +414,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} }
private void fireSuperTargetModified() { private void fireSuperTargetModified() {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
this.authoritySaved = false; this.authoritySaved = false;
} else { } else {
this.saved = false; this.saved = false;
@ -699,7 +701,9 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
*/ */
@Override @Override
public ShortCut[] shortcut4FileMenu() { public ShortCut[] shortcut4FileMenu() {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isVcsMode()) {
return VcsScene.shortcut4FileMenu(this);
} else if (DesignerMode.isAuthorityEditing()) {
return new ShortCut[]{new SaveTemplateAction(this), new UndoAction(this), new RedoAction(this)}; return new ShortCut[]{new SaveTemplateAction(this), new UndoAction(this), new RedoAction(this)};
} else { } else {
return new ShortCut[]{new SaveTemplateAction(this), new SaveAsTemplateAction(this), new UndoAction(this), new RedoAction(this)}; return new ShortCut[]{new SaveTemplateAction(this), new SaveAsTemplateAction(this), new UndoAction(this), new RedoAction(this)};
@ -716,12 +720,14 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public MenuDef[] menus4Target() { public MenuDef[] menus4Target() {
MenuDef tplMenu = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_M-Template"), 'T'); MenuDef tplMenu = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_M-Template"), 'T');
tplMenu.setAnchor(MenuHandler.TEMPLATE); tplMenu.setAnchor(MenuHandler.TEMPLATE);
if (!BaseUtils.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
tplMenu.addShortCut(new NameSeparator(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_WorkBook"))); tplMenu.addShortCut(new NameSeparator(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_WorkBook")));
tplMenu.addShortCut(new TableDataSourceAction(this)); tplMenu.addShortCut(new TableDataSourceAction(this));
tplMenu.addShortCut(shortcut4TemplateMenu()); tplMenu.addShortCut(shortcut4TemplateMenu());
} }
if (!DesignerMode.isVcsMode()) {
tplMenu.addShortCut(shortCuts4Authority()); tplMenu.addShortCut(shortCuts4Authority());
}
return new MenuDef[]{tplMenu}; return new MenuDef[]{tplMenu};
} }

20
designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java

@ -13,17 +13,30 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.env.EnvListPane; import com.fr.env.EnvListPane;
import com.fr.event.EventDispatcher;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.WorkContextCallback; import com.fr.workspace.WorkContextCallback;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent;
import com.fr.workspace.connect.AuthException; import com.fr.workspace.connect.AuthException;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.Icon;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
@ -132,7 +145,6 @@ public class TemplatePane extends JPanel implements MouseListener {
final String selectedName = envListPane.updateEnvManager(); final String selectedName = envListPane.updateEnvManager();
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(selectedName); DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(selectedName);
GeneralContext.fireEnvWillChangeListener();
try { try {
Workspace workspace = DesignerWorkspaceGenerator.generate(selectedEnv); Workspace workspace = DesignerWorkspaceGenerator.generate(selectedEnv);
if (workspace == null) { if (workspace == null) {

36
designer-base/src/main/java/com/fr/design/mainframe/ToolBarNewTemplatePane.java

@ -0,0 +1,36 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.design.file.NewTemplatePane;
import javax.swing.Icon;
/**
* Created by hzzz on 2017/12/26.
*/
public class ToolBarNewTemplatePane extends NewTemplatePane {
private static final ToolBarNewTemplatePane instance = new ToolBarNewTemplatePane();
private ToolBarNewTemplatePane() {
}
public static NewTemplatePane getInstance() {
return instance;
}
@Override
public Icon getNew() {
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/addicon.png");
}
@Override
public Icon getMouseOverNew() {
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png");
}
@Override
public Icon getMousePressNew() {
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png");
}
}

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

@ -2,6 +2,7 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
@ -52,7 +53,7 @@ public class UndoStateEdit extends AbstractUndoableEdit {
if (this.old != null) { if (this.old != null) {
this.old.applyState(); this.old.applyState();
} }
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
RolesAlreadyEditedPane.getInstance().refreshDockingView(); RolesAlreadyEditedPane.getInstance().refreshDockingView();
} }
} }
@ -67,7 +68,7 @@ public class UndoStateEdit extends AbstractUndoableEdit {
if (this.cur != null) { if (this.cur != null) {
this.cur.applyState(); this.cur.applyState();
} }
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
RolesAlreadyEditedPane.getInstance().refreshDockingView(); RolesAlreadyEditedPane.getInstance().refreshDockingView();
} }
} }

54
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -5,6 +5,7 @@ package com.fr.design.mainframe.toolbar;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
@ -42,6 +43,7 @@ import com.fr.design.gui.imenu.UIMenuBar;
import com.fr.design.gui.itoolbar.UILargeToolbar; import com.fr.design.gui.itoolbar.UILargeToolbar;
import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.ToolBarNewTemplatePane;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
@ -50,7 +52,6 @@ import com.fr.design.remote.action.RemoteDesignAuthorityManagerAction;
import com.fr.design.utils.ThemeUtils; import com.fr.design.utils.ThemeUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime; import com.fr.plugin.context.PluginRuntime;
import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.manage.PluginFilter;
@ -61,8 +62,17 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.*; import javax.swing.JComponent;
import java.awt.*; import javax.swing.JMenuBar;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -224,7 +234,7 @@ public abstract class ToolBarMenuDock {
// 添加帮助菜单 // 添加帮助菜单
menuList.add(createHelpMenuDef()); menuList.add(createHelpMenuDef());
if (FRContext.getLocale() == Locale.CHINA || FRContext.getLocale() == Locale.TAIWAN) { if (GeneralContext.getLocale() == Locale.CHINA || GeneralContext.getLocale() == Locale.TAIWAN) {
// 添加社区菜单 // 添加社区菜单
addCommunityMenuDef(menuList); addCommunityMenuDef(menuList);
} }
@ -272,7 +282,7 @@ public abstract class ToolBarMenuDock {
} }
public void addCommunityMenuDef(java.util.List<MenuDef> menuList) { public void addCommunityMenuDef(java.util.List<MenuDef> menuList) {
Locale locale = FRContext.getLocale(); Locale locale = GeneralContext.getLocale();
Locale[] locales = supportCommunityLocales(); Locale[] locales = supportCommunityLocales();
for (int i = 0; i < locales.length; i++) { for (int i = 0; i < locales.length; i++) {
if (locale.equals(locales[i])) { if (locale.equals(locales[i])) {
@ -320,10 +330,15 @@ public abstract class ToolBarMenuDock {
} }
public MenuDef createFileMenuDef(ToolBarMenuDockPlus plus) { public MenuDef createFileMenuDef(ToolBarMenuDockPlus plus) {
if (DesignerMode.isVcsMode()) {
MenuDef menuDef = VcsScene.createFileMenuDef(plus);
insertMenu(menuDef, MenuHandler.FILE);
return menuDef;
}
MenuDef menuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_File"), 'F'); MenuDef menuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_File"), 'F');
ShortCut[] scs = new ShortCut[0]; ShortCut[] scs = new ShortCut[0];
if (!BaseUtils.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
scs = createNewFileShortCuts(); scs = createNewFileShortCuts();
} }
if (!ArrayUtils.isEmpty(scs)) { if (!ArrayUtils.isEmpty(scs)) {
@ -354,13 +369,13 @@ public abstract class ToolBarMenuDock {
} }
protected void addCloseCurrentTemplateAction(MenuDef menuDef) { protected void addCloseCurrentTemplateAction(MenuDef menuDef) {
if (!BaseUtils.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
menuDef.addShortCut(new CloseCurrentTemplateAction()); menuDef.addShortCut(new CloseCurrentTemplateAction());
} }
} }
protected void addPreferenceAction(MenuDef menuDef) { protected void addPreferenceAction(MenuDef menuDef) {
if (!BaseUtils.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
menuDef.addShortCut(new PreferenceAction()); menuDef.addShortCut(new PreferenceAction());
} }
} }
@ -396,7 +411,7 @@ public abstract class ToolBarMenuDock {
protected MenuDef createServerMenuDef(ToolBarMenuDockPlus plus) { protected MenuDef createServerMenuDef(ToolBarMenuDockPlus plus) {
MenuDef menuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_M-Server"), 'S'); MenuDef menuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_M-Server"), 'S');
if (!BaseUtils.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
menuDef.addShortCut( menuDef.addShortCut(
new ConnectionListAction(), new ConnectionListAction(),
createGlobalTDAction() createGlobalTDAction()
@ -412,7 +427,7 @@ public abstract class ToolBarMenuDock {
menuDef.addShortCut(new RemoteDesignAuthorityManagerAction()); menuDef.addShortCut(new RemoteDesignAuthorityManagerAction());
} }
if (!BaseUtils.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
if (shouldShowPlugin()) { if (shouldShowPlugin()) {
menuDef.addShortCut( menuDef.addShortCut(
new PluginManagerAction() new PluginManagerAction()
@ -451,7 +466,7 @@ public abstract class ToolBarMenuDock {
java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>(); java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>();
shortCuts.add(new WebDemoAction()); shortCuts.add(new WebDemoAction());
// 英文,把 video 和帮助文档放到 Help 下面 // 英文,把 video 和帮助文档放到 Help 下面
if (FRContext.getLocale().equals(Locale.US)) { if (GeneralContext.getLocale().equals(Locale.US)) {
shortCuts.add(new VideoAction()); shortCuts.add(new VideoAction());
shortCuts.add(new TutorialAction()); shortCuts.add(new TutorialAction());
} }
@ -588,22 +603,7 @@ public abstract class ToolBarMenuDock {
} }
public NewTemplatePane getNewTemplatePane() { public NewTemplatePane getNewTemplatePane() {
return new NewTemplatePane() { return ToolBarNewTemplatePane.getInstance();
@Override
public Icon getNew() {
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/addicon.png");
}
@Override
public Icon getMouseOverNew() {
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png");
}
@Override
public Icon getMousePressNew() {
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png");
}
};
} }
protected void insertMenu(MenuDef menuDef, String anchor) { protected void insertMenu(MenuDef menuDef, String anchor) {

46
designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsScene.java

@ -0,0 +1,46 @@
package com.fr.design.mainframe.toolbar;
import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.actions.edit.RedoAction;
import com.fr.design.actions.edit.UndoAction;
import com.fr.design.actions.file.ExitDesignerAction;
import com.fr.design.actions.file.PreferenceAction;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ShortCut;
import com.fr.stable.ArrayUtils;
/**
* Created by hzzz on 2017/12/28.
*/
public class VcsScene {
public static MenuDef createFileMenuDef(ToolBarMenuDockPlus plus) {
MenuDef menuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_File"), 'F');
ShortCut[] scs = new ShortCut[0];
if (!ArrayUtils.isEmpty(scs)) {
menuDef.addShortCut(scs);
}
scs = plus.shortcut4FileMenu();
if (!ArrayUtils.isEmpty(scs)) {
menuDef.addShortCut(SeparatorDef.DEFAULT);
menuDef.addShortCut(scs);
menuDef.addShortCut(SeparatorDef.DEFAULT);
}
if (!DesignerMode.isAuthorityEditing()) {
menuDef.addShortCut(new PreferenceAction());
}
menuDef.addShortCut(new ExitDesignerAction());
return menuDef;
}
public static ShortCut[] shortcut4FileMenu(JTemplate jTemplate) {
return new ShortCut[]{new UndoAction(jTemplate), new RedoAction(jTemplate)};
}
}

7
designer-base/src/main/java/com/fr/design/menu/ShortCut.java

@ -71,4 +71,11 @@ public abstract class ShortCut extends AbstractProvider implements Mutable {
public void setMenuKeySet(MenuKeySet menuKeySet) { public void setMenuKeySet(MenuKeySet menuKeySet) {
this.menuKeySet = menuKeySet; this.menuKeySet = menuKeySet;
} }
/**
* 权限编辑模式变更时候会调用这个方法
* @param isAuhtority
*/
public void notifyFromAuhtorityChange(boolean isAuhtority) {
}
} }

3
designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java

@ -1,6 +1,7 @@
package com.fr.design.roleAuthority; package com.fr.design.roleAuthority;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
@ -265,7 +266,7 @@ public class ReportAndFSManagePane extends DockingView implements Prepare4DataSo
DesignTableDataManager.addDsChangeListener(new ChangeListener() { DesignTableDataManager.addDsChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
roleTree.refreshTreeNode(); roleTree.refreshTreeNode();
expandTree(roleTree, true); expandTree(roleTree, true);
roleTree.updateUI(); roleTree.updateUI();

2
designer-base/src/main/java/com/fr/design/utils/DesignUtils.java

@ -226,7 +226,7 @@ public class DesignUtils {
} }
//先初始化的设计器locale, 后初始化lookandfeel.如果顺序改了, 这边也要调整. //先初始化的设计器locale, 后初始化lookandfeel.如果顺序改了, 这边也要调整.
Locale designerLocale = FRContext.getLocale(); Locale designerLocale = GeneralContext.getLocale();
String file = com.fr.design.i18n.Toolkit.i18nText("FR-Designer_File"); String file = com.fr.design.i18n.Toolkit.i18nText("FR-Designer_File");
char displayChar = file.charAt(0); char displayChar = file.charAt(0);
if (!guiFRFont.canDisplay(displayChar)) { if (!guiFRFont.canDisplay(displayChar)) {

9
designer-base/src/main/java/com/fr/design/utils/gui/GUIPaintUtils.java

@ -1,6 +1,7 @@
package com.fr.design.utils.gui; package com.fr.design.utils.gui;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.stable.Constants; import com.fr.stable.Constants;
@ -17,7 +18,7 @@ public class GUIPaintUtils {
public static final void drawBorder(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited) { public static final void drawBorder(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited) {
Color oldColor = g2d.getColor(); Color oldColor = g2d.getColor();
Shape oldClip = g2d.getClip(); Shape oldClip = g2d.getClip();
if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) {
g2d.setColor(UIConstants.AUTHORITY_LINE_COLOR); g2d.setColor(UIConstants.AUTHORITY_LINE_COLOR);
} else { } else {
g2d.setColor(UIConstants.POP_DIALOG_BORDER); g2d.setColor(UIConstants.POP_DIALOG_BORDER);
@ -67,7 +68,7 @@ public class GUIPaintUtils {
public static final void fillNormal(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted, Color color) { public static final void fillNormal(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted, Color color) {
GradientPaint gp; GradientPaint gp;
if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) {
gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.AUTHORITY_DARK_BLUE); gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.AUTHORITY_DARK_BLUE);
} else if (isPressedPainted) { } else if (isPressedPainted) {
gp = new GradientPaint(1, 1, color, 1, height - 1, color); gp = new GradientPaint(1, 1, color, 1, height - 1, color);
@ -99,7 +100,7 @@ public class GUIPaintUtils {
GradientPaint gp; GradientPaint gp;
if (hoverColor != null) { if (hoverColor != null) {
gp = new GradientPaint(1, 1, hoverColor, 1, height - 1, hoverColor); gp = new GradientPaint(1, 1, hoverColor, 1, height - 1, hoverColor);
} else if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { } else if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) {
gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.HOVER_BLUE); gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.HOVER_BLUE);
} else if (isPressedPainted) { } else if (isPressedPainted) {
gp = new GradientPaint(1, 1, UIConstants.ATTRIBUTE_HOVER, 1, height - 1, UIConstants.ATTRIBUTE_HOVER); gp = new GradientPaint(1, 1, UIConstants.ATTRIBUTE_HOVER, 1, height - 1, UIConstants.ATTRIBUTE_HOVER);
@ -129,7 +130,7 @@ public class GUIPaintUtils {
Color oldColor = g2d.getColor(); Color oldColor = g2d.getColor();
if (pressedColor != null) { if (pressedColor != null) {
g2d.setColor(pressedColor); g2d.setColor(pressedColor);
} else if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { } else if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) {
g2d.setColor(UIConstants.AUTHORITY_PRESS_BLUE); g2d.setColor(UIConstants.AUTHORITY_PRESS_BLUE);
} else { } else {
g2d.setColor(UIConstants.ATTRIBUTE_PRESS); g2d.setColor(UIConstants.ATTRIBUTE_PRESS);

23
designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java

@ -1,33 +1,20 @@
package com.fr.design; package com.fr.design;
import com.fr.locale.InterProviderFactory;
import junit.framework.TestCase; import junit.framework.TestCase;
import java.util.HashSet;
import java.util.Locale; import java.util.Locale;
public class DesignerEnvManagerTest extends TestCase{ public class DesignerEnvManagerTest extends TestCase{
public void testGetLocale() { public void testGetLocale() {
DesignerEnvManager envManager = new DesignerEnvManager(); DesignerEnvManager envManager = new DesignerEnvManager();
assertEquals("默认值", envManager.getLocale(), Locale.CHINA); assertEquals("默认值", envManager.getLanguage(), Locale.SIMPLIFIED_CHINESE);
HashSet<Locale> result = new HashSet<>(); envManager.setLanguage(Locale.US);
Locale[] locales = envManager.supportLocale(); assertEquals("上边界", envManager.getLanguage(), Locale.US);
int len = locales.length;
assertEquals(len, InterProviderFactory.getProvider().getSupportLocaleMap().size());
for (int i = 0; i < len; i++) {
envManager.setLanguage(i + 1);
Locale locale = envManager.getLocale();
result.add(locale);
}
assertEquals("每个int都有对应的locale", result.size(), len);
envManager.setLanguage(998);
assertEquals("上边界", envManager.getLocale(), Locale.CHINA);
envManager.setLanguage(-998); envManager.setLanguage(Locale.SIMPLIFIED_CHINESE);
assertEquals("下边界", envManager.getLocale(), Locale.CHINA); assertEquals("下边界", envManager.getLanguage(), Locale.SIMPLIFIED_CHINESE);
} }
} }

11
designer-base/src/test/java/com/fr/design/actions/help/TutorialActionTest.java

@ -13,20 +13,17 @@ public class TutorialActionTest extends TestCase{
TutorialAction action = new TutorialAction(); TutorialAction action = new TutorialAction();
GeneralContext.setLocale(Locale.US); GeneralContext.setLocale(Locale.US);
String enKey = action.createDocKey(); String enKey = action.createDocKey();
assertTrue(enKey.indexOf(Locale.US.toString()) != -1); assertTrue(enKey.contains(Locale.US.toString()));
assertTrue(enKey.indexOf(ProductConstants.MAIN_VERSION) != -1); assertTrue(enKey.contains(ProductConstants.MAIN_VERSION));
GeneralContext.setLocale(Locale.CHINA); GeneralContext.setLocale(Locale.CHINA);
String zhKey = action.createDocKey(); String zhKey = action.createDocKey();
assertTrue(zhKey.indexOf(Locale.CHINA.toString()) != -1); assertTrue(zhKey.contains(Locale.CHINA.toString()));
Locale pt = new Locale("pt", "PT"); Locale pt = new Locale("pt", "PT");
GeneralContext.setLocale(pt); GeneralContext.setLocale(pt);
String ptKey = action.createDocKey(); String ptKey = action.createDocKey();
assertTrue(ptKey.indexOf(pt.toString()) != -1); assertTrue(ptKey.contains(pt.toString()));
GeneralContext.setLanguage(998);
assertTrue(action.createDocKey().indexOf(Locale.CHINA.toString()) != -1);
} }
public void testServerOnline() { public void testServerOnline() {

9
designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java

@ -136,15 +136,6 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
allCharts[i] = rowChart; allCharts[i] = rowChart;
} }
//异步加载图片
// new Thread(new Runnable() {
//
// @Override
// public void run() {
// initAllChartsDemoImage(allCharts);
// }
// }).start();
return child; return child;
} }

1
designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java

@ -3,6 +3,7 @@
*/ */
package com.fr.design.designer.creator; package com.fr.design.designer.creator;
import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;

1
designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;

5
designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java

@ -5,6 +5,7 @@ import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.base.iofile.attr.WatermarkAttr; import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.ComponentAdapter;
@ -84,7 +85,7 @@ public class FormDesignerUI extends ComponentUI {
paintSelection(g); paintSelection(g);
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
paintAuthorityDetails(g, designer.getRootComponent()); paintAuthorityDetails(g, designer.getRootComponent());
} }
@ -115,7 +116,7 @@ public class FormDesignerUI extends ComponentUI {
private void paintWatermark(Graphics2D g) { private void paintWatermark(Graphics2D g) {
WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(designer.getTarget()); WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(designer.getTarget());
WatermarkPainter painter = WatermarkPainter.createPainter(watermark, designer.getResolution()); WatermarkPainter painter = WatermarkPainter.createPainter(watermark, designer.getResolution());
painter.paint(g, 0, designer.getParaHeight(), designer.getArea().getBounds()); painter.paint(g, 0, 0, designer.getArea().getBounds());
} }
private int[] getActualLine(int i) { private int[] getActualLine(int i) {

3
designer-form/src/main/java/com/fr/design/mainframe/FormToolBarButton.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.core.WidgetOption;
@ -102,7 +103,7 @@ public class FormToolBarButton extends JButton implements MouseListener {
//该button只在报表块工具栏中使用, //该button只在报表块工具栏中使用,
//parent只有FormToolBarPane一种,故可以直接强转 //parent只有FormToolBarPane一种,故可以直接强转
final FormToolBarPane toolBarPane = (FormToolBarPane) this.getParent(); final FormToolBarPane toolBarPane = (FormToolBarPane) this.getParent();
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
auhtorityMouseAction(); auhtorityMouseAction();
return; return;
} }

14
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.PaperSize; import com.fr.base.PaperSize;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.actions.file.WebPreviewUtils; import com.fr.design.actions.file.WebPreviewUtils;
@ -55,7 +56,6 @@ import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.WLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.page.PaperSettingProvider; import com.fr.page.PaperSettingProvider;
import com.fr.report.worksheet.FormElementCase; import com.fr.report.worksheet.FormElementCase;
@ -204,7 +204,8 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
*/ */
public ShortCut[] shortcut4FileMenu() { public ShortCut[] shortcut4FileMenu() {
return (ShortCut[]) ArrayUtils.addAll( return (ShortCut[]) ArrayUtils.addAll(
super.shortcut4FileMenu(), new ShortCut[]{this.createWorkBookExportMenu()} super.shortcut4FileMenu(),
DesignerMode.isVcsMode() ? new ShortCut[0] : new ShortCut[]{this.createWorkBookExportMenu()}
); );
} }
@ -257,6 +258,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
}); });
formDesign.addDesignerEditListener(new DesignerEditListener() { formDesign.addDesignerEditListener(new DesignerEditListener() {
private XComponent lastAffectedCreator; private XComponent lastAffectedCreator;
@Override @Override
public void fireCreatorModified(DesignerEvent evt) { public void fireCreatorModified(DesignerEvent evt) {
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_CUTED) { if (evt.getCreatorEventID() == DesignerEvent.CREATOR_CUTED) {
@ -340,7 +342,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
} }
ParameterPropertyPane.getInstance().setAddParaPaneVisible(isAddParaPaneVisible(comp), this); ParameterPropertyPane.getInstance().setAddParaPaneVisible(isAddParaPaneVisible(comp), this);
editingComponent = comp.createToolPane(this, formDesign); editingComponent = comp.createToolPane(this, formDesign);
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane( EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(
ComparatorUtils.equals(editingComponent.getClass(), NoSupportAuthorityEdit.class) ? editingComponent : createAuthorityEditPane()); ComparatorUtils.equals(editingComponent.getClass(), NoSupportAuthorityEdit.class) ? editingComponent : createAuthorityEditPane());
} else { } else {
@ -578,7 +580,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
this.authorityUndoState = u; this.authorityUndoState = u;
} else { } else {
this.undoState = u; this.undoState = u;
@ -653,7 +655,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
public JPanel getEastUpPane() { public JPanel getEastUpPane() {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
if (formDesign.isSupportAuthority()) { if (formDesign.isSupportAuthority()) {
return new AuthorityPropertyPane(this); return new AuthorityPropertyPane(this);
} else { } else {
@ -717,7 +719,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
DesignerContext.getDesignerFrame().resetToolkitByPlus(JForm.this); DesignerContext.getDesignerFrame().resetToolkitByPlus(JForm.this);
//表单切换后拖不进去组件是因为找不到designer //表单切换后拖不进去组件是因为找不到designer
WidgetToolBarPane.getInstance(formDesign); WidgetToolBarPane.getInstance(formDesign);
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
if (formDesign.isSupportAuthority()) { if (formDesign.isSupportAuthority()) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION);
EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(new AuthorityPropertyPane(this)); EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(new AuthorityPropertyPane(this));

3
designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetButton.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.iofile.attr.SharableAttrMark; import com.fr.base.iofile.attr.SharableAttrMark;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -199,7 +200,7 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot
@Override @Override
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
return; return;
} }
if (lastPressEvent == null) { if (lastPressEvent == null) {

3
designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.core.WidgetOption;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XCreatorUtils;
@ -70,7 +71,7 @@ public class ToolBarButton extends UIButton implements MouseListener, MouseMotio
@Override @Override
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
return; return;
} }
if (lastPressEvent == null) { if (lastPressEvent == null) {

5
designer-form/src/main/java/com/fr/design/mainframe/WidgetToolBarPane.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.bridge.DesignToolbarProvider; import com.fr.design.bridge.DesignToolbarProvider;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.core.FormWidgetOption; import com.fr.design.gui.core.FormWidgetOption;
@ -122,7 +123,7 @@ public class WidgetToolBarPane extends BasicPane implements DesignToolbarProvide
private void checkEnable() { private void checkEnable() {
for (JComponent comp : componentsList4Form) { for (JComponent comp : componentsList4Form) {
comp.setEnabled(!BaseUtils.isAuthorityEditing()); comp.setEnabled(!DesignerMode.isAuthorityEditing());
} }
} }
@ -149,7 +150,7 @@ public class WidgetToolBarPane extends BasicPane implements DesignToolbarProvide
chartButton.addMouseListener(new MouseAdapter() { chartButton.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
return; return;
} }
if (chartWindow == null) { if (chartWindow == null) {

9
designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java

@ -10,6 +10,7 @@ import com.fr.base.FRContext;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
@ -756,7 +757,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
* @return 返回是否清除内容. * @return 返回是否清除内容.
*/ */
public boolean clearContents() { public boolean clearContents() {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
return false; return false;
} }
boolean b = this.selection.clear(Clear.CONTENTS, this); boolean b = this.selection.clear(Clear.CONTENTS, this);
@ -1043,7 +1044,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
*/ */
public UIPopupMenu createRowPopupMenu(MouseEvent evt, int selectedRows) { public UIPopupMenu createRowPopupMenu(MouseEvent evt, int selectedRows) {
UIPopupMenu popupMenu = new UIPopupMenu(); UIPopupMenu popupMenu = new UIPopupMenu();
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
popupMenu.add(new CleanAuthorityAction(this).createMenuItem()); popupMenu.add(new CleanAuthorityAction(this).createMenuItem());
return popupMenu; return popupMenu;
} }
@ -1136,7 +1137,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
public UIPopupMenu createColumnPopupMenu(MouseEvent evt, int selectedColumn) { public UIPopupMenu createColumnPopupMenu(MouseEvent evt, int selectedColumn) {
UIPopupMenu popupMenu = new UIPopupMenu(); UIPopupMenu popupMenu = new UIPopupMenu();
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
popupMenu.add(new CleanAuthorityAction(this).createMenuItem()); popupMenu.add(new CleanAuthorityAction(this).createMenuItem());
return popupMenu; return popupMenu;
} }
@ -1237,7 +1238,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
public ShortCut[] shortCuts4Authority() { public ShortCut[] shortCuts4Authority() {
return new ShortCut[]{ return new ShortCut[]{
new NameSeparator(com.fr.design.i18n.Toolkit.i18nTextArray(new String[]{"DashBoard-Potence", "Edit"})), new NameSeparator(com.fr.design.i18n.Toolkit.i18nTextArray(new String[]{"DashBoard-Potence", "Edit"})),
BaseUtils.isAuthorityEditing() ? new ExitAuthorityEditAction(this) : new AllowAuthorityEditAction(this), DesignerMode.isAuthorityEditing() ? new ExitAuthorityEditAction(this) : new AllowAuthorityEditAction(this),
}; };
} }

7
designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.cell.CellAttributeAction; import com.fr.design.actions.cell.CellAttributeAction;
@ -51,7 +52,7 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
this.addSelectionChangeListener(new SelectionListener() { this.addSelectionChangeListener(new SelectionListener() {
@Override @Override
public void selectionChanged(SelectionEvent e) { public void selectionChanged(SelectionEvent e) {
if (!isEditable() && !BaseUtils.isAuthorityEditing()) { if (!isEditable() && !DesignerMode.isAuthorityEditing()) {
return; return;
} }
refreshPropertyPanes(); refreshPropertyPanes();
@ -71,7 +72,7 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
private void refreshPropertyPanes() { private void refreshPropertyPanes() {
//在编辑权限,所以要更新权限编辑面板 //在编辑权限,所以要更新权限编辑面板
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
AuthorityPropertyPane authorityPropertyPane = new AuthorityPropertyPane(ElementCasePaneDelegate.this); AuthorityPropertyPane authorityPropertyPane = new AuthorityPropertyPane(ElementCasePaneDelegate.this);
authorityPropertyPane.populate(); authorityPropertyPane.populate();
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION);
@ -124,7 +125,7 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
* @return 返回MenuDef数组. * @return 返回MenuDef数组.
*/ */
public MenuDef[] menus4Target() { public MenuDef[] menus4Target() {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
return super.menus4Target(); return super.menus4Target();
} }
return (MenuDef[]) ArrayUtils.addAll(super.menus4Target(), new MenuDef[]{createInsertMenuDef(), createCellMenuDef()}); return (MenuDef[]) ArrayUtils.addAll(super.menus4Target(), new MenuDef[]{createInsertMenuDef(), createCellMenuDef()});

19
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -5,6 +5,7 @@ import com.fr.base.DynamicUnitList;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.AllowAuthorityEditAction; import com.fr.design.actions.AllowAuthorityEditAction;
@ -285,7 +286,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
if (this.getEditingElementCasePane() == null) { if (this.getEditingElementCasePane() == null) {
return JWorkBook.this; return JWorkBook.this;
} }
this.getEditingElementCasePane().getGrid().setEditable(!BaseUtils.isAuthorityEditing()); this.getEditingElementCasePane().getGrid().setEditable(!DesignerMode.isAuthorityEditing());
centerPane.needToShowCoverAndHidPane(); centerPane.needToShowCoverAndHidPane();
if (centerPane.isUpEditMode()) { if (centerPane.isUpEditMode()) {
return parameterPane; return parameterPane;
@ -316,7 +317,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
@Override @Override
public JPanel getEastUpPane() { public JPanel getEastUpPane() {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
return allowAuthorityUpPane(); return allowAuthorityUpPane();
} else { } else {
return exitEastUpPane(); return exitEastUpPane();
@ -632,9 +633,11 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
*/ */
@Override @Override
public ShortCut[] shortcut4FileMenu() { public ShortCut[] shortcut4FileMenu() {
return (ShortCut[]) ArrayUtils.addAll( boolean showWorkBookExportMenu = DesignerMode.isVcsMode()
super.shortcut4FileMenu(), || DesignerMode.isAuthorityEditing()
BaseUtils.isAuthorityEditing() || (!WorkContext.getCurrent().isLocal()) ? new ShortCut[0] : new ShortCut[]{this.createWorkBookExportMenu()} || !WorkContext.getCurrent().isLocal();
return (ShortCut[]) ArrayUtils.addAll(super.shortcut4FileMenu(),
showWorkBookExportMenu ? new ShortCut[0] : new ShortCut[]{this.createWorkBookExportMenu()}
); );
} }
@ -679,7 +682,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
public ShortCut[] shortCuts4Authority() { public ShortCut[] shortCuts4Authority() {
return new ShortCut[]{ return new ShortCut[]{
new NameSeparator(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Permissions_Edition")), new NameSeparator(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Permissions_Edition")),
BaseUtils.isAuthorityEditing() ? new ExitAuthorityEditAction(this) : new AllowAuthorityEditAction(this), DesignerMode.isAuthorityEditing() ? new ExitAuthorityEditAction(this) : new AllowAuthorityEditAction(this),
}; };
} }
@ -725,7 +728,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
protected void applyUndoState(WorkBookUndoState u) { protected void applyUndoState(WorkBookUndoState u) {
try { try {
this.setTarget((WorkBook) u.getWorkBook().clone()); this.setTarget((WorkBook) u.getWorkBook().clone());
if (!BaseUtils.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
if (u.getAuthorityType() != BaseUndoState.NORMAL_STATE) { if (u.getAuthorityType() != BaseUndoState.NORMAL_STATE) {
applyAll(u); applyAll(u);
this.undoState = u; this.undoState = u;
@ -990,7 +993,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
} }
} }
} }
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION);
EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(allowAuthorityUpPane()); EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(allowAuthorityUpPane());
EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance());

3
designer-realize/src/main/java/com/fr/design/mainframe/ReportComponent.java

@ -4,6 +4,7 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.actions.AllowAuthorityEditAction; import com.fr.design.actions.AllowAuthorityEditAction;
import com.fr.design.actions.ExitAuthorityEditAction; import com.fr.design.actions.ExitAuthorityEditAction;
import com.fr.design.actions.report.ReportBackgroundAction; import com.fr.design.actions.report.ReportBackgroundAction;
@ -68,7 +69,7 @@ public abstract class ReportComponent<T extends TemplateReport, E extends Elemen
public ShortCut[] shortCuts4Authority() { public ShortCut[] shortCuts4Authority() {
return new ShortCut[]{ return new ShortCut[]{
new NameSeparator(com.fr.design.i18n.Toolkit.i18nTextArray(new String[]{"DashBoard-Potence", "Edit"})), new NameSeparator(com.fr.design.i18n.Toolkit.i18nTextArray(new String[]{"DashBoard-Potence", "Edit"})),
BaseUtils.isAuthorityEditing() ? new ExitAuthorityEditAction(this) : new AllowAuthorityEditAction(this), DesignerMode.isAuthorityEditing() ? new ExitAuthorityEditAction(this) : new AllowAuthorityEditAction(this),
}; };
} }

3
designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentCardPane.java

@ -5,6 +5,7 @@ import java.awt.CardLayout;
import javax.swing.JComponent; import javax.swing.JComponent;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
@ -125,7 +126,7 @@ public class ReportComponentCardPane extends JComponent implements TargetModifie
} else if (tpl instanceof PolyWorkSheet) { } else if (tpl instanceof PolyWorkSheet) {
showPoly((PolyWorkSheet) tpl); showPoly((PolyWorkSheet) tpl);
} }
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName(); String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName();
editingTemplate.setSheetCovered(tpl.getWorkSheetPrivilegeControl().checkInvisible(selectedRoles)); editingTemplate.setSheetCovered(tpl.getWorkSheetPrivilegeControl().checkInvisible(selectedRoles));

3
designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java

@ -21,6 +21,7 @@ import javax.swing.UIManager;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
@ -318,7 +319,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
*/ */
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
isAuthorityEditing = BaseUtils.isAuthorityEditing(); isAuthorityEditing = DesignerMode.isAuthorityEditing();
showCount = 0; showCount = 0;
// 开始画那些Tab. // 开始画那些Tab.
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;

3
designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java

@ -5,6 +5,7 @@ package com.fr.design.mainframe.form;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.actions.AllowAuthorityEditAction; import com.fr.design.actions.AllowAuthorityEditAction;
import com.fr.design.actions.ExitAuthorityEditAction; import com.fr.design.actions.ExitAuthorityEditAction;
@ -94,7 +95,7 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
public ShortCut[] shortCuts4Authority() { public ShortCut[] shortCuts4Authority() {
return new ShortCut[]{ return new ShortCut[]{
new NameSeparator(com.fr.design.i18n.Toolkit.i18nTextArray(new String[]{"DashBoard-Potence", "Edit"})), new NameSeparator(com.fr.design.i18n.Toolkit.i18nTextArray(new String[]{"DashBoard-Potence", "Edit"})),
BaseUtils.isAuthorityEditing() ? new ExitAuthorityEditAction(this) : new AllowAuthorityEditAction(this), DesignerMode.isAuthorityEditing() ? new ExitAuthorityEditAction(this) : new AllowAuthorityEditAction(this),
}; };
} }

5
designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.parameter.ParameterUI; import com.fr.base.parameter.ParameterUI;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.actions.AllowAuthorityEditAction; import com.fr.design.actions.AllowAuthorityEditAction;
import com.fr.design.actions.ExitAuthorityEditAction; import com.fr.design.actions.ExitAuthorityEditAction;
@ -458,7 +459,7 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus
* @return 文件菜单的子菜单 * @return 文件菜单的子菜单
*/ */
public ShortCut[] shortcut4FileMenu() { public ShortCut[] shortcut4FileMenu() {
return (ShortCut[]) ArrayUtils.addAll(BaseUtils.isAuthorityEditing() ? return (ShortCut[]) ArrayUtils.addAll(DesignerMode.isAuthorityEditing() ?
new ShortCut[]{new SaveTemplateAction(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()), new ShortCut[]{new SaveTemplateAction(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()),
new UndoAction(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()), new UndoAction(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()),
new RedoAction(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate())} : new RedoAction(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate())} :
@ -477,7 +478,7 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus
*/ */
public MenuDef[] menus4Target() { public MenuDef[] menus4Target() {
MenuDef tplMenu = new MenuDef(KeySetUtils.TEMPLATE.getMenuKeySetName(),KeySetUtils.TEMPLATE.getMnemonic()); MenuDef tplMenu = new MenuDef(KeySetUtils.TEMPLATE.getMenuKeySetName(),KeySetUtils.TEMPLATE.getMnemonic());
if (!BaseUtils.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
tplMenu.addShortCut(new NameSeparator(com.fr.design.i18n.Toolkit.i18nText("FR-Utils_WorkBook"))); tplMenu.addShortCut(new NameSeparator(com.fr.design.i18n.Toolkit.i18nText("FR-Utils_WorkBook")));
tplMenu.addShortCut(new ReportParameterAction(workBook)); tplMenu.addShortCut(new ReportParameterAction(workBook));
tplMenu.addShortCut(new NameSeparator(com.fr.design.i18n.Toolkit.i18nTextArray(new String[]{"DashBoard-Potence", "Edit"}))); tplMenu.addShortCut(new NameSeparator(com.fr.design.i18n.Toolkit.i18nTextArray(new String[]{"DashBoard-Potence", "Edit"})));

3
designer-realize/src/main/java/com/fr/design/webattr/ToolBarButton.java

@ -1,6 +1,7 @@
package com.fr.design.webattr; package com.fr.design.webattr;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
@ -90,7 +91,7 @@ public class ToolBarButton extends UIButton implements MouseListener {
* @param e 鼠标点击事件 * @param e 鼠标点击事件
*/ */
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
auhtorityMouseAction(); auhtorityMouseAction();
return; return;
} }

5
designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java

@ -19,6 +19,7 @@ import com.fr.base.DynamicUnitList;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
@ -417,7 +418,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
this.setToolTipText2(this.getSelectedHeaderTooltip(Math.abs(startMultiSelectIndex - endMultiSelectIndex) + 1)); this.setToolTipText2(this.getSelectedHeaderTooltip(Math.abs(startMultiSelectIndex - endMultiSelectIndex) + 1));
} else if (dragType == GridUtils.DRAG_CELL_SIZE) { } else if (dragType == GridUtils.DRAG_CELL_SIZE) {
//权限编辑状态不可以改变行列的宽度 //权限编辑状态不可以改变行列的宽度
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
return; return;
} }
if (!(isDragPermited)) { if (!(isDragPermited)) {
@ -488,7 +489,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
tmpIncreaseSize = sizeList.get(i).toPixD(resolution); tmpIncreaseSize = sizeList.get(i).toPixD(resolution);
tmpSize2 = tmpIncreaseSize <= 0 ? tmpSize1 + 1 : tmpSize1 + tmpIncreaseSize; tmpSize2 = tmpIncreaseSize <= 0 ? tmpSize1 + 1 : tmpSize1 + tmpIncreaseSize;
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
break; break;
} }

3
designer-realize/src/main/java/com/fr/grid/GridColumnUI.java

@ -13,6 +13,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList; import com.fr.base.DynamicUnitList;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.vcs.DesignerMode;
import com.fr.cache.list.IntList; import com.fr.cache.list.IntList;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
@ -132,7 +133,7 @@ public class GridColumnUI extends ComponentUI {
} }
private void drawAuthority(ElementCase elementCase, Graphics2D g2d, double tmpWidth1, double tmpIncreaseWidth, Dimension size, int i) { private void drawAuthority(ElementCase elementCase, Graphics2D g2d, double tmpWidth1, double tmpIncreaseWidth, Dimension size, int i) {
boolean isAuthorityEdited = BaseUtils.isAuthorityEditing(); boolean isAuthorityEdited = DesignerMode.isAuthorityEditing();
if (isAuthorityEdited) { if (isAuthorityEdited) {
ColumnRowPrivilegeControl cpc = elementCase.getColumnPrivilegeControl(i); ColumnRowPrivilegeControl cpc = elementCase.getColumnPrivilegeControl(i);
String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName(); String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName();

13
designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java

@ -3,6 +3,7 @@ package com.fr.grid;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList; import com.fr.base.DynamicUnitList;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.vcs.DesignerMode;
import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -157,7 +158,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
* 处理左击事件 * 处理左击事件
*/ */
private void doWithLeftButtonPressed(MouseEvent evt) { private void doWithLeftButtonPressed(MouseEvent evt) {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
grid.setEditable(false); grid.setEditable(false);
} }
@ -188,10 +189,10 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
// 得到点击所在的column and row // 得到点击所在的column and row
ColumnRow columnRow = GridUtils.getEventColumnRow_withresolution(reportPane, this.oldEvtX, this.oldEvtY, this.resolution); ColumnRow columnRow = GridUtils.getEventColumnRow_withresolution(reportPane, this.oldEvtX, this.oldEvtY, this.resolution);
TemplateCellElement cellElement = report.getTemplateCellElement(columnRow.getColumn(), columnRow.getRow()); TemplateCellElement cellElement = report.getTemplateCellElement(columnRow.getColumn(), columnRow.getRow());
if (clickCount >= 2 && !BaseUtils.isAuthorityEditing()) { if (clickCount >= 2 && !DesignerMode.isAuthorityEditing()) {
grid.startEditing(); grid.startEditing();
} }
if (clickCount == 1 && cellElement != null && cellElement.getWidget() != null && !BaseUtils.isAuthorityEditing()) { if (clickCount == 1 && cellElement != null && cellElement.getWidget() != null && !DesignerMode.isAuthorityEditing()) {
showWidetWindow(cellElement, report); showWidetWindow(cellElement, report);
} }
reportPane.repaint(); reportPane.repaint();
@ -362,12 +363,12 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
} }
Selection selection = reportPane.getSelection(); Selection selection = reportPane.getSelection();
if (selection instanceof FloatSelection && !BaseUtils.isAuthorityEditing()) { if (selection instanceof FloatSelection && !DesignerMode.isAuthorityEditing()) {
doWithFloatElementDragged(evtX, evtY, (FloatSelection) selection); doWithFloatElementDragged(evtX, evtY, (FloatSelection) selection);
grid.setDragType(GridUtils.DRAG_FLOAT); grid.setDragType(GridUtils.DRAG_FLOAT);
} else if (grid.getDragType() == GridUtils.DRAG_CELLSELECTION_BOTTOMRIGHT_CORNER && !BaseUtils.isAuthorityEditing()) { } else if (grid.getDragType() == GridUtils.DRAG_CELLSELECTION_BOTTOMRIGHT_CORNER && !DesignerMode.isAuthorityEditing()) {
doWithCellElementDragged(evtX, evtY, (CellSelection) selection); doWithCellElementDragged(evtX, evtY, (CellSelection) selection);
} else if (grid.getDragType() == GridUtils.DRAG_CELLSELECTION && !BaseUtils.isAuthorityEditing()) { } else if (grid.getDragType() == GridUtils.DRAG_CELLSELECTION && !DesignerMode.isAuthorityEditing()) {
// peter:获得调整过的Selected Column Row. // peter:获得调整过的Selected Column Row.
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution); ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
if (selectedCellPoint.getColumn() != grid.getDragRectangle().x || selectedCellPoint.getRow() != grid.getDragRectangle().y) { if (selectedCellPoint.getColumn() != grid.getDragRectangle().x || selectedCellPoint.getRow() != grid.getDragRectangle().y) {

3
designer-realize/src/main/java/com/fr/grid/GridRowUI.java

@ -12,6 +12,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList; import com.fr.base.DynamicUnitList;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.vcs.DesignerMode;
import com.fr.cache.list.IntList; import com.fr.cache.list.IntList;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
@ -137,7 +138,7 @@ public class GridRowUI extends ComponentUI {
} }
private void drawAuthority(ElementCase elementCase, Graphics2D g2d, double tmpHeight1, double tmpIncreaseHeight, Dimension size, int i) { private void drawAuthority(ElementCase elementCase, Graphics2D g2d, double tmpHeight1, double tmpIncreaseHeight, Dimension size, int i) {
boolean isAuthorityEdited = BaseUtils.isAuthorityEditing(); boolean isAuthorityEdited = DesignerMode.isAuthorityEditing();
if (isAuthorityEdited) { if (isAuthorityEdited) {
ColumnRowPrivilegeControl cpc = elementCase.getRowPrivilegeControl(i); ColumnRowPrivilegeControl cpc = elementCase.getRowPrivilegeControl(i);
String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName(); String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName();

3
designer-realize/src/main/java/com/fr/grid/GridUI.java

@ -11,6 +11,7 @@ import com.fr.base.Utils;
import com.fr.base.background.ColorBackground; import com.fr.base.background.ColorBackground;
import com.fr.base.background.ImageFileBackground; import com.fr.base.background.ImageFileBackground;
import com.fr.base.iofile.attr.WatermarkAttr; import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -1060,7 +1061,7 @@ public class GridUI extends ComponentUI {
throw new IllegalArgumentException("The component c to paint must be a Grid!"); throw new IllegalArgumentException("The component c to paint must be a Grid!");
} }
isAuthority = BaseUtils.isAuthorityEditing(); isAuthority = DesignerMode.isAuthorityEditing();
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;

3
designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java

@ -4,6 +4,7 @@ import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.NameStyle; import com.fr.base.NameStyle;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.base.vcs.DesignerMode;
import com.fr.cache.list.IntList; import com.fr.cache.list.IntList;
import com.fr.config.ServerPreferenceConfig; import com.fr.config.ServerPreferenceConfig;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
@ -463,7 +464,7 @@ public class CellSelection extends Selection {
*/ */
public UIPopupMenu createPopupMenu(ElementCasePane ePane) { public UIPopupMenu createPopupMenu(ElementCasePane ePane) {
UIPopupMenu popup = new UIPopupMenu(); UIPopupMenu popup = new UIPopupMenu();
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
popup.add(new CleanAuthorityAction(ePane).createMenuItem()); popup.add(new CleanAuthorityAction(ePane).createMenuItem());
return popup; return popup;
} }

3
designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java

@ -2,6 +2,7 @@ package com.fr.grid.selection;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.actions.cell.CleanAuthorityAction; import com.fr.design.actions.cell.CleanAuthorityAction;
import com.fr.design.actions.cell.FloatStyleAction; import com.fr.design.actions.cell.FloatStyleAction;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
@ -125,7 +126,7 @@ public class FloatSelection extends Selection {
@Override @Override
public JPopupMenu createPopupMenu(ElementCasePane ePane) { public JPopupMenu createPopupMenu(ElementCasePane ePane) {
UIPopupMenu popup = new UIPopupMenu(); UIPopupMenu popup = new UIPopupMenu();
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
popup.add(new CleanAuthorityAction(ePane).createMenuItem()); popup.add(new CleanAuthorityAction(ePane).createMenuItem());
return popup; return popup;
} }

3
designer-realize/src/main/java/com/fr/poly/PolyComponetsBar.java

@ -5,6 +5,7 @@ import com.fr.base.FRContext;
import com.fr.base.chart.BaseChart; import com.fr.base.chart.BaseChart;
import com.fr.base.chart.BaseChartGetter; import com.fr.base.chart.BaseChartGetter;
import com.fr.base.chart.BaseChartNameID; import com.fr.base.chart.BaseChartNameID;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.itooltip.MultiLineToolTip; import com.fr.design.gui.itooltip.MultiLineToolTip;
@ -53,7 +54,7 @@ public class PolyComponetsBar extends JToolBar {
*/ */
public void checkEnable() { public void checkEnable() {
for (SerIcon serIcon : serIcons) { for (SerIcon serIcon : serIcons) {
serIcon.setEnabled(!BaseUtils.isAuthorityEditing()); serIcon.setEnabled(!DesignerMode.isAuthorityEditing());
} }
} }

7
designer-realize/src/main/java/com/fr/poly/PolyDesigner.java

@ -7,6 +7,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.vcs.DesignerMode;
import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
@ -355,7 +356,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
//聚合块不参加权限编辑 //聚合块不参加权限编辑
if (selectElement == null) { if (selectElement == null) {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (jTemplate.isJWorkBook()) { if (jTemplate.isJWorkBook()) {
//清参数面板 //清参数面板
@ -715,7 +716,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
initPolyBlocks(); initPolyBlocks();
startEditing(blockName); startEditing(blockName);
if (selection == null) { if (selection == null) {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION_DISABLED); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION_DISABLED);
EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(new NoSupportAuthorityEdit()); EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(new NoSupportAuthorityEdit());
} else { } else {
@ -870,7 +871,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
jt.setComposite(); jt.setComposite();
} }
DesignerContext.getDesignerFrame().resetToolkitByPlus(DesignerContext.getDesignerFrame().getSelectedJTemplate()); DesignerContext.getDesignerFrame().resetToolkitByPlus(DesignerContext.getDesignerFrame().getSelectedJTemplate());
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
EastRegionContainerPane.getInstance().replaceDownPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().replaceDownPane(RolesAlreadyEditedPane.getInstance());
} else if (isChooseBlock()) { } else if (isChooseBlock()) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY_CHART); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY_CHART);

3
designer-realize/src/main/java/com/fr/poly/actions/DeleteBlockAction.java

@ -9,6 +9,7 @@ import java.awt.event.KeyEvent;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.actions.TemplateComponentActionInterface; import com.fr.design.actions.TemplateComponentActionInterface;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
@ -30,7 +31,7 @@ public class DeleteBlockAction extends UpdateAction implements TemplateComponent
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
return; return;
} }
final PolyDesigner designer = this.getEditingComponent(); final PolyDesigner designer = this.getEditingComponent();

7
designer-realize/src/main/java/com/fr/poly/creator/ChartBlockEditor.java

@ -10,6 +10,7 @@ import com.fr.base.chart.BaseChart;
import com.fr.base.chart.BaseChartCollection; import com.fr.base.chart.BaseChartCollection;
import com.fr.base.chart.BaseChartGetter; import com.fr.base.chart.BaseChartGetter;
import com.fr.base.chart.BaseChartNameID; import com.fr.base.chart.BaseChartNameID;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.chart.MiddleChartComponent; import com.fr.design.gui.chart.MiddleChartComponent;
@ -107,7 +108,7 @@ public class ChartBlockEditor extends BlockEditor<MiddleChartComponent, PolyChar
*/ */
public void checkChartButtonsEnable() { public void checkChartButtonsEnable() {
// for (ChartButton chartButton : chartButtons) { // for (ChartButton chartButton : chartButtons) {
// chartButton.setEnabled(!BaseUtils.isAuthorityEditing()); // chartButton.setEnabled(!DesignerMode.isAuthorityEditing());
// } // }
} }
@ -211,7 +212,7 @@ public class ChartBlockEditor extends BlockEditor<MiddleChartComponent, PolyChar
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
return; return;
} }
BaseChart chart = null; BaseChart chart = null;
@ -274,7 +275,7 @@ public class ChartBlockEditor extends BlockEditor<MiddleChartComponent, PolyChar
public void resetSelectionAndChooseState() { public void resetSelectionAndChooseState() {
designer.setChooseType(SelectionType.CHART_INNER); designer.setChooseType(SelectionType.CHART_INNER);
// refreshChartComponent();// 选中之后 刷新下图表编辑层 // refreshChartComponent();// 选中之后 刷新下图表编辑层
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (jTemplate.isJWorkBook()) { if (jTemplate.isJWorkBook()) {
//清参数面板 //清参数面板

3
designer-realize/src/main/java/com/fr/poly/creator/ECBlockEditor.java

@ -5,6 +5,7 @@ package com.fr.poly.creator;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
@ -136,7 +137,7 @@ public class ECBlockEditor extends BlockEditor<ECBlockPane, PolyECBlock> {
*/ */
public void resetSelectionAndChooseState() { public void resetSelectionAndChooseState() {
designer.setChooseType(SelectionType.INNER); designer.setChooseType(SelectionType.INNER);
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (jTemplate.isJWorkBook()) { if (jTemplate.isJWorkBook()) {
//清参数面板 //清参数面板

5
designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java

@ -4,6 +4,7 @@
package com.fr.poly.creator; package com.fr.poly.creator;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.actions.edit.HyperlinkAction; import com.fr.design.actions.edit.HyperlinkAction;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
@ -55,7 +56,7 @@ public class ECBlockPane extends PolyElementCasePane {
if (!isEditable()) { if (!isEditable()) {
return; return;
} }
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
if (designer.getSelection().getEditingElementCasePane() == null) { if (designer.getSelection().getEditingElementCasePane() == null) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION_DISABLED); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION_DISABLED);
EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(new NoSupportAuthorityEdit()); EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(new NoSupportAuthorityEdit());
@ -106,7 +107,7 @@ public class ECBlockPane extends PolyElementCasePane {
* @return 返回MenuDef数组. * @return 返回MenuDef数组.
*/ */
public MenuDef[] menus4Target() { public MenuDef[] menus4Target() {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
return super.menus4Target(); return super.menus4Target();
} }
return (MenuDef[]) ArrayUtils.addAll(super.menus4Target(), new MenuDef[]{createInsertMenuDef(), createCellMenuDef()}); return (MenuDef[]) ArrayUtils.addAll(super.menus4Target(), new MenuDef[]{createInsertMenuDef(), createCellMenuDef()});

7
designer-realize/src/main/java/com/fr/poly/hanlder/BottomCornerMouseHanlder.java

@ -11,6 +11,7 @@ import javax.swing.event.MouseInputAdapter;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.beans.location.Absorptionline; import com.fr.design.beans.location.Absorptionline;
import com.fr.design.beans.location.MoveUtils; import com.fr.design.beans.location.MoveUtils;
import com.fr.design.beans.location.MoveUtils.RectangleDesigner; import com.fr.design.beans.location.MoveUtils.RectangleDesigner;
@ -49,7 +50,7 @@ public class BottomCornerMouseHanlder extends MouseInputAdapter {
* *
*/ */
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
designer.noAuthorityEdit(); designer.noAuthorityEdit();
} }
pressed = e.getPoint(); pressed = e.getPoint();
@ -66,7 +67,7 @@ public class BottomCornerMouseHanlder extends MouseInputAdapter {
* *
*/ */
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
designer.noAuthorityEdit(); designer.noAuthorityEdit();
} }
editor.setDragging(false); editor.setDragging(false);
@ -92,7 +93,7 @@ public class BottomCornerMouseHanlder extends MouseInputAdapter {
* *
*/ */
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
designer.noAuthorityEdit(); designer.noAuthorityEdit();
return; return;
} }

5
designer-realize/src/main/java/com/fr/poly/hanlder/ColumnOperationMouseHandler.java

@ -8,6 +8,7 @@ import java.awt.event.MouseEvent;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.vcs.DesignerMode;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.poly.PolyDesigner; import com.fr.poly.PolyDesigner;
import com.fr.poly.PolyDesigner.SelectionType; import com.fr.poly.PolyDesigner.SelectionType;
@ -57,7 +58,7 @@ public abstract class ColumnOperationMouseHandler<T extends BlockEditor> extends
* *
*/ */
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
designer.noAuthorityEdit(); designer.noAuthorityEdit();
} }
startPoint = e.getPoint(); startPoint = e.getPoint();
@ -74,7 +75,7 @@ public abstract class ColumnOperationMouseHandler<T extends BlockEditor> extends
* *
*/ */
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
return; return;
} }
TemplateBlock block = editor.getValue(); TemplateBlock block = editor.getValue();

3
designer-realize/src/main/java/com/fr/poly/hanlder/PolyDesignerDropTarget.java

@ -19,6 +19,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.chart.BaseChart; import com.fr.base.chart.BaseChart;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.grid.Grid; import com.fr.grid.Grid;
import com.fr.poly.PolyDesigner; import com.fr.poly.PolyDesigner;
@ -55,7 +56,7 @@ public class PolyDesignerDropTarget extends DropTargetAdapter {
*/ */
public void dragEnter(DropTargetDragEvent dtde) { public void dragEnter(DropTargetDragEvent dtde) {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
return; return;
} }
// richer:避免在一次拖拽过程中重复查找 // richer:避免在一次拖拽过程中重复查找

5
designer-realize/src/main/java/com/fr/poly/hanlder/RowOperationMouseHandler.java

@ -8,6 +8,7 @@ import java.awt.event.MouseEvent;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.vcs.DesignerMode;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.poly.PolyDesigner; import com.fr.poly.PolyDesigner;
import com.fr.poly.PolyDesigner.SelectionType; import com.fr.poly.PolyDesigner.SelectionType;
@ -55,7 +56,7 @@ public abstract class RowOperationMouseHandler<T extends BlockEditor> extends Bl
* *
*/ */
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
designer.noAuthorityEdit(); designer.noAuthorityEdit();
} }
startPoint = e.getPoint(); startPoint = e.getPoint();
@ -72,7 +73,7 @@ public abstract class RowOperationMouseHandler<T extends BlockEditor> extends Bl
* *
*/ */
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
return; return;
} }
TemplateBlock block = editor.getValue(); TemplateBlock block = editor.getValue();

15
designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java

@ -1,6 +1,5 @@
package com.fr.start; package com.fr.start;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
@ -14,18 +13,12 @@ import com.fr.design.mainframe.ActiveKeyGenerator;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import javax.swing.BorderFactory; import javax.swing.*;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
import javax.swing.border.TitledBorder; import javax.swing.border.TitledBorder;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
@ -147,7 +140,7 @@ public class CollectUserInformationDialog extends UIDialog {
private void getKeyAction() { private void getKeyAction() {
Locale locale = FRContext.getLocale(); Locale locale = GeneralContext.getLocale();
String url = EN_LOGIN_HTML; String url = EN_LOGIN_HTML;
if (ComparatorUtils.equals(locale, Locale.TAIWAN)) { if (ComparatorUtils.equals(locale, Locale.TAIWAN)) {
url = TW_LOGIN_HTML; url = TW_LOGIN_HTML;

7
designer-realize/src/main/java/com/fr/start/Designer.java

@ -2,6 +2,7 @@ package com.fr.start;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.file.WebPreviewUtils; import com.fr.design.actions.file.WebPreviewUtils;
@ -192,7 +193,7 @@ public class Designer extends BaseDesigner {
return menuDef; return menuDef;
} }
if (!BaseUtils.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
menuDef.addShortCut(SeparatorDef.DEFAULT); menuDef.addShortCut(SeparatorDef.DEFAULT);
if (WorkContext.getCurrent().isRoot()) { if (WorkContext.getCurrent().isRoot()) {
@ -362,7 +363,7 @@ public class Designer extends BaseDesigner {
if (jt == null) { if (jt == null) {
return; return;
} }
saveButton.setEnabled(!jt.isSaved()); saveButton.setEnabled(!jt.isSaved() && !DesignerMode.isVcsMode());
MutilTempalteTabPane.getInstance().refreshOpenedTemplate(HistoryTemplateListPane.getInstance().getHistoryList()); MutilTempalteTabPane.getInstance().refreshOpenedTemplate(HistoryTemplateListPane.getInstance().getHistoryList());
MutilTempalteTabPane.getInstance().repaint(); MutilTempalteTabPane.getInstance().repaint();
if (DesignerEnvManager.getEnvManager().isSupportUndo()) { if (DesignerEnvManager.getEnvManager().isSupportUndo()) {
@ -387,7 +388,7 @@ public class Designer extends BaseDesigner {
@Override @Override
public JComponent resetToolBar(JComponent toolbarComponent, ToolBarMenuDockPlus plus) { public JComponent resetToolBar(JComponent toolbarComponent, ToolBarMenuDockPlus plus) {
//如果是处于权限编辑状态 //如果是处于权限编辑状态
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
if (plus instanceof JWorkBook && plus.toolbars4Target() == null) { if (plus instanceof JWorkBook && plus.toolbars4Target() == null) {
//聚合块编辑 //聚合块编辑
return super.polyToolBar(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Privilege_Poly_Block_Edit")); return super.polyToolBar(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Privilege_Poly_Block_Edit"));

5
designer-realize/src/main/java/com/fr/start/SplashContext.java

@ -1,11 +1,10 @@
package com.fr.start; package com.fr.start;
import com.fr.base.FRContext;
import com.fr.design.mainframe.bbs.BBSConstants; import com.fr.design.mainframe.bbs.BBSConstants;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.general.GeneralContext;
import com.fr.module.ModuleEvent; import com.fr.module.ModuleEvent;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -135,7 +134,7 @@ public class SplashContext {
private boolean shouldShowThanks() { private boolean shouldShowThanks() {
Locale[] hideLocales = {Locale.CHINA, Locale.TAIWAN}; Locale[] hideLocales = {Locale.CHINA, Locale.TAIWAN};
for (Locale loc : hideLocales) { for (Locale loc : hideLocales) {
if (FRContext.getLocale().equals(loc)) { if (GeneralContext.getLocale().equals(loc)) {
return true; return true;
} }
} }

7
designer-realize/src/main/java/com/fr/start/jni/SplashMac.java

@ -7,6 +7,7 @@ import com.fr.stable.StringUtils;
import com.fr.start.SplashContext; import com.fr.start.SplashContext;
import com.fr.start.SplashStrategy; import com.fr.start.SplashStrategy;
import javax.swing.*;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
@ -24,6 +25,7 @@ public class SplashMac implements SplashStrategy {
private SplashJNI jni; private SplashJNI jni;
private static final int EXILE = 10000;
public SplashMac() { public SplashMac() {
jni = new SplashJNI(); jni = new SplashJNI();
@ -62,6 +64,11 @@ public class SplashMac implements SplashStrategy {
@Override @Override
public void show() { public void show() {
if (jni != null) { if (jni != null) {
// mac下安装版模糊的hack
JFrame jFrame = new JFrame();
jFrame.setLocation(EXILE, EXILE);
jFrame.setVisible(true);
jFrame.setVisible(false);
File splash = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), SplashContext.SPLASH_CACHE_NAME)); File splash = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), SplashContext.SPLASH_CACHE_NAME));
String path = splash.exists() ? splash.getAbsolutePath() : loadResFromJar(); String path = splash.exists() ? splash.getAbsolutePath() : loadResFromJar();
jni.show(path); jni.show(path);

2
designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java

@ -64,7 +64,7 @@ public class PreStartActivator extends Activator {
private void initLanguage() { private void initLanguage() {
//这两句的位置不能随便调换,因为会影响语言切换的问题 //这两句的位置不能随便调换,因为会影响语言切换的问题
GeneralContext.setLocale(DesignerEnvManager.getEnvManager(false).getLocale()); GeneralContext.setLocale(DesignerEnvManager.getEnvManager(false).getLanguage());
} }
@Override @Override

Loading…
Cancel
Save