From 8141697e3fe7d41805c781d28a3d02324211cf73 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Sun, 21 Apr 2019 20:11:11 +0800 Subject: [PATCH 01/21] =?UTF-8?q?REPORT-14835=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E7=AE=A1=E7=90=86=E4=BC=98=E5=8C=96=E5=8F=8A?= =?UTF-8?q?=E5=86=85=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DesignerFrameFileDealerPane.java | 70 ++++++- .../design/mainframe/toolbar/VcsConfig.java | 74 +++++++ .../design/mainframe/toolbar/VcsContext.java | 17 ++ .../vcs/images/icon_back_normal@2x.png | Bin 0 -> 804 bytes .../mainframe/vcs/images/icon_delete.png | Bin 0 -> 167 bytes .../mainframe/vcs/images/icon_delete@2x.png | Bin 0 -> 211 bytes .../design/mainframe/vcs/images/icon_edit.png | Bin 0 -> 398 bytes .../mainframe/vcs/images/icon_edit@2x.png | Bin 0 -> 730 bytes .../mainframe/vcs/images/icon_filter@1x.png | Bin 0 -> 317 bytes .../mainframe/vcs/images/icon_filter@2x.png | Bin 0 -> 537 bytes .../vcs/images/icon_list_disabled.png | Bin 0 -> 289 bytes .../vcs/images/icon_list_disabled@2x.png | Bin 0 -> 605 bytes .../vcs/images/icon_list_normal@2x.png | Bin 0 -> 586 bytes .../mainframe/vcs/images/icon_revert.png | Bin 0 -> 512 bytes .../mainframe/vcs/images/icon_revert@2x.png | Bin 0 -> 971 bytes .../vcs/images/icon_save_disabled.png | Bin 0 -> 467 bytes .../vcs/images/icon_save_disabled@2x.png | Bin 0 -> 926 bytes .../vcs/images/icon_save_normal@2x.png | Bin 0 -> 908 bytes .../mainframe/vcs/images/icon_user@1x.png | Bin 0 -> 376 bytes .../mainframe/vcs/images/icon_user@2x.png | Bin 0 -> 668 bytes .../design/mainframe/vcs/images/vcs_back.png | Bin 0 -> 310 bytes .../design/mainframe/vcs/images/vcs_list.png | Bin 0 -> 286 bytes .../design/mainframe/vcs/images/vcs_save.png | Bin 0 -> 453 bytes .../vcs/proxy/VcsCacheFileNodeFileProxy.java | 74 +++++++ .../vcs/ui/FileVersionCellEditor.java | 83 ++++++++ .../vcs/ui/FileVersionCellRender.java | 43 ++++ .../mainframe/vcs/ui/FileVersionDialog.java | 77 ++++++++ .../vcs/ui/FileVersionFirstRowPanel.java | 20 ++ .../mainframe/vcs/ui/FileVersionRowPanel.java | 148 ++++++++++++++ .../vcs/ui/FileVersionTablePanel.java | 86 ++++++++ .../mainframe/vcs/ui/FileVersionsPanel.java | 187 ++++++++++++++++++ .../src/main/java/com/fr/start/Designer.java | 52 ++++- 32 files changed, 927 insertions(+), 4 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsConfig.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsContext.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_back_normal@2x.png create mode 100755 designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_delete.png create mode 100755 designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_delete@2x.png create mode 100755 designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_edit.png create mode 100755 designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_edit@2x.png create mode 100755 designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_filter@1x.png create mode 100755 designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_filter@2x.png create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_list_disabled.png create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_list_disabled@2x.png create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_list_normal@2x.png create mode 100755 designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_revert.png create mode 100755 designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_revert@2x.png create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_save_disabled.png create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_save_disabled@2x.png create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_save_normal@2x.png create mode 100755 designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_user@1x.png create mode 100755 designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_user@2x.png create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/vcs/images/vcs_back.png create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/vcs/images/vcs_list.png create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/vcs/images/vcs_save.png create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/vcs/proxy/VcsCacheFileNodeFileProxy.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellRender.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionFirstRowPanel.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionTablePanel.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index cef5c86a08..48e067d36d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -26,6 +26,8 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.toolbar.VcsConfig; +import com.fr.design.mainframe.vcs.ui.FileVersionsPanel; import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; @@ -43,9 +45,13 @@ import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.CoreConstants; +import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; +import com.fr.stable.project.ProjectConstants; import com.fr.third.org.apache.commons.io.FilenameUtils; +import com.fr.third.springframework.context.annotation.AnnotationConfigApplicationContext; import com.fr.workspace.WorkContext; +import com.fr.workspace.server.vcs.common.Constants; import javax.swing.BorderFactory; import javax.swing.JDialog; @@ -111,6 +117,8 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt private DelFileAction delFileAction = new DelFileAction(); + private VcsAction vcsAction = new VcsAction(); + /** * 刷新 @@ -191,7 +199,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt if (WorkContext.getCurrent().isLocal()) { toolbarDef.addShortCut(showInExplorerAction); } - toolbarDef.addShortCut(renameAction, delFileAction); + toolbarDef.addShortCut(renameAction, delFileAction, vcsAction); Set extraShortCuts = ExtraDesignClassManager.getInstance().getExtraShortCuts(); for (ShortCut shortCut : extraShortCuts) { toolbarDef.addShortCut(shortCut); @@ -209,6 +217,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt showInExplorerAction.setEnabled(false); renameAction.setEnabled(false); delFileAction.setEnabled(false); + vcsAction.setEnabled(false); this.repaint(); } @@ -273,6 +282,63 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt } + /** + * 版本管理 + */ + private class VcsAction extends UpdateAction { + public VcsAction() { + this.setName(Toolkit.i18nText("Plugin-VCS_Title")); + this.setSmallIcon(Constants.VCS_LIST_PNG); + } + + @Override + public void actionPerformed(ActionEvent e) { + String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); + path = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, path); + + boolean isCurrentEditing = isCurrentEditing(path); + + // 如果模板正在编辑,保存后再打开版本管理 + if (isCurrentEditing) { + saveCurrentEditingTemplate(); + } + + // 如果模板已经打开了,关掉,避免出现2个同名tab(1个是模板,1个是版本) + closeOpendTemplate(path, isCurrentEditing); + AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(VcsConfig.class); + FileVersionsPanel fileVersionTablePanel = context.getBean(FileVersionsPanel.class); + fileVersionTablePanel.showFileVersionsPane(); + } + + private void closeOpendTemplate(String path, boolean isCurrentEditing) { + for (JTemplate jTemplate : HistoryTemplateListCache.getInstance().getHistoryList()) { + if (ComparatorUtils.equals(jTemplate.getEditingFILE().getPath(), path)) { + if (isCurrentEditing) { + MutilTempalteTabPane.getInstance().setIsCloseCurrent(true); + } + MutilTempalteTabPane.getInstance().closeFormat(jTemplate); + MutilTempalteTabPane.getInstance().closeSpecifiedTemplate(jTemplate); + return; + } + } + } + + + } + + private void saveCurrentEditingTemplate() { + JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + jt.stopEditing(); + jt.saveTemplate(); + jt.requestFocus(); + } + + private boolean isCurrentEditing(String path) { + JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + String editing = jt.getEditingFILE().getPath(); + return ComparatorUtils.equals(editing, path); + } + /** * 在系统资源管理器中打开 */ @@ -386,11 +452,11 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt newFolderAction.setEnabled(singleSelected); renameAction.setEnabled(singleSelected); showInExplorerAction.setEnabled(singleSelected); + vcsAction.setEnabled(singleSelected); // 删除操作在至少选中一个时可用 boolean selected = selectedPathNum > 0; delFileAction.setEnabled(selected); - // 刷新操作始终可用 refreshTreeAction.setEnabled(true); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsConfig.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsConfig.java new file mode 100644 index 0000000000..8364f546f0 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsConfig.java @@ -0,0 +1,74 @@ +package com.fr.design.mainframe.toolbar; + +import com.fr.design.mainframe.vcs.ui.FileVersionCellEditor; +import com.fr.design.mainframe.vcs.ui.FileVersionCellRender; +import com.fr.design.mainframe.vcs.ui.FileVersionFirstRowPanel; +import com.fr.design.mainframe.vcs.ui.FileVersionRowPanel; +import com.fr.design.mainframe.vcs.ui.FileVersionTablePanel; +import com.fr.design.mainframe.vcs.ui.FileVersionsPanel; +import com.fr.third.javax.inject.Singleton; +import com.fr.third.springframework.context.annotation.Bean; +import com.fr.third.springframework.context.annotation.ComponentScan; +import com.fr.third.springframework.context.annotation.Configuration; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.vcs.VcsOperator; +import com.fr.workspace.server.vcs.VcsOperatorImpl; +import com.fr.workspace.server.vcs.filesystem.VcsFileSystem; +import com.fr.workspace.server.vcs.git.FineGit; + + +/** + * Created by XiaXiang on 2019/4/16. + */ +@Configuration +@ComponentScan({"com.fr.workspace.server.vcs", "com.fr.design.mainframe.vcs"}) +public class VcsConfig { + @Bean + @Singleton + public FileVersionsPanel fileVersionsPanel() { + return new FileVersionsPanel(fileVersionTablePanel()); + } + + @Bean + @Singleton + public FileVersionTablePanel fileVersionTablePanel() { + return new FileVersionTablePanel(vcsOperator(), fileVersionCellEditor(), fileVersionCellRender()); + } + + @Bean + @Singleton + public FileVersionCellEditor fileVersionCellEditor() { + return new FileVersionCellEditor(fileVersionFirstRowPanel(), fileVersionRowPanel(), vcsOperator()); + } + + @Bean + @Singleton + public FileVersionFirstRowPanel fileVersionFirstRowPanel() { + return new FileVersionFirstRowPanel(); + } + + @Bean + public FileVersionRowPanel fileVersionRowPanel() { + return new FileVersionRowPanel(vcsOperator()); + } + + @Bean + @Singleton + public FileVersionCellRender fileVersionCellRender() { + return new FileVersionCellRender(fileVersionFirstRowPanel(), fileVersionRowPanel()); + } + + @Bean + @Singleton + public VcsOperator vcsOperator() { + return new VcsOperatorImpl(vcsFileSystem(), new FineGit(vcsFileSystem().getVcsHistoryPath())); + } + + @Bean + @Singleton + public VcsFileSystem vcsFileSystem() { + return new VcsFileSystem(WorkContext.getCurrent()); + } + + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsContext.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsContext.java new file mode 100644 index 0000000000..894ee95eb6 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsContext.java @@ -0,0 +1,17 @@ +package com.fr.design.mainframe.toolbar; + +import com.fr.third.springframework.context.annotation.AnnotationConfigApplicationContext; + +/** + * Created by XiaXiang on 2019/4/20. + */ +public class VcsContext extends AnnotationConfigApplicationContext { + public static final VcsContext INSTANCE = new VcsContext(); + + public static VcsContext get() { + + return INSTANCE; + } + + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_back_normal@2x.png b/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_back_normal@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..bb3fd50cdc6b295cb491b7de2023cc024aa27f3e GIT binary patch literal 804 zcmV+<1Ka$GP)Px%-bqA3R9Fe^S3QUmK@^_JKPn;y)Iziou9MT<7%x@8Baq_kP7n*NtOa|C)^e?A zB^DN5qjDYyf(jS<#d%}P$ligJlrzh^Q@*qfQ#jiLw_*v!m(@B8NMn>X`j z8B_fVg+fTB^D8&a)W@N%VVLf4AUaZ^P%7JOHoMC-&5F{16q8YFDP>B$V?!qYCDZyK zQw~E8+7e?&V@hgL!01sbmD;B@GK|z!!#JMS8vPq3MF3CRJA1?{7$4{J`FOKwe`k!Z zT2_sZ>qK8lkWQ!fce_6twrww4R$U4d1WF}B{=#+L=|m#Fvsf%{aD7t(VSxO-?YiuA zI2@X)R;zD?Ja7x53$j!SO!OZE4CB~Y#9_hv3d8N>Rg90ZgDx@FyUAGO{d zqL1V{ECVPLiHrfhhh#d*SmK~%J^K)d0N@h9GqG4SSuU4bGBC-c9sv9r;3 zyiu>$4hVVRmhu3nt#T!N5rU+L=bbO(Eu+600c{#h;t8GI$lnEEiTgdu(jgtsA9H{% z1=xKT`;+lC#=?2aTG8LA243nM)aq!XIgWFS${rcgh6{!GY>@IdQ3P_i-1b&$jn3K= z0}o$e;#{p(8{JQ}u8)*~9LQucd)C)G4>9pHQQ(cA;^3Rp-5f?!$$P#X5Cx)7!xtGl za>lZ5bmX-DrP6vJgX3y*3UB1QE4#0qgbL%LAFid1S6$UwJYZOB>%wC`EgOI0vruzX(F-5Q#60 ibqCAiG29xCMc^l{itpWEp literal 0 HcmV?d00001 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_delete.png b/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_delete.png new file mode 100755 index 0000000000000000000000000000000000000000..6fb2baac51ead86742e20545aa0a62413be50b12 GIT binary patch literal 167 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|5K|k5|2~(;g&RwlQDDH z6mGYiaof(gobd%$;YW8~2X4ulg}lLC>)IYUq%_XtS$r|Kq4RPN8^beAv5Lrm+Yvy^ O7(8A5T-G@yGywp$2|2L< literal 0 HcmV?d00001 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_delete@2x.png b/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_delete@2x.png new file mode 100755 index 0000000000000000000000000000000000000000..b98c9f4cd256d0541f89536dd00ad38266a4ac66 GIT binary patch literal 211 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}y`CZF_>`rhn_~ z_&2e7;i7A&1A-p1Eb&`WJmt=e`<`vW61^vP3Pw5}y~L^Rz-+*{c3D)+EU%jf*hJ=@ zPn1$%6au0MGvRNX?0+XmHWe_X@voV|on9;Gmynj%zgxUpNj^&=>Ch3N!x%hW{an^L HB{Ts5r8-QC literal 0 HcmV?d00001 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_edit.png b/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_edit.png new file mode 100755 index 0000000000000000000000000000000000000000..7206039bf6fe35ebdd2358e90c24ec2631653213 GIT binary patch literal 398 zcmV;90df9`P)Px$NJ&INR5%f(k}*rfKoEs@lZy!H#MUB>U@4bK0%B!z$90;{!cJ`b4e9J{L<_MH zETY}TyE0%AF$w;J6j#`YSc=JIeJM5!$0~tKGjC_#_n1k-*pd&IylvZ&5Ns&VwB~u% z`druDDof)l&!68LPfr>fm>OlDR>yJnt7<;wym~=@x4CNrs8OW>Z`8H8$DPi(Hjy4p zivOzb`zu0-2YA*w=abQBcrN{&0*a!zz=}J73&ZFg1wl}E4#4QgfKLE_GbRp_B>C+3 zZP6(JUuGNdWn<=?on~3~CP7*MT*33aHDHg}eHHLknx?lBqE#7y9ksHo?f_eWUoFcz zqY%}~fbn>`2Y3ME2X;RU!|;bfR4W5GpKrnx>AE(+=ral|YUPh)n&wR$$JdKy)mb?K s;7Vmy_1X#WvYzPoRhdaIB6>Ob3o|xqE87|UtN;K207*qoM6N<$g8jFzrT_o{ literal 0 HcmV?d00001 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_edit@2x.png b/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_edit@2x.png new file mode 100755 index 0000000000000000000000000000000000000000..5993e438970be9f2f8f200920bbcdd8dd815b9ac GIT binary patch literal 730 zcmV<00ww*4P)Px%lu1NER9Fe+R?lk_K^UEhY1&94;=zkWnhFYfu$avzA(wblyjcT+dJv?do;(N& zJ@g=WQ1DjJg9U#f#Cj9F88DEz*%kZ;!U}rvphAP%G|Bk3GIVA)Zg#d?1YHQ00#LQ$Y(_|N@EW!%Xlj096xda*=+tOcF`>t z(YsV?`xRGiJ&aU9u~^)LH~kFVZ{uW?(l29U@!49f_LJvC8<~JgrIP4&d(W}mb_)ap zO39gKvuO)C$&E}vyKUbEc|k%abfML1y^?cs6o~)~-8qn7mZ8Z@(==}KTsEsQ=f`7i zH!VQd^}`stdmPZQc<=3WI&~J-Lnzic{-y+!%jKOoY?d)}Ne&FsAF&uciJ|+(bAC3o z0Fcs^mCj>;?~@7GMZ+-O%eg;Cp#^A~J`dOvGBjN@P4khQ^N&Iaz!&ZqhHgQIrp@W; zsjG5sbfhexP$*2{^ZEqP!dm({k%*sie`-h5OCY1mF?17aYdvS^cJXQqT^}%~8;!;% zo>Q?x7o(STI^Qp#>WEy)Zdlga*K#g+q$B|6{2>t<-7jP4Zi_ipUr7LV-hP3gK0cl} zFT|l-&tEcs6t)*#FX5nB#9lZ3YlGcY5|B(z==FO2YcS|wRZ6cQYH~-Sl7L`6sa5@T z0iGGakbT5KGdb+rt=5~j+QD{bhdco`H>}XTP&NLI$>vno{rmO50OTdUv!e9YMF0Q* M07*qoM6N<$f;+2M?EnA( literal 0 HcmV?d00001 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_filter@1x.png b/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_filter@1x.png new file mode 100755 index 0000000000000000000000000000000000000000..7a8ec6287b759b3aab8201425a66f71536186197 GIT binary patch literal 317 zcmV-D0mA-?P)Px#_en%SR5%f1U>In?2y=j~t*z*{Z$Hj6F#MN>iD9D|85yrCDk>PQUcLGkNS+B* z(SLqaJ|^$~|NnwtzI=gO3}=9pnwpwA|NHlUE0D>KsTC~pfti`f;nb;97h&?uFb0Tz z_Uzex85!wo3=E7RKrWi=7``zwvUr|8eeyK29uxzhhFq7Dl6nGU`y(m*&B(|Qbmq*d zeMn+pCWZkZQJ_oCOG!y<1DPPqz{JE@d*;lU`5-nrKzAlw9%$niIER7Z1ri&DiPHcS zRd_gq+kkI)Tn?AQ>4pFQIa-0~0VCSrI*DNblPx1Kbtagbo2wF|o-8#0rYAp~Rrqz` P00000NkvXXu0mjf=n8{` literal 0 HcmV?d00001 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_filter@2x.png b/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_filter@2x.png new file mode 100755 index 0000000000000000000000000000000000000000..9b3a132a7704ceb8798e1ddea5bc72025b72af0f GIT binary patch literal 537 zcmV+!0_OdRP)Px$(@8`@R9Fe^S3OI^Kp4JD(ho4*TneIeb8|?EhzeB{)WO+Z5c~@Y{s=c0ogG~q zZ9qbaZBPq>ij!y&5gZ!vqnP-l5@_oi)3l|7Cd=iX_v^`X*Y~cBMbCd%fKvkGa=D~s zz3e-Vvj}^P@(F=ioD18f(#a+jBT%4aS*s|%3|qIw-So2K*c+;oP;@;K$k`;3iR&@fptTLy$-YB)yd+andl1y8yqs zncRd_plKR;#)K6}`$^fqG5#ou!hE~M-5Ak7*-uNQa(|Uh4?Qzh?~qLnAXY{Dn8VNQ zqR9|2kpk?5neGo*nsd`Eh3*|~F9E@%Cs0HnQXomX6kdE$bBpJ b=L&rR literal 0 HcmV?d00001 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_list_disabled.png b/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_list_disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..5325682ff8ec5a050e95b95e5e2d6f0173f9297f GIT binary patch literal 289 zcmV++0p9+JP)Px#+et)0R5%f(Qo#+vFboW7E3pAv@TiJ10Z%6G1cAKRf(`gIf{SvNNl5_FkL^4A zoLp*5{Ts)_N!XV{&}uSG?nn}&HUvKtXh%KDPGFWrjB(4H5tuYsYwsi&fo)JgN-Kc) z{&19Y&h3~ZN{yuHRg-)w$t|?J&ZR+iW>)HVD>T**gFR~i0>HQ?8N~t-(#vA@+BnT4 zhml=puHO4w$(eH7sv!gHOP9n`$)#!&6}$(I;VX;|*zvSrzdH@cWf1l=& nXA|Wm((n4o1MmPx%7fD1xR9Fe^S3OU|Fc5XDl8BkDKY@WE5h@)JOU1^oWkW28p;V|D82Aa@m{C(m z$R&A~Yih?yqY5gK#pm<$eY`t6iBhH~3@`7X*ARM)VK|8ZCtEs>7fUGGN4XWq!UQHt zrQ=$zC63ec^tx8pl1HM<3`=qRdJnnV7)4hTiJVTSr#v^g=(d=nI1Ap<5E!uKQ-ByS zpU*#`mobfkVDu;z6=(x+K@=t!%et7UCk(Of`}$dW#a<)pyeI@jRpdY(n?wt2t5}hc zj+e`qMJv*>$Shjco$65&VPU-qqd8YXMbYHeR%p2s#7W)n%R7xksU%5yon>iY4^OYG z*9GP2;)8kyw}`Qf#ugRfls!|ndQrx1VG9dFEFxI1zh-ne`rkC-MsS5KoNkFm4z>`E z$&nhMs^ML*a~kuMH?BjIS548WWqMp205st`lPJT6K^l=l|FET%qn3B>lV&!=U0$`D zTz}GB+jG9jJKzaN4>hpbqRWk(Q`=yZ73^53l9^RD9|-R3BHXM)os%=zfKAdd0|%g* z>^mP0z(%#{@Hwsa0B{LF3ux+LV-S=B7-VI@=Klb=3GFQE75%8tw}|h1Z~OKLow6j! zF0$-9cSSbKhi^i3yXniKJfi8j=czL^D-3iU=>?i)>LUpByG)`31AKvW{PQbAYD-84 rEdn?!)zYbyxdfyPx%1W80eR9Fe^R?AVtFc7t4SCAVF)W9JIUugphp$H0r4mfiS*avC|gKtz2WAqg5 z&PHBgIdNu^8GO-d|NEp}D@n9(u_!v?&xjbY7De$y>e83x^%$gSS7}NDSa2F$m)wy+ zuB>2~jT8`_g3yB3b!BCwIJ_3c^^4Rh%kqNvT8KEI(UMiLktA4QE2h-Y;!9qh=h>xX zz&K6QZ*ro7fpZB#?+hE`_-46Wev%_z{b(%k2-34fBBBqprytzrkRaWy4 zJfs+s+YF>oLtV;=mM4Mh`V~BAvM?(FCs;>7_K-&@>vj8PaytvcRaN(@9CZ%i zfjgs35$iA(DAKdX7?ZY|u3_4XWNKcaImS;KF%i_x3WXK?y|40#I&k;I{tJ5Dh%Tcu z7FcbO=F}2&Ei;D4zb!2c1l}%Icd5#PyA|tUEBVAbX_<1WxMPFcb3hr zsP%f+$am_7+Z@-1jC`Hgy_-5K=kpwPF}KK0)_sE`nDD{Vnh}^9Y6Oh=IDrtVM}jd@(D*g3F)?LFN;l!wvXl= zd~0mDhv8tv*OGU!p! YzvuAEZ2qlZNB{r;07*qoM6N<$g5yvKS^xk5 literal 0 HcmV?d00001 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_revert.png b/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_revert.png new file mode 100755 index 0000000000000000000000000000000000000000..993ba3c21be88bf44ff4222996dea913ec2fcd18 GIT binary patch literal 512 zcmV+b0{{JqP)Px$x=BPqR5%f(Q$0%qK@gqfq7Xs^k)*f?F=@02DDHY1Oe0o;V0Dd_LJEI?rD!V( zq7tpFZ1ehPSV)?n7e5{lkK*c0uUiZ@jWVva+A;JTM{p$C&0P3EreixKU@d_dk7f9S;jR5 zV+v;zz`tRd1p{+$_`M7hpAVKC2M$qSCy^Knmr6y=G)pX*OoVZF3&1(!oS%N=cmhaj zbx#w+Saz;ftF20)VHj_CwG)7W8N{tIrs;Ce6NpAf4gdly5KuV9NF;J8K{A?V{sAl5 z#7c7XPIA4ksO$P5WBipKors+Z7@M2se0JqGN^~8>m8oN%0D!$9gpH5X|L9aeeMV}E z%IhWJVp1-rdj&EH5}Va(eZ7}}i)p$XAd`S)S#4Dvtz-L+RW*LyXjso*2{D$Q!0TS& z(`5^V+dIN^1Sn}Vo+`1J8pjqLscP&clbOG-R4O*@QQ5&@C`)8C+c|n-m)2=`R_=ZR zbWP&q@VjGWcl}!{e-a=9nZ&m3McJyKekS*TzlV28HKtif9xTiN0000h literal 0 HcmV?d00001 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_revert@2x.png b/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_revert@2x.png new file mode 100755 index 0000000000000000000000000000000000000000..5f26df54c089c8ed1dc901ba9febdc7e478de6f5 GIT binary patch literal 971 zcmV;+12p`JP)Px&g-Jv~R9Fe^R?kaRK^&iXyH?t>ALt=FNFd}TBY3+StklcYONYYx2MmIc0+Hy_ zp;Lz>s7qcvc#o32X6Z&=bay)x2nDs^!3u;dx2)WK)93qkp3b~|tE)aDsDZaL^PSIp zzMuWRH{ba(_OG`{Pykw6TRR#W8ZIOfiS+F3Y#|5}mMt1Y}5W9UWc09pY{w73q zG3GGzS_A$t40uFmp}=liR(v8FHLg!jPiHh>z=Q|bm}SLW7n~bcLD~cd{R-|UguQ_M zC8F`E7yxk)>n#vwqpy-!ip-E{?(R<}lX+DCnh^mjZpvp@X9SV! zk!zE+wPtrvBq|c1IB+0lIGs*kR&0SoIOp+r{0^cqKmbJWemb4H;s+akg9K-T?64Ui zJY8l@GsB@srBc_>kJ17J^&v8r2EwGwDcET<_N&`4geK5&xWm|vCw`K0a}t5?;v!>< zCxEHX=bb_H+8+pf1?330YDfO)N969({z$}VR`Z1R54Y-IqkTf`8v$m8aE`;ysrWx4 zAd`9e1+U|I(Xl`>TWgvC+qR>YWqap$4He2ryplAHDxD@Em-_~lxp^F)V=5?&F-|4j z7jzmZYpym;02Ys8r3&v!`%+iYAq?nbs5F`YEV?Rz(NwA%wmMcgKd2m<04&VO#TFG5 z&X`klsd+x!iBA9@Co9gZO&5!c2;qmg@On=csfs>4TAu)COfFQ>t>%HY+ex-|iD29;=m#FP=2mU49K zogyLFJc>)Cx6;?K?Sh1ywzs$MUtaz}6|pM<{Q`=STXeBdZYPYtg;tVz#1sjn=X(fe zA8cNjv0kTGpe$)_&n)KZA4_; tlr2;E9D;;I=8U0cd{d6&zx}U^z;9PYWN{fEZVvze002ovPDHLkV1i86vVZ^p literal 0 HcmV?d00001 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_save_disabled.png b/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_save_disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..3e164a0ebfa62379c3d4392bba542b157f48a353 GIT binary patch literal 467 zcmV;^0WAKBP)Px$jY&j7R5%fJQ$0_^Fc6L7rmDo&B2dZ10(0wxw4?)U6@oFpl!ZUg50s>1q%t8P zbwHGjr6n;Xd!NJ*jmDaEiRy#Rrfk}08On*4Jx@XwG` zG^_$4uI|x^l$|wWI{`tZD-F~(lx!54X8R?IW^3IwMEa10c%Nmv3&-)RJ&;g|pWs83 zH;JwtXXKYo15Hr@T}RP!hL7Snw>{041pqM8FbwCIBnk2+0aQjz3eWRS$#1fpKs49y z+n1Ax|C%I8N_gGkR&+W?ceZ`bHk-G@CBlqQ0AiXKB`SQXeCs#fV??9{RyhNJGKsjh ztU901xh&+owM8e4WedXL0|Q4GY-52m{qDK$_&Sc`4Px&SV=@dR9FeESHDl&Kos`bAu2*3q5cwziqr+R4#cTR+aXJb4*hF8bm)?yZE%w? zu$8q6Qc+P=5TYu??tK@&%lUlg#E2Vw_ul*7_ul>R^H~J4?d^5mqgSmUNR6N(iW+Cr z>CMCN78pRlSR_gE^!hq`3E}W?_@O`ucjeM<_Z|U(*1#jrFT2u;VGw|Wks!C*`w3-5 z!2nd|`Sb~ZY&uUWR3=iO!+b!5)eFcPZ5YF_c|00@`L42t-lop7e>-vfI?zi)X8;KX zNHfH7yqo9I<2=tcH#XKjo}XVTAI*?uVrM)~KSSH^_ixCk0Z?E`L2o9lLjX`%VkpqM z-R|ma&)M-C?MCnphH>%=X?!JiNH+RzW{K;cqqP zFh4f+P68ZRlocFdf>~}*dZxZ{}=r`ozAQ2G*H)T>ew$`Nk9N1IwF95&w;H@aNw6t0N_PQl!JG@GY219 ztpwoUOTry|_E!TxU#pz}h-OK23)@lLbIg2kaBwYs2mv-50<_!7oAve81O8U@dcDTQ z#nryFZJOAs@tqR@DSmq756?Tkru_M-3TWF(Td=YcepBB`8+p$%Vj!0OoT6+to8o9N z7+l?RtV%ld+bs{(i#m7QN=APx&MoC0LR9FeUS50pdF%Y$rN)bhZVTp;C8Z4(;xK*Nb! z`5i4iaA+dIzev;rDhPJz%}rOd7| zYU|;~`u(5ZZ!Ezn5W3e%8r!h$??0N2QrjtD0883Qo@Az8I13PLdH*)u_Ut(d)OcI7X0XA9k<8B!x2yJ-EMKeNQ>*|ig z77DPZxd_NDY=be=t0)10gh-GKj9i11`rekY2zdtHD-cK-J%CX&I)q%Cn3>cDehVPVvRpFuzmqBi(nh0!UoAG(?-n&B61hlo~eWL6$np& zLlc-}ud0H7UxN}s0iZ)UY+fWAu_`H+H)*NhwWR{=X z!vYu-VEZD$#=>ZG2}XcH26Gfbkh!)l6u_t?v0#Qx9d8>Y03_O0Y4X~o5qN0dkh(MN zkHuMBHjaZkR7#8c7(JH{c!=g4ofnuBThl4F-&~0g1#o+DAta8!B&^z&@2Cu9jc2^7 zBPkpTE~HDZW0!bc1cFl(ozFrJl-7lxaY`UIc?Nl8L?ET_0f{uAvA@_Vfw$M5F(T9+oiMmM_rOyvG?(On##o5`n^$;1FwNoqMK^^n_c^7sd0DH~_FlZ+{2$KUg!s4n16l6&O>mNh i4a|7&)nVgOBK`u<#<7~O`jOE90000Px$GD$>1R5%f(QZY`$KoH#ZAv#y22t<5<3eefeQs561enXH@gh0v*cmXL>hnhct zMB$JUOFV!yh!?%xLd!0seW^Z~8pXH{&?o?{;^$`~B>_EK9SD zi_5??O;3%fCfw_M_urI?21QZa`TW2@>nsKMd?X@gIz%*xkj?nCO`>*D=N}_qY;lWK z6^wj-U_gX>K1phxAm{}KOnw%DABmv!vA_T^y7fs?BhplIiOxe=aItuO>GgKDI6V?l z9dSILKi#+(fHMI<6edY>&7%%{B0u9<-6QAcoI-0oX7Ml-w-GzZ>_U*nfS2c(m*-v@ zt0FJe2`|-yPx%R!KxbR9Fe^R!vJAK^UHQx4P2g4+KTg7J|}?vI!yxJyb7hp@kfB=x@;eg67WKoL!Rm2%plm4O^yD87qNKB8rk3OEx1npnhFQj^l;&>^!@ z5=8;U-`k1{sOSyDD}gaSpwWQu&o3d-tmMgdIG4-KlWRpLFd6^|S7ktwG3QrCtkD3j z`o~E`qrLo5G*%-E18i7@*=2AsdZtbr17{`@eI1Ng3j_RzUZ8gcz>GB-NT<`Ea4P@w zmQt$%lS-w^Y9*R+qoEo#o6T+}Gxi(5ZsUrU(E!f+-rmoBIY*6+1_bEh;=DFGIyR0b zto8#u4?fgt)i;!2JZF3bw*b!@+Q4Z&zKwNv(c^jEYh68_w=&@S`C<@U9^sCdjT6LU z(GvvSLxG9csJQ1|T__ZWPfr_P5V%5tEpp$drY2vO%jK@FS33ixQpssF8Xx-*7n&=A zLvZN~Xcu9--Fb(n;42+4L4KxQuV-4V);9`6zJh!{zlz7H)ei+lO66SFS;PMW#RNGu zDE^ir=_jY-R1Dzx{}hF$`w`P%r*F6;WyJvJ;fqMe00W9!F@U?+!T>cRR1~*j05_7G zfBgt{AOXewKxKx{=v4c8s{QsE{H#O!?)%PvGy~U4F0n&rxXWMw0000Px#@JU2LR5%f1U?2e)8=FobK{-gNiHW&CT#K=>$tySq#xOB4{S9Md(59xQB^ZJr z0iaV>0wt}GC7F;pzP{d(|Ni~og)BxRHqZx`u^RpV|9?iHpMPMLG&W9S1xkKEmqhZ# z`IU@}436juQ1~V$W^;kz;DREE&H)Bild-W`6uLO=_{_u@4RV&WwDc}XNtwIPpFhPO zhUf-0G&C@QJPi!GFZevph^`UD2imxff#JUmFj(EsoH=tIn;MuHQar$fK(t{v0|Vp! z|Nj~Gp(j6NRRr0Pq+vP%lsr)K2tl1#6ac+dj585pQBSlG0GR4KwR%9HR{#J207*qo IM6N<$f_N2tQvd(} literal 0 HcmV?d00001 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/vcs_list.png b/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/vcs_list.png new file mode 100644 index 0000000000000000000000000000000000000000..df6cd02de67c069a372e1342661652a8c9673956 GIT binary patch literal 286 zcmV+(0pb3MP)Px#*hxe|R5%f(Qtc7KAPfbsW9Sq_ox!??Lv;|H!IMs*dte_nxfn|2PW~kCgFph# z)mI3VMEwH7RuiKAlf`0dL9jDNy_E%U8wM$*E$1A;iNSmSVu2$#4}em-0)!YJJ2tjO zqGPX}Aso&b6VYk4zg2N6AzkS5Iu}Fr4ogR9uJhjYnm~DQd`un`14MK+Sq42gtt0){&T49(8_T?t=RJO_5M$2~~aNTjdU#-}JWy~$+B~QMA7BFG^`?QXH9-_QN k{;t1ffX|1*w%FhJ4RGa2%S^h7EC2ui07*qoM6N<$f~l)@dH?_b literal 0 HcmV?d00001 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/vcs_save.png b/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/vcs_save.png new file mode 100644 index 0000000000000000000000000000000000000000..6783204cf8800adc44c61a2db6df8439de8cf429 GIT binary patch literal 453 zcmV;$0XqJPP)Px$e@R3^R5%fJQ$0_^Kn%4@Bo?N2Mgq0JgS0C!@<*stB#`<+14~o&k1&^&hTlN| ziMgFvkVp?dC%&R2J*n~e`T3pCz7olrP2U{rhiRo7pbdO^QmJWuUo^#oY5%%7~2oyi27v8Dar~+{7MR0W3>i3T~HC%=8Dt^Cz z*48JTE_!4F)-Myla4|plEd3jd+AZS(tMu`I5Clnv(FLJ$+_%w4g-uXN5FB(3$G)g8 zF${K}Kqx1z`gf-Z67j jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + jt.stopEditing(); + MutilTempalteTabPane.getInstance().setIsCloseCurrent(true); + MutilTempalteTabPane.getInstance().closeFormat(jt); + MutilTempalteTabPane.getInstance().closeSpecifiedTemplate(jt); + //再打开cache中的模板 + DesignerContext.getDesignerFrame().openTemplate(new VcsCacheFileNodeFileProxy(new FileNode(fileOfVersion, false))); + + } + + double height = editor.getPreferredSize().getHeight(); + if (table.getRowHeight(row) != height) { + table.setRowHeight(row, (int) height); + } + return editor; + } + + @Override + public Object getCellEditorValue() { + return renderAndEditor.getFileVersion(); + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellRender.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellRender.java new file mode 100644 index 0000000000..78e75bdf55 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellRender.java @@ -0,0 +1,43 @@ +package com.fr.design.mainframe.vcs.ui; + +import com.fr.report.entity.VcsEntity; + +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.table.TableCellRenderer; +import java.awt.Component; + +import static com.fr.design.constants.UIConstants.TREE_BACKGROUND; +import static com.fr.workspace.server.vcs.common.Constants.TABLE_SELECT_BACKGROUND; + + +public class FileVersionCellRender implements TableCellRenderer { + + //第一行 + private final JPanel firstRowPanel; + //其余行 + private final FileVersionRowPanel render; + + public FileVersionCellRender(FileVersionFirstRowPanel firstRowPanel, FileVersionRowPanel render) { + this.render = render; + this.firstRowPanel = firstRowPanel; + } + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + Component editor = row == 0 ? firstRowPanel : render; + // https://stackoverflow.com/questions/3054775/jtable-strange-behavior-from-getaccessiblechild-method-resulting-in-null-point + if (value != null) { + render.update((VcsEntity) value); + } + editor.setBackground(isSelected ? TABLE_SELECT_BACKGROUND : TREE_BACKGROUND); + + double height = editor.getPreferredSize().getHeight(); + if (table.getRowHeight(row) != height) { + table.setRowHeight(row, (int) height); + } + return editor; + } + + +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java new file mode 100644 index 0000000000..e674f3ced0 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java @@ -0,0 +1,77 @@ +package com.fr.design.mainframe.vcs.ui; + +import com.fr.design.dialog.UIDialog; +import com.fr.design.editor.editor.DateEditor; +import com.fr.design.gui.date.UIDatePicker; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; + +import javax.swing.AbstractAction; +import javax.swing.Box; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Date; + +import static com.fr.workspace.server.vcs.common.Constants.EMPTY_BORDER; +import static com.fr.workspace.server.vcs.common.Constants.EMPTY_BORDER_BOTTOM; + + +public class FileVersionDialog extends UIDialog { + private UIButton okBtn = new UIButton("确定"); + private UIButton cancelBtn = new UIButton("取消"); + + + public FileVersionDialog(Frame frame) { + super(frame); + setUndecorated(true); + JPanel panel = new JPanel(new BorderLayout()); + Box box0 = Box.createHorizontalBox(); + box0.setBorder(EMPTY_BORDER_BOTTOM); + box0.add(new UILabel("生成日期")); + box0.add(Box.createHorizontalGlue()); + box0.add(new DateEditor(new Date(), true, "生成日期", UIDatePicker.STYLE_CN_DATE1)); + Box box1 = Box.createHorizontalBox(); + box1.setBorder(EMPTY_BORDER_BOTTOM); + box1.add(new UILabel("备注关键词 ")); + box1.add(new UITextField()); + Box box2 = Box.createHorizontalBox(); + box2.add(Box.createHorizontalGlue()); + box2.setBorder(EMPTY_BORDER); + box2.add(okBtn); + box2.add(cancelBtn); + okBtn.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + FileVersionDialog.this.setVisible(false); + } + }); + cancelBtn.addActionListener(new AbstractAction() { + @Override + public void actionPerformed(ActionEvent e) { + FileVersionDialog.this.setVisible(false); + } + }); + panel.add(box0, BorderLayout.NORTH); + panel.add(box1, BorderLayout.CENTER); + panel.add(box2, BorderLayout.SOUTH); + add(panel); + setSize(new Dimension(220, 100)); + centerWindow(this); + } + + private void centerWindow(Window window) { + window.setLocation(0, 95); + + } + + @Override + public void checkValid() throws Exception { + + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionFirstRowPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionFirstRowPanel.java new file mode 100644 index 0000000000..8200f14275 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionFirstRowPanel.java @@ -0,0 +1,20 @@ +package com.fr.design.mainframe.vcs.ui; + +import com.fr.design.gui.ilable.UILabel; + +import javax.swing.Box; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import java.awt.BorderLayout; + + +public class FileVersionFirstRowPanel extends JPanel { + + public FileVersionFirstRowPanel() { + super(new BorderLayout()); + Box upPane = Box.createVerticalBox(); + upPane.setBorder(new EmptyBorder(5, 10, 5, 10)); + upPane.add(new UILabel("本地用户")); + add(upPane, BorderLayout.CENTER); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java new file mode 100644 index 0000000000..712dcf4b10 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java @@ -0,0 +1,148 @@ +package com.fr.design.mainframe.vcs.ui; + +import com.fr.design.gui.frpane.UITextPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.toolbar.VcsConfig; +import com.fr.log.FineLoggerFactory; +import com.fr.report.entity.VcsEntity; +import com.fr.stable.StringUtils; +import com.fr.third.springframework.context.annotation.AnnotationConfigApplicationContext; +import com.fr.workspace.server.vcs.VcsOperator; +import com.fr.workspace.server.vcs.common.Constants; + +import javax.swing.Box; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import javax.swing.text.BadLocationException; +import javax.swing.text.Style; +import javax.swing.text.StyleConstants; +import javax.swing.text.StyledDocument; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.text.SimpleDateFormat; +import java.util.Date; + + +public class FileVersionRowPanel extends JPanel { + + private final VcsOperator vcs; + private VcsEntity fileVersion; + private UILabel versionLabel = new UILabel(); + private UILabel usernameLabel = new UILabel("", Constants.VCS_USER_PNG, SwingConstants.LEFT); + private UITextPane timeAndMsgLabel = new UITextPane(); + private UILabel timeLabel = new UILabel(); + + + @SuppressWarnings("unchecked") + public FileVersionRowPanel(final VcsOperator vcsOperator) { + this.vcs = vcsOperator; + setLayout(new BorderLayout()); + + // version + username + Box upPane = Box.createHorizontalBox(); + upPane.setBorder(Constants.EMPTY_BORDER); + upPane.add(versionLabel); + upPane.add(Box.createHorizontalGlue()); + + + // msg + timeAndMsgLabel.setBorder(Constants.EMPTY_BORDER); + timeAndMsgLabel.setOpaque(false); + timeAndMsgLabel.setBackground(new Color(0, 0, 0, 0)); + timeAndMsgLabel.setEditable(false); + + // confirm + delete + UIButton confirmBtn = new UIButton(Constants.VCS_REVERT); + confirmBtn.set4ToolbarButton(); + confirmBtn.setToolTipText(Toolkit.i18nText("Plugin-VCS_Version_Revert")); + confirmBtn.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent evt) { + if (JOptionPane.showConfirmDialog(null, Toolkit.i18nText("Plugin-VCS_Version_Revert_Confirm"), Toolkit.i18nText("Plugin-VCS_Version_Revert_Title"), + JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { + try { + vcs.rollbackTo(fileVersion); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage()); + } + AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(VcsConfig.class); + context.getBean(FileVersionsPanel.class).exitVcs(fileVersion.getFilename()); + } + } + }); + UIButton deleteBtn = new UIButton(Constants.VCS_DELETE_PNG); + deleteBtn.set4ToolbarButton(); + deleteBtn.setToolTipText(Toolkit.i18nText("Plugin-VCS_Version_Delete")); + deleteBtn.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent evt) { + if (JOptionPane.showConfirmDialog(null, Toolkit.i18nText("Plugin-VCS_Version_Delete_Confirm"), Toolkit.i18nText("FR-Designer_Remove"), + JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { + //TODO refactor + try { + vcs.deleteVersion(fileVersion.getFilename(), fileVersion.getVersion()); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage()); + } + FileVersionTablePanel table = (FileVersionTablePanel) (FileVersionRowPanel.this.getParent()); + table.updateModel(table.getSelectedRow() - 1); + } + } + }); + UIButton editBtn = new UIButton(Constants.VCS_EDIT_PNG); + editBtn.set4ToolbarButton(); + editBtn.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + showEditDialog(); + + } + }); + upPane.add(editBtn); + upPane.add(confirmBtn); + upPane.add(deleteBtn); + Box downPane = Box.createHorizontalBox(); + downPane.add(usernameLabel); + downPane.setBorder(Constants.EMPTY_BORDER_BOTTOM); + downPane.add(Box.createHorizontalGlue()); + downPane.add(timeLabel); + add(upPane, BorderLayout.NORTH); + add(timeAndMsgLabel, BorderLayout.CENTER); + add(downPane, BorderLayout.SOUTH); + } + + private void showEditDialog() { + + } + + + public void update(final VcsEntity fileVersion) { + this.fileVersion = fileVersion; + versionLabel.setText(String.format("V.%s", fileVersion.getVersion())); + usernameLabel.setText(fileVersion.getUsername()); + timeAndMsgLabel.setText(StringUtils.EMPTY); + timeLabel.setText(timeStr(fileVersion.getTime())); + try { + StyledDocument doc = timeAndMsgLabel.getStyledDocument(); + Style style = timeAndMsgLabel.getLogicalStyle(); + StyleConstants.setForeground(style, Color.BLACK); + doc.insertString(doc.getLength(), " " + fileVersion.getCommitMsg(), style); + } catch (BadLocationException e) { + FineLoggerFactory.getLogger().error(e.getMessage()); + } + } + + private String timeStr(Date time) { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return simpleDateFormat.format(time); + } + + public VcsEntity getFileVersion() { + return fileVersion; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionTablePanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionTablePanel.java new file mode 100644 index 0000000000..45b52b9ba1 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionTablePanel.java @@ -0,0 +1,86 @@ +package com.fr.design.mainframe.vcs.ui; + +import com.fr.design.mainframe.DesignerFrameFileDealerPane; +import com.fr.log.FineLoggerFactory; +import com.fr.report.entity.VcsEntity; +import com.fr.workspace.server.vcs.VcsOperator; + +import javax.swing.JTable; +import javax.swing.ListSelectionModel; +import javax.swing.table.AbstractTableModel; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableCellRenderer; +import java.util.ArrayList; +import java.util.List; + + +public class FileVersionTablePanel extends JTable { + + private final VcsOperator vcs; + + public FileVersionTablePanel(VcsOperator vcs, TableCellEditor tableCellEditor, TableCellRenderer tableCellRenderer) { + super(new Model(new ArrayList())); + this.vcs = vcs; + setDefaultRenderer(VcsEntity.class, tableCellRenderer); + setDefaultEditor(VcsEntity.class, tableCellEditor); + setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + setTableHeader(null); + setRowHeight(30); + } + + public void updateModel(int selectedRow) { + String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); + //TODO path "/" + List vcsEntities = null; + try { + vcsEntities = vcs.getVersions(path.replaceFirst("/", "")); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage()); + } + if (selectedRow > vcsEntities.size()) { + selectedRow = vcsEntities.size(); + } + setModel(new Model(vcsEntities)); + editCellAt(selectedRow, 0); + setRowSelectionInterval(selectedRow, selectedRow); + } + + private static class Model extends AbstractTableModel { + private List vcsEntities; + + + Model(List vcsEntities) { + this.vcsEntities = vcsEntities; + } + + public Class getColumnClass(int columnIndex) { + return VcsEntity.class; + } + + public int getColumnCount() { + return 1; + } + + public int getRowCount() { + return (vcsEntities == null) ? 0 : vcsEntities.size() + 1; + } + + public Object getValueAt(int rowIndex, int columnIndex) { + if (rowIndex == 0) { + return null; + } + return (vcsEntities == null) ? null : vcsEntities.get(rowIndex - 1); + } + + public boolean isCellEditable(int columnIndex, int rowIndex) { + return true; + } + + + public List getVcsEntities() { + return vcsEntities; + } + + + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java new file mode 100644 index 0000000000..a04ac705ad --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java @@ -0,0 +1,187 @@ +package com.fr.design.mainframe.vcs.ui; + +import com.fr.base.GraphHelper; +import com.fr.design.base.mode.DesignModeContext; +import com.fr.design.dialog.BasicPane; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.file.MutilTempalteTabPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itoolbar.UIToolbar; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.DesignerFrameFileDealerPane; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.ToolBarNewTemplatePane; +import com.fr.design.mainframe.WestRegionContainerPane; +import com.fr.design.menu.ToolBarDef; +import com.fr.file.FileNodeFILE; +import com.fr.file.filetree.FileNode; +import com.fr.stable.StableUtils; +import com.fr.stable.project.ProjectConstants; +import com.fr.workspace.server.vcs.common.Constants; + +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + + +public class FileVersionsPanel extends BasicPane { + private static final String ELLIPSIS = "..."; + + private final FileVersionTablePanel fileVersionsTablePane; + private UILabel titleLabel; + private String templatePath; + private UIButton filterBtn; + private FileVersionDialog versionDialog; + + + public FileVersionsPanel(FileVersionTablePanel fileVersionTablePanel) { + this.fileVersionsTablePane = fileVersionTablePanel; + initComponents(); + } + + private void initComponents() { + setLayout(new BorderLayout()); + UIToolbar toolbar = ToolBarDef.createJToolBar(); + toolbar.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0)); + toolbar.setBorderPainted(true); + Box upPane = Box.createHorizontalBox(); + UIButton backBtn = new UIButton(Constants.VCS_BACK_PNG); + backBtn.set4ToolbarButton(); + backBtn.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + exitVcs(templatePath); + } + }); + toolbar.add(backBtn); + filterBtn = new UIButton(Constants.VCS_FILTER_PNG); + filterBtn.set4ToolbarButton(); + filterBtn.setHorizontalAlignment(SwingConstants.RIGHT); + filterBtn.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + showFilterPane(); + } + }); + titleLabel = new UILabel() { + @Override + public Dimension getMaximumSize() { + return new Dimension(257, 21); + } + }; + upPane.add(titleLabel); + upPane.add(Box.createHorizontalGlue()); + upPane.add(filterBtn); + toolbar.add(Box.createHorizontalGlue()); + toolbar.add(upPane); + add(toolbar, BorderLayout.NORTH); + + UIScrollPane jScrollPane = new UIScrollPane(fileVersionsTablePane); + add(jScrollPane, BorderLayout.CENTER); + } + + private void showFilterPane() { + versionDialog = new FileVersionDialog(DesignerContext.getDesignerFrame()); + versionDialog.setVisible(true); + } + + + /** + * 退出版本管理,并且打开模板 + * + * @param path 被管理的模板的名字 + */ + public void exitVcs(String path) { + + // 关闭当前打开的版本 + JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + MutilTempalteTabPane.getInstance().setIsCloseCurrent(true); + MutilTempalteTabPane.getInstance().closeFormat(jt); + MutilTempalteTabPane.getInstance().closeSpecifiedTemplate(jt); + + udpateDesignerFrame(true); + + final String selectedFilePath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, path); + DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(selectedFilePath, false))); + } + + private void refreshVersionTablePane() { + templatePath = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); + String[] paths = StableUtils.pathSplit(templatePath); + String filename = paths[paths.length - 1]; + int width = fileVersionsTablePane.getWidth() - 40; + if (getStringWidth(filename) > width) { + filename = getEllipsisName(filename, width); + } + titleLabel.setText(filename); + fileVersionsTablePane.updateModel(1); + } + + public void showFileVersionsPane() { + udpateDesignerFrame(false); + refreshVersionTablePane(); + } + + @Override + protected String title4PopupWindow() { + return null; + } + + + private void udpateDesignerFrame(boolean isExit) { + // 左上侧面板 + WestRegionContainerPane.getInstance().replaceUpPane( + isExit ? DesignerFrameFileDealerPane.getInstance() : this); + + DesignModeContext.switchTo(isExit ? com.fr.design.base.mode.DesignerMode.NORMAL : com.fr.design.base.mode.DesignerMode.VCS); + // MutilTempalteTabPane & NewTemplatePane 是否可点 + ToolBarNewTemplatePane.getInstance().setButtonGray(!isExit); + + JTemplate currentEditingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + if (currentEditingTemplate.isJWorkBook()) { + DesignerContext.getDesignerFrame().resetToolkitByPlus(currentEditingTemplate); + } + } + + + private int getStringWidth(String str) { + return GraphHelper.getFontMetrics(this.getFont()).stringWidth(str); + } + + + private String getEllipsisName(String name, int maxStringlength) { + + //若是名字长度大于能显示的长度,那能显示的文字的最大长度还要减去省略号的最大长度 +// int maxellipsislength = maxStringlength - ELLIPSIS.length(); + int ellipsisWidth = getStringWidth(ELLIPSIS); + int leftkeyPoint = 0; + int rightKeyPoint = name.length() - 1; + int leftStrWidth = 0; + int rightStrWidth = 0; + while (leftStrWidth + rightStrWidth + ellipsisWidth < maxStringlength) { + if (leftStrWidth <= rightStrWidth) { + leftkeyPoint++; + } else { + rightKeyPoint--; + } + leftStrWidth = getStringWidth(name.substring(0, leftkeyPoint)); + rightStrWidth = getStringWidth(name.substring(rightKeyPoint)); + + if (leftStrWidth + rightStrWidth + ellipsisWidth > maxStringlength) { + if (leftStrWidth <= rightStrWidth) { + rightKeyPoint++; + } + break; + } + } + + return name.substring(0, leftkeyPoint) + ELLIPSIS + name.substring(rightKeyPoint); + } +} diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index d262359dda..b66ba090ca 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -12,6 +12,7 @@ import com.fr.design.actions.server.ServerConfigManagerAction; import com.fr.design.actions.server.StyleListAction; import com.fr.design.actions.server.WidgetManagerAction; import com.fr.design.constants.UIConstants; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.fun.MenuHandler; @@ -30,6 +31,9 @@ import com.fr.design.mainframe.bbs.UserInfoLabel; import com.fr.design.mainframe.bbs.UserInfoPane; import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; +import com.fr.design.mainframe.toolbar.VcsConfig; +import com.fr.design.mainframe.vcs.proxy.VcsCacheFileNodeFileProxy; +import com.fr.design.mainframe.vcs.ui.FileVersionTablePanel; import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; @@ -49,13 +53,17 @@ import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.lifecycle.LifecycleFatalError; +import com.fr.stable.project.ProjectConstants; import com.fr.stable.xml.XMLTools; import com.fr.start.fx.SplashFx; import com.fr.start.jni.SplashMac; import com.fr.start.module.StartupArgs; import com.fr.start.preload.ImagePreLoader; import com.fr.start.server.ServerTray; +import com.fr.third.springframework.context.annotation.AnnotationConfigApplicationContext; import com.fr.workspace.WorkContext; +import com.fr.workspace.server.vcs.VcsOperator; +import com.fr.workspace.server.vcs.common.Constants; import javax.swing.JComponent; import javax.swing.JOptionPane; @@ -107,7 +115,6 @@ public class Designer extends BaseDesigner { System.exit(0); return; } - RestartHelper.deleteRecordFilesWhenStart(); preloadResource(); @@ -259,7 +266,7 @@ public class Designer extends BaseDesigner { */ @Override public UIButton[] createUp() { - return new UIButton[]{createSaveButton(), createUndoButton(), createRedoButton()}; + return new UIButton[]{createSaveButton(), createUndoButton(), createRedoButton(), }; } @@ -274,11 +281,52 @@ public class Designer extends BaseDesigner { jt.stopEditing(); jt.saveTemplate(); jt.requestFocus(); + String fileName = getEditingFilename(); + AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(VcsConfig.class); + VcsOperator vcsOperator = context.getBean(VcsOperator.class); + int latestFileVersion = 0; + try { + latestFileVersion = vcsOperator.getLatestFileVersion(fileName); + + } catch (Exception e1) { + FineLoggerFactory.getLogger().error(e1.getMessage()); + } + + try { + if (jt.getEditingFILE() instanceof VcsCacheFileNodeFileProxy) { + vcsOperator.saveVersionFromCache(Constants.CURRENT_USERSNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); + context.getBean(FileVersionTablePanel.class).updateModel(1); + } else { + vcsOperator.saveVersion(Constants.CURRENT_USERSNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); + } + } catch (Exception e1) { + FineLoggerFactory.getLogger().error(e1.getMessage()); + } + + + + } }); return saveButton; } + public static String getEditingFilename() { + JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + String editingFilePath = jt.getEditingFILE().getPath(); + //TODO 如果是cache里的文件,也会走到这里,这里是找到reportlets去掉的。万一刚好cache/reportlets会出问题 + if (editingFilePath.startsWith(ProjectConstants.REPORTLETS_NAME)) { + editingFilePath = editingFilePath.replaceFirst(ProjectConstants.REPORTLETS_NAME, StringUtils.EMPTY); + } else if (editingFilePath.startsWith(Constants.VCS_CACHE_DIR)) { + editingFilePath = editingFilePath.replaceFirst(Constants.VCS_CACHE_DIR, StringUtils.EMPTY); + } + //TODO refactor 考虑直接用reportlets/xxx/x/x/x/x/x// or /xx/x/x/x/x/x + if (editingFilePath.startsWith("/")) { + editingFilePath = editingFilePath.substring(1); + } + return editingFilePath; + } + private UIButton createUndoButton() { undo = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/undo.png")); undo.setToolTipText(KeySetUtils.UNDO.getMenuKeySetName()); From a74462497d009febbba793f947a1e1e1a46ec1df Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 23 Apr 2019 12:12:21 +0800 Subject: [PATCH 02/21] =?UTF-8?q?REPORT-16391=20=E3=80=9010.03=E5=9F=8B?= =?UTF-8?q?=E7=82=B9-=E6=A8=A1=E6=9D=BF=E3=80=91=E5=B7=B2=E7=BB=8F?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E7=9A=84=E6=A8=A1=E6=9D=BF=E5=8F=A6=E5=AD=98?= =?UTF-8?q?=E4=B8=BA=EF=BC=8C=E4=B8=8D=E4=BC=9A=E6=9C=89originid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/template/info/TemplateInfo.java | 4 +++ .../template/info/TemplateInfoCollector.java | 5 +--- .../info/TemplateInfoCollectorTest.java | 28 ++++++++++++++++++- .../design/mainframe/template/info/tpl.info | 4 +-- 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfo.java b/designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfo.java index 4c45ce823e..ffd9aaf3b4 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfo.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfo.java @@ -102,6 +102,10 @@ class TemplateInfo implements XMLReadable, XMLWriter { return templateID; } + String getOriginID() { + return originID; + } + int getTimeConsume() { return (int)consumingMap.get(ATTR_TIME_CONSUME); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java index 30bfb5e1d6..c16c6b6275 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java @@ -75,11 +75,8 @@ public class TemplateInfoCollector implements XMLReadable, XMLWriter { TemplateInfo templateInfo; if (this.contains(templateID)) { templateInfo = templateInfoMap.get(templateID); - } else if (!this.contains(originID)) { - templateInfo = TemplateInfo.newInstance(templateID); - templateInfoMap.put(templateID, templateInfo); } else { - int originTime = templateInfoMap.get(originID).getTimeConsume(); + int originTime = this.contains(originID) ? templateInfoMap.get(originID).getTimeConsume() : 0; templateInfo = TemplateInfo.newInstance(templateID, originID, originTime); templateInfoMap.put(templateID, templateInfo); } diff --git a/designer-base/src/test/java/com/fr/design/mainframe/template/info/TemplateInfoCollectorTest.java b/designer-base/src/test/java/com/fr/design/mainframe/template/info/TemplateInfoCollectorTest.java index 7b02f4bba2..e83a523fc4 100644 --- a/designer-base/src/test/java/com/fr/design/mainframe/template/info/TemplateInfoCollectorTest.java +++ b/designer-base/src/test/java/com/fr/design/mainframe/template/info/TemplateInfoCollectorTest.java @@ -66,9 +66,12 @@ public class TemplateInfoCollectorTest { @Test public void testReadXML() { + assertEquals(",,", DesignerOpenHistory.getInstance().toString()); + TemplateInfoCollector collector = TemplateInfoCollector.getInstance(); - assertEquals("2019-04-18", Reflect.on(collector).field("designerOpenDate").get()); assertEquals(7, ((Map) Reflect.on(collector).field("templateInfoMap").get()).size()); + + assertEquals("2019-04-08,2019-04-03,2019-03-29", DesignerOpenHistory.getInstance().toString()); } @Test @@ -151,6 +154,29 @@ public class TemplateInfoCollectorTest { assertEquals(129, consumingMap.get("originTime")); } + @Test + public void testCollectInfoWhenSaveAsWithNoTrackOriginID() throws Exception { + setUpMockForNewInstance(); + + TemplateInfoCollector collector = TemplateInfoCollector.getInstance(); + + String templateID = "423238d4-5223-22vj-vlsj-42jc49245iw3"; + String originID = "3kha8jcs-31xw-42f5-h2ww-2ee84935312z"; + int timeConsume = 200; + + collector.collectInfo(templateID, originID, mockProcessInfo, timeConsume); + + TemplateInfo templateInfo = collector.getOrCreateTemplateInfoByID(templateID); + assertEquals(templateID, templateInfo.getTemplateID()); + assertEquals(originID, templateInfo.getOriginID()); + + Map consumingMap = Reflect.on(templateInfo).field("consumingMap").get(); + assertEquals(templateID, consumingMap.get("templateID")); + assertEquals(originID, consumingMap.get("originID")); + assertEquals(200, consumingMap.get("time_consume")); + assertEquals(0, consumingMap.get("originTime")); + } + @Test public void testAddIdleDateCount() { String templateID = "16a988ce-8529-42f5-b17c-2ee849355071"; diff --git a/designer-base/src/test/resources/com/fr/design/mainframe/template/info/tpl.info b/designer-base/src/test/resources/com/fr/design/mainframe/template/info/tpl.info index 39bec00067..eae77630fa 100644 --- a/designer-base/src/test/resources/com/fr/design/mainframe/template/info/tpl.info +++ b/designer-base/src/test/resources/com/fr/design/mainframe/template/info/tpl.info @@ -1,7 +1,7 @@ - - + + From 86d7b2b264f0c65c433dc4ded8b6fca8dd57dfbd Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 Apr 2019 12:15:35 +0800 Subject: [PATCH 03/21] =?UTF-8?q?REPORT-14835=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E7=AE=A1=E7=90=86=E4=BC=98=E5=8C=96=E5=8F=8A?= =?UTF-8?q?=E5=86=85=E7=BD=AE=20=E4=BB=A3=E7=A0=81=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/toolbar/VcsConfig.java | 74 ---------- .../mainframe/vcs/common/Constants.java | 47 +++++++ ...leProxy.java => VcsCacheFileNodeFile.java} | 6 +- .../vcs/ui/EditFileVersionDialog.java | 131 ++++++++++++++++++ ...nTablePanel.java => FileVersionTable.java} | 1 - 5 files changed, 180 insertions(+), 79 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsConfig.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/vcs/common/Constants.java rename designer-base/src/main/java/com/fr/design/mainframe/vcs/proxy/{VcsCacheFileNodeFileProxy.java => VcsCacheFileNodeFile.java} (95%) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java rename designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/{FileVersionTablePanel.java => FileVersionTable.java} (99%) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsConfig.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsConfig.java deleted file mode 100644 index 8364f546f0..0000000000 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsConfig.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.fr.design.mainframe.toolbar; - -import com.fr.design.mainframe.vcs.ui.FileVersionCellEditor; -import com.fr.design.mainframe.vcs.ui.FileVersionCellRender; -import com.fr.design.mainframe.vcs.ui.FileVersionFirstRowPanel; -import com.fr.design.mainframe.vcs.ui.FileVersionRowPanel; -import com.fr.design.mainframe.vcs.ui.FileVersionTablePanel; -import com.fr.design.mainframe.vcs.ui.FileVersionsPanel; -import com.fr.third.javax.inject.Singleton; -import com.fr.third.springframework.context.annotation.Bean; -import com.fr.third.springframework.context.annotation.ComponentScan; -import com.fr.third.springframework.context.annotation.Configuration; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.vcs.VcsOperator; -import com.fr.workspace.server.vcs.VcsOperatorImpl; -import com.fr.workspace.server.vcs.filesystem.VcsFileSystem; -import com.fr.workspace.server.vcs.git.FineGit; - - -/** - * Created by XiaXiang on 2019/4/16. - */ -@Configuration -@ComponentScan({"com.fr.workspace.server.vcs", "com.fr.design.mainframe.vcs"}) -public class VcsConfig { - @Bean - @Singleton - public FileVersionsPanel fileVersionsPanel() { - return new FileVersionsPanel(fileVersionTablePanel()); - } - - @Bean - @Singleton - public FileVersionTablePanel fileVersionTablePanel() { - return new FileVersionTablePanel(vcsOperator(), fileVersionCellEditor(), fileVersionCellRender()); - } - - @Bean - @Singleton - public FileVersionCellEditor fileVersionCellEditor() { - return new FileVersionCellEditor(fileVersionFirstRowPanel(), fileVersionRowPanel(), vcsOperator()); - } - - @Bean - @Singleton - public FileVersionFirstRowPanel fileVersionFirstRowPanel() { - return new FileVersionFirstRowPanel(); - } - - @Bean - public FileVersionRowPanel fileVersionRowPanel() { - return new FileVersionRowPanel(vcsOperator()); - } - - @Bean - @Singleton - public FileVersionCellRender fileVersionCellRender() { - return new FileVersionCellRender(fileVersionFirstRowPanel(), fileVersionRowPanel()); - } - - @Bean - @Singleton - public VcsOperator vcsOperator() { - return new VcsOperatorImpl(vcsFileSystem(), new FineGit(vcsFileSystem().getVcsHistoryPath())); - } - - @Bean - @Singleton - public VcsFileSystem vcsFileSystem() { - return new VcsFileSystem(WorkContext.getCurrent()); - } - - -} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/Constants.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/Constants.java new file mode 100644 index 0000000000..de5f54d55d --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/Constants.java @@ -0,0 +1,47 @@ +package com.fr.workspace.server.vcs.common; + +import com.fr.base.BaseUtils; +import com.fr.locale.InterProviderFactory; +import com.fr.workspace.WorkContext; + +import javax.swing.Icon; +import javax.swing.border.EmptyBorder; +import java.awt.Color; + +import static com.fr.stable.StableUtils.pathJoin; + + +public class Constants { + + public final static String VCS_DIR = "vcs"; + + // 如果用其他方式实现vcs,未必需要这个cache + //TODO 要不要放到其他地方 + public final static String VCS_CACHE_DIR = pathJoin(VCS_DIR, "cache"); + + public final static String CURRENT_USERSNAME = WorkContext.getCurrent().isLocal() + ? InterProviderFactory.getProvider().getLocText("本地用户") + : WorkContext.getCurrent().getConnection().getUserName(); + + public final static Color TABLE_SELECT_BACKGROUND = new Color(0xD8F2FD); + + public final static Color COPY_VERSION_BTN_COLOR = new Color(0x419BF9); + + public final static Color DELETE_VERSION_BTN_COLOR = new Color(0xEB1D1F); + + public final static EmptyBorder EMPTY_BORDER = new EmptyBorder(5, 10, 0, 10); + + public final static EmptyBorder EMPTY_BORDER_BOTTOM = new EmptyBorder(10, 10, 10, 10); + + + public final static Icon VCS_LIST_PNG = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/vcs_list.png"); + public final static Icon VCS_BACK_PNG = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/vcs_back.png"); + public final static Icon VCS_SAVE_PNG = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/vcs_save.png"); + public final static Icon VCS_FILTER_PNG = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_filter@1x.png"); + public final static Icon VCS_EDIT_PNG = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_edit.png"); + public final static Icon VCS_DELETE_PNG = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_delete.png"); + public final static Icon VCS_USER_PNG = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_user@1x.png"); + public final static Icon VCS_REVERT = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_revert.png"); + + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/proxy/VcsCacheFileNodeFileProxy.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/proxy/VcsCacheFileNodeFile.java similarity index 95% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/proxy/VcsCacheFileNodeFileProxy.java rename to designer-base/src/main/java/com/fr/design/mainframe/vcs/proxy/VcsCacheFileNodeFile.java index d2665cff46..2d59a4cebc 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/proxy/VcsCacheFileNodeFileProxy.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/proxy/VcsCacheFileNodeFile.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.vcs.proxy; import com.fr.base.io.XMLEncryptUtils; +import com.fr.design.mainframe.vcs.common.Constants; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; @@ -8,14 +9,11 @@ import com.fr.stable.StableUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.resource.WorkResource; import com.fr.workspace.resource.WorkResourceOutputStream; -import com.fr.workspace.server.vcs.common.Constants; import java.io.InputStream; import java.io.OutputStream; -/** - * Created by hzzz on 2017/12/21. - */ + public class VcsCacheFileNodeFileProxy extends FileNodeFILE { private final FileNode node; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java new file mode 100644 index 0000000000..b05d2ad9d4 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java @@ -0,0 +1,131 @@ +package com.fr.plugin.vcs.ui; + +import com.fr.design.dialog.UIDialog; +import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextarea.UITextArea; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.Inter; +import com.fr.plugin.vcs.Vcs; +import com.fr.plugin.vcs.common.proxy.VcsCacheFileNodeFileProxy; +import com.fr.stable.StringUtils; +import com.fr.third.guava.base.Preconditions; +import com.google.inject.Inject; + +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import static com.fr.plugin.vcs.common.CommonUtils.editingFilename; +import static com.fr.plugin.vcs.common.Constants.CURRENT_USERSNAME; + +/** + * 保存保本时候弹出的对话框,输入commit msg,点确定保存版本 + * Created by hzzz on 2017/12/11. + */ +public class SaveFileVersionDialog extends UIDialog { + + private final UITextArea msgTestArea = new UITextArea(); + private final UILabel versionLabel = new UILabel(); + private Vcs vcs; + private FileVersionTablePanel fileVersionTablePanel; + + @Inject + public SaveFileVersionDialog(FileVersionTablePanel fileVersionTablePanel, Vcs vcs) { + this(DesignerContext.getDesignerFrame()); + this.vcs = Preconditions.checkNotNull(vcs, "vcs is null"); + this.fileVersionTablePanel = Preconditions.checkNotNull(fileVersionTablePanel, "fileVersionTablePanel is null"); + } + + private SaveFileVersionDialog(Frame parent) { + super(parent); + + initComponents(); + setModal(true); + setTitle(Inter.getLocText("Plugin-VCS_Save_Version")); + setSize(300, 220); + setResizable(false); + GUICoreUtils.centerWindow(this); + + } + + private void initComponents() { + + JPanel fontPane = new JPanel(new BorderLayout()); + fontPane.add(new UILabel(" " + Inter.getLocText("Plugin-VCS_Version_Message") + ":"), BorderLayout.NORTH); + + msgTestArea.setBorder(null); + JScrollPane jScrollPane = new UIScrollPane(msgTestArea); + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(" " + Inter.getLocText("Plugin-VCS_Version_Number") + ":"), versionLabel}, + new Component[]{fontPane, jScrollPane} + }; + double[] rowSizes = new double[]{25, 100}; + double[] columnSizes = new double[]{70, 200}; + + add(TableLayoutHelper.createTableLayoutPane(components, rowSizes, columnSizes), BorderLayout.CENTER); + + JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + add(buttonPane, BorderLayout.SOUTH); + + UIButton ok = new UIButton(Inter.getLocText("OK")); + UIButton cancel = new UIButton(Inter.getLocText("Cancel")); + + buttonPane.add(ok); + buttonPane.add(cancel); + + ok.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + jt.stopEditing(); + jt.saveTemplate(); + String filename = editingFilename(); + String versionLabelText = versionLabel.getText(); + // V.3 -> 3 + String version = versionLabelText.substring(2); + //TODO refactor + if (jt.getEditingFILE() instanceof VcsCacheFileNodeFileProxy) { + vcs.saveVersionFromCache(CURRENT_USERSNAME, filename, msgTestArea.getText(), Integer.parseInt(version)); + fileVersionTablePanel.updateModel(1); + } else { + vcs.saveVersion(CURRENT_USERSNAME, filename, msgTestArea.getText(), Integer.parseInt(version)); + } + jt.requestFocus(); + doOK(); + } + }); + + cancel.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + doCancel(); + } + }); + } + + private void refresh() { + int latestFileVersion = vcs.getLatestFileVersion(editingFilename()); + versionLabel.setText("V." + String.valueOf(latestFileVersion + 1)); + msgTestArea.setText(StringUtils.EMPTY); + } + + public void showMsgInputDialog() { + refresh(); + setVisible(true); + } + + @Override + public void checkValid() throws Exception { + + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionTablePanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionTable.java similarity index 99% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionTablePanel.java rename to designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionTable.java index 45b52b9ba1..a833edc733 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionTablePanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionTable.java @@ -30,7 +30,6 @@ public class FileVersionTablePanel extends JTable { public void updateModel(int selectedRow) { String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); - //TODO path "/" List vcsEntities = null; try { vcsEntities = vcs.getVersions(path.replaceFirst("/", "")); From c446292250e212e8d816d47e7f038a8d48735d1d Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 Apr 2019 12:17:51 +0800 Subject: [PATCH 04/21] =?UTF-8?q?REPORT-14835=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E7=AE=A1=E7=90=86=E4=BC=98=E5=8C=96=E5=8F=8A?= =?UTF-8?q?=E5=86=85=E7=BD=AE=20=E4=BB=A3=E7=A0=81=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignerEnvManager.java | 36 +++++++++ .../design/actions/file/PreferencePane.java | 50 ++++++++++++ .../DesignerFrameFileDealerPane.java | 10 +-- .../design/mainframe/toolbar/VcsContext.java | 17 ---- .../mainframe/vcs/common/Constants.java | 16 +--- .../vcs/proxy/VcsCacheFileNodeFile.java | 4 +- .../vcs/ui/EditFileVersionDialog.java | 79 ++++++------------- .../vcs/ui/FileVersionCellEditor.java | 23 +++--- .../vcs/ui/FileVersionCellRender.java | 8 +- .../mainframe/vcs/ui/FileVersionDialog.java | 20 ++++- .../vcs/ui/FileVersionFirstRowPanel.java | 3 +- .../mainframe/vcs/ui/FileVersionRowPanel.java | 49 ++++++------ .../mainframe/vcs/ui/FileVersionTable.java | 48 ++++++----- .../mainframe/vcs/ui/FileVersionsPanel.java | 40 +++++++--- .../src/main/java/com/fr/start/Designer.java | 28 +++---- 15 files changed, 241 insertions(+), 190 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsContext.java diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 1fb6a94a81..3628313253 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -130,6 +130,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private int westRegionContainerWidth = 240; private String encryptionKey; private String jdkHome; + private boolean vcsEnable; + private boolean saveCommit; + private int saveInterval; + + //上一次登录弹窗的时间, 为了控制一天只弹一次窗口 private String lastShowBBSTime; @@ -1341,6 +1346,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } } + private void readJettyPort(XMLableReader reader) { String tmpVal; if ((tmpVal = reader.getElementValue()) != null) { @@ -1601,6 +1607,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { this.setDragPermited(reader.getAttrAsBoolean("isDragPermited", false)); this.setUndoLimit(reader.getAttrAsInt("undoLimit", 5)); this.setDefaultStringToFormula(reader.getAttrAsBoolean("defaultStringToFormula", false)); + this.setVcsEnable(reader.getAttrAsBoolean("supportVcs", false)); + this.setSaveCommit(reader.getAttrAsBoolean("saveCommit", false)); + this.setSaveInterval(reader.getAttrAsInt("saveInterval", 60)); if ((tmpVal = reader.getAttrAsString("gridLineColor", null)) != null) { this.setGridLineColor(new Color(Integer.parseInt(tmpVal))); } @@ -1936,6 +1945,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { .attr("verticalScrollBarVisible", this.isVerticalScrollBarVisible()) .attr("horizontalScrollBarVisible", this.isHorizontalScrollBarVisible()) .attr("supportCellEditorDef", this.isSupportCellEditorDef()) + .attr("supportVcs", this.isVcsEnable()) + .attr("saveInterval", this.getSaveInterval()) + .attr("saveCommit", this.isSaveCommit()) .attr("isDragPermited", this.isDragPermited()) .attr("gridLineColor", this.getGridLineColor().getRGB()) .attr("paginationLineColor", this.getPaginationLineColor().getRGB()) @@ -1946,4 +1958,28 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private void writeDesignerPushUpdateAttr(XMLPrintWriter writer) { this.designerPushUpdateConfigManager.writeXML(writer); } + + public boolean isVcsEnable() { + return vcsEnable; + } + + public void setVcsEnable(boolean vcsEnable) { + this.vcsEnable = vcsEnable; + } + + public boolean isSaveCommit() { + return saveCommit; + } + + public void setSaveCommit(boolean saveCommit) { + this.saveCommit = saveCommit; + } + + public int getSaveInterval() { + return saveInterval; + } + + public void setSaveInterval(int saveInterval) { + this.saveInterval = saveInterval; + } } diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index aa679de9bf..5bead95da4 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -1,5 +1,6 @@ package com.fr.design.actions.file; +import com.apple.laf.AquaProgressBarUI; import com.fr.base.BaseUtils; import com.fr.config.Configuration; import com.fr.design.DesignerEnvManager; @@ -41,6 +42,8 @@ import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.KeyStroke; import javax.swing.SwingUtilities; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; @@ -135,6 +138,12 @@ public class PreferencePane extends BasicPane { private UICheckBox joinProductImproveCheckBox; private UICheckBox autoPushUpdateCheckBox; + private UICheckBox vcsEnableCheckBox; + private UICheckBox saveCommitCheckBox; + private IntegerEditor saveIntervalEditor; + + + public PreferencePane() { this.initComponents(); } @@ -155,6 +164,7 @@ public class PreferencePane extends BasicPane { createEditPane(generalPane); createGuiOfGridPane(generalPane); createColorSettingPane(generalPane); + createVcsSettingPane(generalPane); // ConfPane JPanel confLocationPane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane(); @@ -193,6 +203,36 @@ public class PreferencePane extends BasicPane { advancePane.add(spaceUpPane); } + private void createVcsSettingPane(JPanel generalPane) { + JPanel vcsPane = FRGUIPaneFactory.createVerticalTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("版本控制")); + generalPane.add(vcsPane); + vcsEnableCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("保存自动生成版本")); + saveCommitCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("备注版本不会自动清理")); + saveIntervalEditor = new IntegerEditor(30); + JPanel memorySpace = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); + UILabel label1 = new UILabel(" 每 "); + UILabel label2 = new UILabel(" 分钟每个用户同个模板最多保留一个模板"); + memorySpace.add(label1); + memorySpace.add(saveIntervalEditor); + memorySpace.add(label2); + vcsEnableCheckBox.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + boolean selected = vcsEnableCheckBox.isSelected(); + if (selected) { + saveCommitCheckBox.setEnabled(true); + saveIntervalEditor.setEnabled(true); + } else { + saveCommitCheckBox.setEnabled(false); + saveIntervalEditor.setEnabled(false); + } + } + }); + vcsPane.add(vcsEnableCheckBox); + vcsPane.add(memorySpace); + vcsPane.add(saveCommitCheckBox); + } + private void createFunctionPane(JPanel generalPane) { JPanel functionPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Function")); generalPane.add(functionPane); @@ -542,6 +582,13 @@ public class PreferencePane extends BasicPane { defaultStringToFormulaBox.setEnabled(false); defaultStringToFormulaBox.setSelected(false); } + vcsEnableCheckBox.setSelected(designerEnvManager.isVcsEnable()); + if (!vcsEnableCheckBox.isSelected()) { + saveIntervalEditor.setEnabled(false); + saveCommitCheckBox.setEnabled(false); + } + saveIntervalEditor.setValue(designerEnvManager.getSaveInterval()); + saveCommitCheckBox.setSelected(designerEnvManager.isSaveCommit()); supportCellEditorDefCheckBox.setSelected(designerEnvManager.isSupportCellEditorDef()); @@ -631,6 +678,9 @@ public class PreferencePane extends BasicPane { designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected()); designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue()); designerEnvManager.setJoinProductImprove(this.joinProductImproveCheckBox.isSelected()); + designerEnvManager.setSaveInterval(this.saveIntervalEditor.getValue()); + designerEnvManager.setVcsEnable(this.vcsEnableCheckBox.isSelected()); + designerEnvManager.setSaveCommit(this.saveCommitCheckBox.isSelected()); if (this.autoPushUpdateCheckBox != null) { designerEnvManager.setAutoPushUpdateEnabled(this.autoPushUpdateCheckBox.isSelected()); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index 48e067d36d..1627bf8442 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -26,7 +26,7 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.mainframe.toolbar.VcsConfig; +import com.fr.design.mainframe.vcs.ui.FileVersionTable; import com.fr.design.mainframe.vcs.ui.FileVersionsPanel; import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.ShortCut; @@ -49,9 +49,8 @@ import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; import com.fr.third.org.apache.commons.io.FilenameUtils; -import com.fr.third.springframework.context.annotation.AnnotationConfigApplicationContext; import com.fr.workspace.WorkContext; -import com.fr.workspace.server.vcs.common.Constants; +import com.fr.design.mainframe.vcs.common.Constants; import javax.swing.BorderFactory; import javax.swing.JDialog; @@ -287,7 +286,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt */ private class VcsAction extends UpdateAction { public VcsAction() { - this.setName(Toolkit.i18nText("Plugin-VCS_Title")); + this.setName(Toolkit.i18nText("Fine-Design_Vcs_Title")); this.setSmallIcon(Constants.VCS_LIST_PNG); } @@ -305,8 +304,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt // 如果模板已经打开了,关掉,避免出现2个同名tab(1个是模板,1个是版本) closeOpendTemplate(path, isCurrentEditing); - AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(VcsConfig.class); - FileVersionsPanel fileVersionTablePanel = context.getBean(FileVersionsPanel.class); + FileVersionsPanel fileVersionTablePanel = FileVersionsPanel.getInstance(); fileVersionTablePanel.showFileVersionsPane(); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsContext.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsContext.java deleted file mode 100644 index 894ee95eb6..0000000000 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsContext.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.fr.design.mainframe.toolbar; - -import com.fr.third.springframework.context.annotation.AnnotationConfigApplicationContext; - -/** - * Created by XiaXiang on 2019/4/20. - */ -public class VcsContext extends AnnotationConfigApplicationContext { - public static final VcsContext INSTANCE = new VcsContext(); - - public static VcsContext get() { - - return INSTANCE; - } - - -} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/Constants.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/Constants.java index de5f54d55d..bd6869a64d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/Constants.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/Constants.java @@ -1,7 +1,7 @@ -package com.fr.workspace.server.vcs.common; +package com.fr.design.mainframe.vcs.common; import com.fr.base.BaseUtils; -import com.fr.locale.InterProviderFactory; +import com.fr.design.i18n.Toolkit; import com.fr.workspace.WorkContext; import javax.swing.Icon; @@ -14,21 +14,14 @@ import static com.fr.stable.StableUtils.pathJoin; public class Constants { public final static String VCS_DIR = "vcs"; - - // 如果用其他方式实现vcs,未必需要这个cache - //TODO 要不要放到其他地方 public final static String VCS_CACHE_DIR = pathJoin(VCS_DIR, "cache"); - public final static String CURRENT_USERSNAME = WorkContext.getCurrent().isLocal() - ? InterProviderFactory.getProvider().getLocText("本地用户") + public final static String CURRENT_USERNAME = WorkContext.getCurrent().isLocal() + ? Toolkit.i18nText("Fine-Design_Vcs_Local_User") : WorkContext.getCurrent().getConnection().getUserName(); public final static Color TABLE_SELECT_BACKGROUND = new Color(0xD8F2FD); - public final static Color COPY_VERSION_BTN_COLOR = new Color(0x419BF9); - - public final static Color DELETE_VERSION_BTN_COLOR = new Color(0xEB1D1F); - public final static EmptyBorder EMPTY_BORDER = new EmptyBorder(5, 10, 0, 10); public final static EmptyBorder EMPTY_BORDER_BOTTOM = new EmptyBorder(10, 10, 10, 10); @@ -36,7 +29,6 @@ public class Constants { public final static Icon VCS_LIST_PNG = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/vcs_list.png"); public final static Icon VCS_BACK_PNG = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/vcs_back.png"); - public final static Icon VCS_SAVE_PNG = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/vcs_save.png"); public final static Icon VCS_FILTER_PNG = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_filter@1x.png"); public final static Icon VCS_EDIT_PNG = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_edit.png"); public final static Icon VCS_DELETE_PNG = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_delete.png"); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/proxy/VcsCacheFileNodeFile.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/proxy/VcsCacheFileNodeFile.java index 2d59a4cebc..193150dad7 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/proxy/VcsCacheFileNodeFile.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/proxy/VcsCacheFileNodeFile.java @@ -14,11 +14,11 @@ import java.io.InputStream; import java.io.OutputStream; -public class VcsCacheFileNodeFileProxy extends FileNodeFILE { +public class VcsCacheFileNodeFile extends FileNodeFILE { private final FileNode node; - public VcsCacheFileNodeFileProxy(FileNode node) { + public VcsCacheFileNodeFile(FileNode node) { super(node); this.node = node; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java index b05d2ad9d4..455b0dac1a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java @@ -1,24 +1,18 @@ -package com.fr.plugin.vcs.ui; +package com.fr.design.mainframe.vcs.ui; import com.fr.design.dialog.UIDialog; -import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.JTemplate; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.general.Inter; -import com.fr.plugin.vcs.Vcs; -import com.fr.plugin.vcs.common.proxy.VcsCacheFileNodeFileProxy; -import com.fr.stable.StringUtils; -import com.fr.third.guava.base.Preconditions; -import com.google.inject.Inject; +import com.fr.locale.InterProviderFactory; +import com.fr.report.ReportContext; +import com.fr.report.entity.VcsEntity; import javax.swing.JPanel; -import javax.swing.JScrollPane; import java.awt.BorderLayout; import java.awt.Component; import java.awt.FlowLayout; @@ -26,33 +20,29 @@ import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import static com.fr.plugin.vcs.common.CommonUtils.editingFilename; -import static com.fr.plugin.vcs.common.Constants.CURRENT_USERSNAME; /** - * 保存保本时候弹出的对话框,输入commit msg,点确定保存版本 - * Created by hzzz on 2017/12/11. + * 编辑版本信息面板 */ -public class SaveFileVersionDialog extends UIDialog { +public class EditFileVersionDialog extends UIDialog { private final UITextArea msgTestArea = new UITextArea(); private final UILabel versionLabel = new UILabel(); - private Vcs vcs; - private FileVersionTablePanel fileVersionTablePanel; + private VcsEntity entity; - @Inject - public SaveFileVersionDialog(FileVersionTablePanel fileVersionTablePanel, Vcs vcs) { + public EditFileVersionDialog(VcsEntity entity) { this(DesignerContext.getDesignerFrame()); - this.vcs = Preconditions.checkNotNull(vcs, "vcs is null"); - this.fileVersionTablePanel = Preconditions.checkNotNull(fileVersionTablePanel, "fileVersionTablePanel is null"); + this.entity = entity; + msgTestArea.setText(entity.getCommitMsg()); + versionLabel.setText(String.valueOf(entity.getVersion())); } - private SaveFileVersionDialog(Frame parent) { + private EditFileVersionDialog(Frame parent) { super(parent); initComponents(); setModal(true); - setTitle(Inter.getLocText("Plugin-VCS_Save_Version")); + setTitle(InterProviderFactory.getProvider().getLocText("Fine-Design_Vcs_Save_Version")); setSize(300, 220); setResizable(false); GUICoreUtils.centerWindow(this); @@ -62,14 +52,14 @@ public class SaveFileVersionDialog extends UIDialog { private void initComponents() { JPanel fontPane = new JPanel(new BorderLayout()); - fontPane.add(new UILabel(" " + Inter.getLocText("Plugin-VCS_Version_Message") + ":"), BorderLayout.NORTH); + fontPane.add(new UILabel(" " + InterProviderFactory.getProvider().getLocText("Fine-Design_Vcs_Version_Message") + ":"), BorderLayout.NORTH); msgTestArea.setBorder(null); - JScrollPane jScrollPane = new UIScrollPane(msgTestArea); + UIScrollPane scrollPane = new UIScrollPane(msgTestArea); Component[][] components = new Component[][]{ - new Component[]{new UILabel(" " + Inter.getLocText("Plugin-VCS_Version_Number") + ":"), versionLabel}, - new Component[]{fontPane, jScrollPane} + new Component[]{new UILabel(" " + InterProviderFactory.getProvider().getLocText("Fine-Design_Vcs_Version_Number") + ":"), versionLabel}, + new Component[]{fontPane, scrollPane} }; double[] rowSizes = new double[]{25, 100}; double[] columnSizes = new double[]{70, 200}; @@ -79,30 +69,18 @@ public class SaveFileVersionDialog extends UIDialog { JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT)); add(buttonPane, BorderLayout.SOUTH); - UIButton ok = new UIButton(Inter.getLocText("OK")); - UIButton cancel = new UIButton(Inter.getLocText("Cancel")); + UIButton ok = new UIButton(InterProviderFactory.getProvider().getLocText("OK")); + UIButton cancel = new UIButton(InterProviderFactory.getProvider().getLocText("Cancel")); buttonPane.add(ok); buttonPane.add(cancel); ok.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { - JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - jt.stopEditing(); - jt.saveTemplate(); - String filename = editingFilename(); - String versionLabelText = versionLabel.getText(); - // V.3 -> 3 - String version = versionLabelText.substring(2); - //TODO refactor - if (jt.getEditingFILE() instanceof VcsCacheFileNodeFileProxy) { - vcs.saveVersionFromCache(CURRENT_USERSNAME, filename, msgTestArea.getText(), Integer.parseInt(version)); - fileVersionTablePanel.updateModel(1); - } else { - vcs.saveVersion(CURRENT_USERSNAME, filename, msgTestArea.getText(), Integer.parseInt(version)); - } - jt.requestFocus(); - doOK(); + entity.setCommitMsg(msgTestArea.getText()); + ReportContext.getInstance().getVcsController().saveOrUpdateFileVersion(entity); + setVisible(false); } }); @@ -113,17 +91,6 @@ public class SaveFileVersionDialog extends UIDialog { }); } - private void refresh() { - int latestFileVersion = vcs.getLatestFileVersion(editingFilename()); - versionLabel.setText("V." + String.valueOf(latestFileVersion + 1)); - msgTestArea.setText(StringUtils.EMPTY); - } - - public void showMsgInputDialog() { - refresh(); - setVisible(true); - } - @Override public void checkValid() throws Exception { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java index 52c5052dba..9b2ac55b28 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java @@ -5,13 +5,14 @@ import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; -import com.fr.design.mainframe.vcs.proxy.VcsCacheFileNodeFileProxy; +import com.fr.design.mainframe.vcs.common.Constants; +import com.fr.design.mainframe.vcs.proxy.VcsCacheFileNodeFile; import com.fr.file.filetree.FileNode; import com.fr.log.FineLoggerFactory; import com.fr.report.entity.VcsEntity; import com.fr.stable.StringUtils; +import com.fr.workspace.WorkContext; import com.fr.workspace.server.vcs.VcsOperator; -import com.fr.workspace.server.vcs.common.Constants; import javax.swing.AbstractCellEditor; import javax.swing.JPanel; @@ -21,16 +22,15 @@ import java.awt.Component; public class FileVersionCellEditor extends AbstractCellEditor implements TableCellEditor { - private final VcsOperator vcs; + private static final long serialVersionUID = -7299526575184810693L; //第一行 private final JPanel firstRowPanel; //其余行 private final FileVersionRowPanel renderAndEditor; - public FileVersionCellEditor(FileVersionFirstRowPanel firstRowPanel, FileVersionRowPanel renderAndEditor, VcsOperator vcs) { - this.vcs = vcs; - this.firstRowPanel = firstRowPanel; - this.renderAndEditor = renderAndEditor; + public FileVersionCellEditor() { + this.firstRowPanel = new FileVersionFirstRowPanel(); + this.renderAndEditor = new FileVersionRowPanel(); } @Override @@ -40,17 +40,16 @@ public class FileVersionCellEditor extends AbstractCellEditor implements TableCe if (isSelected) { return editor; } else if (row == 0) { - //TODO path "/" String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); try { - fileOfVersion = vcs.getFileOfCurrent(path.replaceFirst("/", "")); + fileOfVersion = WorkContext.getCurrent().get(VcsOperator.class).getFileOfCurrent(path.replaceFirst("/", "")); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage()); } } else { renderAndEditor.update((VcsEntity) value); try { - fileOfVersion = vcs.getFileOfFileVersion(((VcsEntity) value).getFilename(), ((VcsEntity) value).getVersion()); + fileOfVersion = WorkContext.getCurrent().get(VcsOperator.class).getFileOfFileVersion(((VcsEntity) value).getFilename(), ((VcsEntity) value).getVersion()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage()); } @@ -65,7 +64,7 @@ public class FileVersionCellEditor extends AbstractCellEditor implements TableCe MutilTempalteTabPane.getInstance().closeFormat(jt); MutilTempalteTabPane.getInstance().closeSpecifiedTemplate(jt); //再打开cache中的模板 - DesignerContext.getDesignerFrame().openTemplate(new VcsCacheFileNodeFileProxy(new FileNode(fileOfVersion, false))); + DesignerContext.getDesignerFrame().openTemplate(new VcsCacheFileNodeFile(new FileNode(fileOfVersion, false))); } @@ -78,6 +77,6 @@ public class FileVersionCellEditor extends AbstractCellEditor implements TableCe @Override public Object getCellEditorValue() { - return renderAndEditor.getFileVersion(); + return renderAndEditor.getVcsEntity(); } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellRender.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellRender.java index 78e75bdf55..efe0543918 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellRender.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellRender.java @@ -8,7 +8,7 @@ import javax.swing.table.TableCellRenderer; import java.awt.Component; import static com.fr.design.constants.UIConstants.TREE_BACKGROUND; -import static com.fr.workspace.server.vcs.common.Constants.TABLE_SELECT_BACKGROUND; +import static com.fr.design.mainframe.vcs.common.Constants.TABLE_SELECT_BACKGROUND; public class FileVersionCellRender implements TableCellRenderer { @@ -18,9 +18,9 @@ public class FileVersionCellRender implements TableCellRenderer { //其余行 private final FileVersionRowPanel render; - public FileVersionCellRender(FileVersionFirstRowPanel firstRowPanel, FileVersionRowPanel render) { - this.render = render; - this.firstRowPanel = firstRowPanel; + public FileVersionCellRender() { + this.render = new FileVersionRowPanel(); + this.firstRowPanel = new FileVersionFirstRowPanel(); } @Override diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java index e674f3ced0..39c76d365b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java @@ -6,6 +6,8 @@ import com.fr.design.gui.date.UIDatePicker; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; +import com.fr.report.ReportContext; +import com.fr.report.entity.VcsEntity; import javax.swing.AbstractAction; import javax.swing.Box; @@ -17,14 +19,18 @@ import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Date; +import java.util.List; -import static com.fr.workspace.server.vcs.common.Constants.EMPTY_BORDER; -import static com.fr.workspace.server.vcs.common.Constants.EMPTY_BORDER_BOTTOM; +import static com.fr.design.mainframe.vcs.common.Constants.EMPTY_BORDER; +import static com.fr.design.mainframe.vcs.common.Constants.EMPTY_BORDER_BOTTOM; public class FileVersionDialog extends UIDialog { private UIButton okBtn = new UIButton("确定"); private UIButton cancelBtn = new UIButton("取消"); + private DateEditor dateEditor; + private UITextField textField; + public static final long DELAY = 24 * 60 * 60 * 1000; public FileVersionDialog(Frame frame) { @@ -35,11 +41,13 @@ public class FileVersionDialog extends UIDialog { box0.setBorder(EMPTY_BORDER_BOTTOM); box0.add(new UILabel("生成日期")); box0.add(Box.createHorizontalGlue()); - box0.add(new DateEditor(new Date(), true, "生成日期", UIDatePicker.STYLE_CN_DATE1)); + dateEditor = new DateEditor(new Date(), true, "生成日期", UIDatePicker.STYLE_CN_DATE1); + box0.add(dateEditor); Box box1 = Box.createHorizontalBox(); box1.setBorder(EMPTY_BORDER_BOTTOM); box1.add(new UILabel("备注关键词 ")); - box1.add(new UITextField()); + textField = new UITextField(); + box1.add(textField); Box box2 = Box.createHorizontalBox(); box2.add(Box.createHorizontalGlue()); box2.setBorder(EMPTY_BORDER); @@ -49,6 +57,10 @@ public class FileVersionDialog extends UIDialog { @Override public void actionPerformed(ActionEvent e) { FileVersionDialog.this.setVisible(false); + Date date = dateEditor.getValue(); + List vcsEntities = ReportContext.getInstance().getVcsController().queryFilterFileVersions(date, new Date(date.getTime() + DELAY), textField.getText()); + FileVersionTable.getInstance().updateModel(1, vcsEntities); + } }); cancelBtn.addActionListener(new AbstractAction() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionFirstRowPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionFirstRowPanel.java index 8200f14275..9d892ba535 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionFirstRowPanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionFirstRowPanel.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.vcs.ui; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import javax.swing.Box; import javax.swing.JPanel; @@ -14,7 +15,7 @@ public class FileVersionFirstRowPanel extends JPanel { super(new BorderLayout()); Box upPane = Box.createVerticalBox(); upPane.setBorder(new EmptyBorder(5, 10, 5, 10)); - upPane.add(new UILabel("本地用户")); + upPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Local_User"))); add(upPane, BorderLayout.CENTER); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java index 712dcf4b10..683fd5a7fc 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java @@ -4,13 +4,14 @@ import com.fr.design.gui.frpane.UITextPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; -import com.fr.design.mainframe.toolbar.VcsConfig; +import com.fr.design.mainframe.DesignerFrameFileDealerPane; +import com.fr.design.mainframe.vcs.common.Constants; import com.fr.log.FineLoggerFactory; import com.fr.report.entity.VcsEntity; import com.fr.stable.StringUtils; -import com.fr.third.springframework.context.annotation.AnnotationConfigApplicationContext; +import com.fr.workspace.WorkContext; import com.fr.workspace.server.vcs.VcsOperator; -import com.fr.workspace.server.vcs.common.Constants; +import com.fr.workspace.server.vcs.git.FineGit; import javax.swing.Box; import javax.swing.JOptionPane; @@ -30,17 +31,15 @@ import java.util.Date; public class FileVersionRowPanel extends JPanel { - private final VcsOperator vcs; - private VcsEntity fileVersion; + private VcsEntity vcsEntity; private UILabel versionLabel = new UILabel(); private UILabel usernameLabel = new UILabel("", Constants.VCS_USER_PNG, SwingConstants.LEFT); private UITextPane timeAndMsgLabel = new UITextPane(); private UILabel timeLabel = new UILabel(); + private EditFileVersionDialog editDialog; - @SuppressWarnings("unchecked") - public FileVersionRowPanel(final VcsOperator vcsOperator) { - this.vcs = vcsOperator; + public FileVersionRowPanel() { setLayout(new BorderLayout()); // version + username @@ -59,38 +58,41 @@ public class FileVersionRowPanel extends JPanel { // confirm + delete UIButton confirmBtn = new UIButton(Constants.VCS_REVERT); confirmBtn.set4ToolbarButton(); - confirmBtn.setToolTipText(Toolkit.i18nText("Plugin-VCS_Version_Revert")); + confirmBtn.setToolTipText(Toolkit.i18nText("Fine-Design_Vcs_Version_Revert")); confirmBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { - if (JOptionPane.showConfirmDialog(null, Toolkit.i18nText("Plugin-VCS_Version_Revert_Confirm"), Toolkit.i18nText("Plugin-VCS_Version_Revert_Title"), + if (JOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Confirm"), Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Title"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { try { - vcs.rollbackTo(fileVersion); + WorkContext.getCurrent().get(VcsOperator.class).rollbackTo(vcsEntity); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage()); } - AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(VcsConfig.class); - context.getBean(FileVersionsPanel.class).exitVcs(fileVersion.getFilename()); + FileVersionsPanel.getInstance().exitVcs(vcsEntity.getFilename()); } } }); UIButton deleteBtn = new UIButton(Constants.VCS_DELETE_PNG); deleteBtn.set4ToolbarButton(); - deleteBtn.setToolTipText(Toolkit.i18nText("Plugin-VCS_Version_Delete")); + deleteBtn.setToolTipText(Toolkit.i18nText("Fine-Design_Vcs_Version_Delete")); deleteBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { - if (JOptionPane.showConfirmDialog(null, Toolkit.i18nText("Plugin-VCS_Version_Delete_Confirm"), Toolkit.i18nText("FR-Designer_Remove"), + if (JOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Vcs_Version_Delete_Confirm"), Toolkit.i18nText("FR-Designer_Remove"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { - //TODO refactor try { - vcs.deleteVersion(fileVersion.getFilename(), fileVersion.getVersion()); + WorkContext.getCurrent().get(VcsOperator.class).deleteVersion(vcsEntity.getFilename(), vcsEntity.getVersion()); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage()); + } + FileVersionTable table = (FileVersionTable) (FileVersionRowPanel.this.getParent()); + String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); + try { + table.updateModel(table.getSelectedRow() - 1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage()); } - FileVersionTablePanel table = (FileVersionTablePanel) (FileVersionRowPanel.this.getParent()); - table.updateModel(table.getSelectedRow() - 1); } } }); @@ -117,12 +119,15 @@ public class FileVersionRowPanel extends JPanel { } private void showEditDialog() { + this.editDialog = new EditFileVersionDialog(vcsEntity); + editDialog.setVisible(true); + update(vcsEntity); } public void update(final VcsEntity fileVersion) { - this.fileVersion = fileVersion; + this.vcsEntity = fileVersion; versionLabel.setText(String.format("V.%s", fileVersion.getVersion())); usernameLabel.setText(fileVersion.getUsername()); timeAndMsgLabel.setText(StringUtils.EMPTY); @@ -142,7 +147,7 @@ public class FileVersionRowPanel extends JPanel { return simpleDateFormat.format(time); } - public VcsEntity getFileVersion() { - return fileVersion; + public VcsEntity getVcsEntity() { + return vcsEntity; } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionTable.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionTable.java index a833edc733..49c926c37c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionTable.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionTable.java @@ -3,52 +3,53 @@ package com.fr.design.mainframe.vcs.ui; import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.log.FineLoggerFactory; import com.fr.report.entity.VcsEntity; +import com.fr.workspace.WorkContext; import com.fr.workspace.server.vcs.VcsOperator; import javax.swing.JTable; import javax.swing.ListSelectionModel; import javax.swing.table.AbstractTableModel; -import javax.swing.table.TableCellEditor; -import javax.swing.table.TableCellRenderer; import java.util.ArrayList; import java.util.List; -public class FileVersionTablePanel extends JTable { +public class FileVersionTable extends JTable { + private static volatile FileVersionTable instance; - private final VcsOperator vcs; + private FileVersionTable() { + super(new CellModel(new ArrayList())); - public FileVersionTablePanel(VcsOperator vcs, TableCellEditor tableCellEditor, TableCellRenderer tableCellRenderer) { - super(new Model(new ArrayList())); - this.vcs = vcs; - setDefaultRenderer(VcsEntity.class, tableCellRenderer); - setDefaultEditor(VcsEntity.class, tableCellEditor); + setDefaultRenderer(VcsEntity.class, new FileVersionCellRender()); + setDefaultEditor(VcsEntity.class, new FileVersionCellEditor()); setSelectionMode(ListSelectionModel.SINGLE_SELECTION); setTableHeader(null); setRowHeight(30); } - public void updateModel(int selectedRow) { - String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); - List vcsEntities = null; - try { - vcsEntities = vcs.getVersions(path.replaceFirst("/", "")); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage()); + public static FileVersionTable getInstance() { + if (instance == null) { + synchronized (FileVersionTable.class) { + instance = new FileVersionTable(); + } } - if (selectedRow > vcsEntities.size()) { - selectedRow = vcsEntities.size(); + return instance; + } + + public void updateModel(int selectedRow, List entities) { + if (selectedRow > entities.size()) { + selectedRow = entities.size(); } - setModel(new Model(vcsEntities)); + setModel(new CellModel(entities)); editCellAt(selectedRow, 0); setRowSelectionInterval(selectedRow, selectedRow); } - private static class Model extends AbstractTableModel { + private static class CellModel extends AbstractTableModel { + private static final long serialVersionUID = -6078568799037607690L; private List vcsEntities; - Model(List vcsEntities) { + CellModel(List vcsEntities) { this.vcsEntities = vcsEntities; } @@ -76,10 +77,5 @@ public class FileVersionTablePanel extends JTable { } - public List getVcsEntities() { - return vcsEntities; - } - - } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java index a04ac705ad..2b49f8cdf7 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java @@ -4,7 +4,6 @@ import com.fr.base.GraphHelper; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.dialog.BasicPane; import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; @@ -15,12 +14,15 @@ import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.ToolBarNewTemplatePane; import com.fr.design.mainframe.WestRegionContainerPane; +import com.fr.design.mainframe.vcs.common.Constants; import com.fr.design.menu.ToolBarDef; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; +import com.fr.log.FineLoggerFactory; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; -import com.fr.workspace.server.vcs.common.Constants; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.vcs.VcsOperator; import javax.swing.BorderFactory; import javax.swing.Box; @@ -33,19 +35,28 @@ import java.awt.event.ActionListener; public class FileVersionsPanel extends BasicPane { private static final String ELLIPSIS = "..."; + private static volatile FileVersionsPanel instance; - private final FileVersionTablePanel fileVersionsTablePane; private UILabel titleLabel; private String templatePath; private UIButton filterBtn; private FileVersionDialog versionDialog; - public FileVersionsPanel(FileVersionTablePanel fileVersionTablePanel) { - this.fileVersionsTablePane = fileVersionTablePanel; + private FileVersionsPanel() { initComponents(); } + public static FileVersionsPanel getInstance() { + if (instance == null) { + synchronized (FileVersionsPanel.class) { + instance = new FileVersionsPanel(); + + } + } + return instance; + } + private void initComponents() { setLayout(new BorderLayout()); UIToolbar toolbar = ToolBarDef.createJToolBar(); @@ -83,7 +94,7 @@ public class FileVersionsPanel extends BasicPane { toolbar.add(upPane); add(toolbar, BorderLayout.NORTH); - UIScrollPane jScrollPane = new UIScrollPane(fileVersionsTablePane); + UIScrollPane jScrollPane = new UIScrollPane(FileVersionTable.getInstance()); add(jScrollPane, BorderLayout.CENTER); } @@ -106,7 +117,7 @@ public class FileVersionsPanel extends BasicPane { MutilTempalteTabPane.getInstance().closeFormat(jt); MutilTempalteTabPane.getInstance().closeSpecifiedTemplate(jt); - udpateDesignerFrame(true); + updateDesignerFrame(true); final String selectedFilePath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, path); DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(selectedFilePath, false))); @@ -116,16 +127,21 @@ public class FileVersionsPanel extends BasicPane { templatePath = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); String[] paths = StableUtils.pathSplit(templatePath); String filename = paths[paths.length - 1]; - int width = fileVersionsTablePane.getWidth() - 40; + int width = FileVersionTable.getInstance().getWidth() - 40; if (getStringWidth(filename) > width) { filename = getEllipsisName(filename, width); } titleLabel.setText(filename); - fileVersionsTablePane.updateModel(1); + String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); + try { + FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage()); + } } public void showFileVersionsPane() { - udpateDesignerFrame(false); + updateDesignerFrame(false); refreshVersionTablePane(); } @@ -135,7 +151,7 @@ public class FileVersionsPanel extends BasicPane { } - private void udpateDesignerFrame(boolean isExit) { + private void updateDesignerFrame(boolean isExit) { // 左上侧面板 WestRegionContainerPane.getInstance().replaceUpPane( isExit ? DesignerFrameFileDealerPane.getInstance() : this); @@ -144,7 +160,7 @@ public class FileVersionsPanel extends BasicPane { // MutilTempalteTabPane & NewTemplatePane 是否可点 ToolBarNewTemplatePane.getInstance().setButtonGray(!isExit); - JTemplate currentEditingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + JTemplate currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); if (currentEditingTemplate.isJWorkBook()) { DesignerContext.getDesignerFrame().resetToolkitByPlus(currentEditingTemplate); } diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index 15098ce2d5..4ad08f2baa 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -23,6 +23,7 @@ import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.itoolbar.UILargeToolbar; import com.fr.design.mainframe.ActiveKeyGenerator; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.InformationCollector; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JWorkBook; @@ -31,9 +32,8 @@ import com.fr.design.mainframe.bbs.UserInfoLabel; import com.fr.design.mainframe.bbs.UserInfoPane; import com.fr.design.mainframe.template.info.TemplateInfoCollector; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; -import com.fr.design.mainframe.toolbar.VcsConfig; -import com.fr.design.mainframe.vcs.proxy.VcsCacheFileNodeFileProxy; -import com.fr.design.mainframe.vcs.ui.FileVersionTablePanel; +import com.fr.design.mainframe.vcs.proxy.VcsCacheFileNodeFile; +import com.fr.design.mainframe.vcs.ui.FileVersionTable; import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; @@ -60,10 +60,9 @@ import com.fr.start.jni.SplashMac; import com.fr.start.module.StartupArgs; import com.fr.start.preload.ImagePreLoader; import com.fr.start.server.ServerTray; -import com.fr.third.springframework.context.annotation.AnnotationConfigApplicationContext; import com.fr.workspace.WorkContext; import com.fr.workspace.server.vcs.VcsOperator; -import com.fr.workspace.server.vcs.common.Constants; +import com.fr.design.mainframe.vcs.common.Constants; import javax.swing.JComponent; import javax.swing.JOptionPane; @@ -277,35 +276,32 @@ public class Designer extends BaseDesigner { saveButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); jt.stopEditing(); jt.saveTemplate(); jt.requestFocus(); String fileName = getEditingFilename(); - AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(VcsConfig.class); - VcsOperator vcsOperator = context.getBean(VcsOperator.class); int latestFileVersion = 0; try { - latestFileVersion = vcsOperator.getLatestFileVersion(fileName); + latestFileVersion = WorkContext.getCurrent().get(VcsOperator.class).getLatestFileVersion(fileName); } catch (Exception e1) { FineLoggerFactory.getLogger().error(e1.getMessage()); } try { - if (jt.getEditingFILE() instanceof VcsCacheFileNodeFileProxy) { - vcsOperator.saveVersionFromCache(Constants.CURRENT_USERSNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); - context.getBean(FileVersionTablePanel.class).updateModel(1); + if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) { + WorkContext.getCurrent().get(VcsOperator.class).saveVersionFromCache(Constants.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); + String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); + FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); + } else { - vcsOperator.saveVersion(Constants.CURRENT_USERSNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); + WorkContext.getCurrent().get(VcsOperator.class).saveVersion(Constants.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); } } catch (Exception e1) { FineLoggerFactory.getLogger().error(e1.getMessage()); } - - - } }); return saveButton; From 525c10186ed8d3a58d08c190e70b74d328fdcec6 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 Apr 2019 12:19:08 +0800 Subject: [PATCH 05/21] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/actions/file/PreferencePane.java | 1 - .../com/fr/design/mainframe/vcs/ui/FileVersionDialog.java | 2 +- .../com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java | 1 - .../java/com/fr/design/mainframe/vcs/ui/FileVersionTable.java | 4 ---- 4 files changed, 1 insertion(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 5bead95da4..7dc762f313 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -1,6 +1,5 @@ package com.fr.design.actions.file; -import com.apple.laf.AquaProgressBarUI; import com.fr.base.BaseUtils; import com.fr.config.Configuration; import com.fr.design.DesignerEnvManager; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java index 39c76d365b..bc74cea0a1 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java @@ -26,11 +26,11 @@ import static com.fr.design.mainframe.vcs.common.Constants.EMPTY_BORDER_BOTTOM; public class FileVersionDialog extends UIDialog { + public static final long DELAY = 24 * 60 * 60 * 1000; private UIButton okBtn = new UIButton("确定"); private UIButton cancelBtn = new UIButton("取消"); private DateEditor dateEditor; private UITextField textField; - public static final long DELAY = 24 * 60 * 60 * 1000; public FileVersionDialog(Frame frame) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java index 683fd5a7fc..a0dad0ae62 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java @@ -11,7 +11,6 @@ import com.fr.report.entity.VcsEntity; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.server.vcs.VcsOperator; -import com.fr.workspace.server.vcs.git.FineGit; import javax.swing.Box; import javax.swing.JOptionPane; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionTable.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionTable.java index 49c926c37c..500a57f15d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionTable.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionTable.java @@ -1,10 +1,6 @@ package com.fr.design.mainframe.vcs.ui; -import com.fr.design.mainframe.DesignerFrameFileDealerPane; -import com.fr.log.FineLoggerFactory; import com.fr.report.entity.VcsEntity; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.vcs.VcsOperator; import javax.swing.JTable; import javax.swing.ListSelectionModel; From 99ba163c1f0d8acd6a7e3c37fa3d28d3629f02a5 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 Apr 2019 12:40:40 +0800 Subject: [PATCH 06/21] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DesignerFrameFileDealerPane.java | 36 ++++++++++++++++--- .../common/{Constants.java => VcsHelper.java} | 27 +++++++++++++- .../vcs/proxy/VcsCacheFileNodeFile.java | 10 +++--- .../vcs/ui/FileVersionCellEditor.java | 4 +-- .../vcs/ui/FileVersionCellRender.java | 2 +- .../mainframe/vcs/ui/FileVersionDialog.java | 4 +-- .../mainframe/vcs/ui/FileVersionRowPanel.java | 16 ++++----- .../mainframe/vcs/ui/FileVersionsPanel.java | 6 ++-- 8 files changed, 78 insertions(+), 27 deletions(-) rename designer-base/src/main/java/com/fr/design/mainframe/vcs/common/{Constants.java => VcsHelper.java} (64%) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index 1627bf8442..d61d1cf42d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -26,7 +26,6 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.mainframe.vcs.ui.FileVersionTable; import com.fr.design.mainframe.vcs.ui.FileVersionsPanel; import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.ShortCut; @@ -50,7 +49,7 @@ import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; import com.fr.third.org.apache.commons.io.FilenameUtils; import com.fr.workspace.WorkContext; -import com.fr.design.mainframe.vcs.common.Constants; +import com.fr.design.mainframe.vcs.common.VcsHelper; import javax.swing.BorderFactory; import javax.swing.JDialog; @@ -287,7 +286,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt private class VcsAction extends UpdateAction { public VcsAction() { this.setName(Toolkit.i18nText("Fine-Design_Vcs_Title")); - this.setSmallIcon(Constants.VCS_LIST_PNG); + this.setSmallIcon(VcsHelper.VCS_LIST_PNG); } @Override @@ -450,18 +449,45 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt newFolderAction.setEnabled(singleSelected); renameAction.setEnabled(singleSelected); showInExplorerAction.setEnabled(singleSelected); - vcsAction.setEnabled(singleSelected); - // 删除操作在至少选中一个时可用 boolean selected = selectedPathNum > 0; delFileAction.setEnabled(selected); // 刷新操作始终可用 refreshTreeAction.setEnabled(true); + handleVcsAction(); // 其他状态 otherStateChange(); } + private void handleVcsAction() { + if (VcsHelper.containsFolderCounts() + VcsHelper.selectedTemplateCounts() > 1) { + vcsAction.setEnabled(false); + return; + } + + if (WorkContext.getCurrent() != null) { + if (!WorkContext.getCurrent().isLocal()) { + //当前环境为远程环境时 + FileNode node = TemplateTreePane.getInstance().getTemplateFileTree().getSelectedFileNode(); + if (selectedOperation.getFilePath() != null) { + if (node.getLock() != null && !ComparatorUtils.equals(node.getUserID(), node.getLock())) { + vcsAction.setEnabled(false); + } else { + vcsAction.setEnabled(true); + } + } else { + vcsAction.setEnabled(false); + } + } else { + //当前环境为本地环境时 + vcsAction.setEnabled(selectedOperation.getFilePath() != null); + } + } + } + + + public FileOperations getSelectedOperation() { return selectedOperation; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/Constants.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java similarity index 64% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/common/Constants.java rename to designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java index bd6869a64d..614c800b3f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/Constants.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java @@ -1,6 +1,8 @@ package com.fr.design.mainframe.vcs.common; import com.fr.base.BaseUtils; +import com.fr.design.file.TemplateTreePane; +import com.fr.design.gui.itree.filetree.TemplateFileTree; import com.fr.design.i18n.Toolkit; import com.fr.workspace.WorkContext; @@ -11,7 +13,7 @@ import java.awt.Color; import static com.fr.stable.StableUtils.pathJoin; -public class Constants { +public class VcsHelper { public final static String VCS_DIR = "vcs"; public final static String VCS_CACHE_DIR = pathJoin(VCS_DIR, "cache"); @@ -35,5 +37,28 @@ public class Constants { public final static Icon VCS_USER_PNG = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_user@1x.png"); public final static Icon VCS_REVERT = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_revert.png"); + public static int containsFolderCounts() { + TemplateFileTree fileTree = TemplateTreePane.getInstance().getTemplateFileTree(); + if (fileTree.getSelectionPaths() == null) { + return 0; + } + + //选择的包含文件和文件夹的数目 + if (fileTree.getSelectionPaths().length == 0) { + return 0; + } + //所有的num减去模板的num,得到文件夹的num + return fileTree.getSelectionPaths().length - fileTree.getSelectedTemplatePaths().length; + } + + public static int selectedTemplateCounts() { + TemplateFileTree fileTree = TemplateTreePane.getInstance().getTemplateFileTree(); + if (fileTree.getSelectionPaths() == null) { + return 0; + } + + return fileTree.getSelectedTemplatePaths().length; + } + } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/proxy/VcsCacheFileNodeFile.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/proxy/VcsCacheFileNodeFile.java index 193150dad7..9ddc411d49 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/proxy/VcsCacheFileNodeFile.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/proxy/VcsCacheFileNodeFile.java @@ -1,7 +1,7 @@ package com.fr.design.mainframe.vcs.proxy; import com.fr.base.io.XMLEncryptUtils; -import com.fr.design.mainframe.vcs.common.Constants; +import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; @@ -37,12 +37,12 @@ public class VcsCacheFileNodeFile extends FileNodeFILE { String envPath = node.getEnvPath(); // envPath必须以vcs开头 - if (!envPath.startsWith(Constants.VCS_CACHE_DIR)) { + if (!envPath.startsWith(VcsHelper.VCS_CACHE_DIR)) { return null; } InputStream in = WorkContext.getCurrent().get(WorkResource.class) - .openStream(StableUtils.pathJoin(Constants.VCS_CACHE_DIR, envPath.substring(Constants.VCS_CACHE_DIR.length() + 1))); + .openStream(StableUtils.pathJoin(VcsHelper.VCS_CACHE_DIR, envPath.substring(VcsHelper.VCS_CACHE_DIR.length() + 1))); return envPath.endsWith(".cpt") || envPath.endsWith(".frm") ? XMLEncryptUtils.decodeInputStream(in) : in; @@ -63,10 +63,10 @@ public class VcsCacheFileNodeFile extends FileNodeFILE { String envPath = node.getEnvPath(); // envPath必须以reportlets开头 - if (!envPath.startsWith(Constants.VCS_CACHE_DIR)) { + if (!envPath.startsWith(VcsHelper.VCS_CACHE_DIR)) { return null; } - return new WorkResourceOutputStream(StableUtils.pathJoin(Constants.VCS_CACHE_DIR, envPath.substring(Constants.VCS_CACHE_DIR.length() + 1))); + return new WorkResourceOutputStream(StableUtils.pathJoin(VcsHelper.VCS_CACHE_DIR, envPath.substring(VcsHelper.VCS_CACHE_DIR.length() + 1))); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java index 9b2ac55b28..265a4f69f0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java @@ -5,7 +5,7 @@ import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; -import com.fr.design.mainframe.vcs.common.Constants; +import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.mainframe.vcs.proxy.VcsCacheFileNodeFile; import com.fr.file.filetree.FileNode; import com.fr.log.FineLoggerFactory; @@ -55,7 +55,7 @@ public class FileVersionCellEditor extends AbstractCellEditor implements TableCe } } - editor.setBackground(Constants.TABLE_SELECT_BACKGROUND); + editor.setBackground(VcsHelper.TABLE_SELECT_BACKGROUND); if (StringUtils.isNotEmpty(fileOfVersion)) { //先关闭当前打开的模板版本 JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellRender.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellRender.java index efe0543918..c1cc23fc45 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellRender.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellRender.java @@ -8,7 +8,7 @@ import javax.swing.table.TableCellRenderer; import java.awt.Component; import static com.fr.design.constants.UIConstants.TREE_BACKGROUND; -import static com.fr.design.mainframe.vcs.common.Constants.TABLE_SELECT_BACKGROUND; +import static com.fr.design.mainframe.vcs.common.VcsHelper.TABLE_SELECT_BACKGROUND; public class FileVersionCellRender implements TableCellRenderer { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java index bc74cea0a1..4ed8df7c66 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java @@ -21,8 +21,8 @@ import java.awt.event.ActionListener; import java.util.Date; import java.util.List; -import static com.fr.design.mainframe.vcs.common.Constants.EMPTY_BORDER; -import static com.fr.design.mainframe.vcs.common.Constants.EMPTY_BORDER_BOTTOM; +import static com.fr.design.mainframe.vcs.common.VcsHelper.EMPTY_BORDER; +import static com.fr.design.mainframe.vcs.common.VcsHelper.EMPTY_BORDER_BOTTOM; public class FileVersionDialog extends UIDialog { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java index a0dad0ae62..11464df749 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java @@ -5,7 +5,7 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerFrameFileDealerPane; -import com.fr.design.mainframe.vcs.common.Constants; +import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.log.FineLoggerFactory; import com.fr.report.entity.VcsEntity; import com.fr.stable.StringUtils; @@ -32,7 +32,7 @@ public class FileVersionRowPanel extends JPanel { private VcsEntity vcsEntity; private UILabel versionLabel = new UILabel(); - private UILabel usernameLabel = new UILabel("", Constants.VCS_USER_PNG, SwingConstants.LEFT); + private UILabel usernameLabel = new UILabel("", VcsHelper.VCS_USER_PNG, SwingConstants.LEFT); private UITextPane timeAndMsgLabel = new UITextPane(); private UILabel timeLabel = new UILabel(); private EditFileVersionDialog editDialog; @@ -43,19 +43,19 @@ public class FileVersionRowPanel extends JPanel { // version + username Box upPane = Box.createHorizontalBox(); - upPane.setBorder(Constants.EMPTY_BORDER); + upPane.setBorder(VcsHelper.EMPTY_BORDER); upPane.add(versionLabel); upPane.add(Box.createHorizontalGlue()); // msg - timeAndMsgLabel.setBorder(Constants.EMPTY_BORDER); + timeAndMsgLabel.setBorder(VcsHelper.EMPTY_BORDER); timeAndMsgLabel.setOpaque(false); timeAndMsgLabel.setBackground(new Color(0, 0, 0, 0)); timeAndMsgLabel.setEditable(false); // confirm + delete - UIButton confirmBtn = new UIButton(Constants.VCS_REVERT); + UIButton confirmBtn = new UIButton(VcsHelper.VCS_REVERT); confirmBtn.set4ToolbarButton(); confirmBtn.setToolTipText(Toolkit.i18nText("Fine-Design_Vcs_Version_Revert")); confirmBtn.addActionListener(new ActionListener() { @@ -72,7 +72,7 @@ public class FileVersionRowPanel extends JPanel { } } }); - UIButton deleteBtn = new UIButton(Constants.VCS_DELETE_PNG); + UIButton deleteBtn = new UIButton(VcsHelper.VCS_DELETE_PNG); deleteBtn.set4ToolbarButton(); deleteBtn.setToolTipText(Toolkit.i18nText("Fine-Design_Vcs_Version_Delete")); deleteBtn.addActionListener(new ActionListener() { @@ -95,7 +95,7 @@ public class FileVersionRowPanel extends JPanel { } } }); - UIButton editBtn = new UIButton(Constants.VCS_EDIT_PNG); + UIButton editBtn = new UIButton(VcsHelper.VCS_EDIT_PNG); editBtn.set4ToolbarButton(); editBtn.addActionListener(new ActionListener() { @Override @@ -109,7 +109,7 @@ public class FileVersionRowPanel extends JPanel { upPane.add(deleteBtn); Box downPane = Box.createHorizontalBox(); downPane.add(usernameLabel); - downPane.setBorder(Constants.EMPTY_BORDER_BOTTOM); + downPane.setBorder(VcsHelper.EMPTY_BORDER_BOTTOM); downPane.add(Box.createHorizontalGlue()); downPane.add(timeLabel); add(upPane, BorderLayout.NORTH); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java index 2b49f8cdf7..dc33d029da 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java @@ -14,7 +14,7 @@ import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.ToolBarNewTemplatePane; import com.fr.design.mainframe.WestRegionContainerPane; -import com.fr.design.mainframe.vcs.common.Constants; +import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.menu.ToolBarDef; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; @@ -63,7 +63,7 @@ public class FileVersionsPanel extends BasicPane { toolbar.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0)); toolbar.setBorderPainted(true); Box upPane = Box.createHorizontalBox(); - UIButton backBtn = new UIButton(Constants.VCS_BACK_PNG); + UIButton backBtn = new UIButton(VcsHelper.VCS_BACK_PNG); backBtn.set4ToolbarButton(); backBtn.addActionListener(new ActionListener() { @Override @@ -72,7 +72,7 @@ public class FileVersionsPanel extends BasicPane { } }); toolbar.add(backBtn); - filterBtn = new UIButton(Constants.VCS_FILTER_PNG); + filterBtn = new UIButton(VcsHelper.VCS_FILTER_PNG); filterBtn.set4ToolbarButton(); filterBtn.setHorizontalAlignment(SwingConstants.RIGHT); filterBtn.addActionListener(new ActionListener() { From 52fb689d64188b3b807180c36c65f57e19799041 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 Apr 2019 13:21:24 +0800 Subject: [PATCH 07/21] =?UTF-8?q?REPORT-14835=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/DesignerEnvManager.java | 2 +- .../fr/design/mainframe/DesignerFrameFileDealerPane.java | 2 +- .../com/fr/design/mainframe/vcs/common/VcsHelper.java | 8 ++++++-- .../com/fr/design/mainframe/vcs/ui/FileVersionTable.java | 4 +++- .../com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java | 5 +++-- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 3628313253..6d8d5b9c0c 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -1607,7 +1607,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { this.setDragPermited(reader.getAttrAsBoolean("isDragPermited", false)); this.setUndoLimit(reader.getAttrAsInt("undoLimit", 5)); this.setDefaultStringToFormula(reader.getAttrAsBoolean("defaultStringToFormula", false)); - this.setVcsEnable(reader.getAttrAsBoolean("supportVcs", false)); + this.setVcsEnable(reader.getAttrAsBoolean("supportVcs", true)); this.setSaveCommit(reader.getAttrAsBoolean("saveCommit", false)); this.setSaveInterval(reader.getAttrAsInt("saveInterval", 60)); if ((tmpVal = reader.getAttrAsString("gridLineColor", null)) != null) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index d61d1cf42d..7685974df5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -461,7 +461,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt } private void handleVcsAction() { - if (VcsHelper.containsFolderCounts() + VcsHelper.selectedTemplateCounts() > 1) { + if (!DesignerEnvManager.getEnvManager().isVcsEnable() || VcsHelper.isUnSelectedTemplate()) { vcsAction.setEnabled(false); return; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java index 614c800b3f..006603fde2 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java @@ -37,7 +37,7 @@ public class VcsHelper { public final static Icon VCS_USER_PNG = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_user@1x.png"); public final static Icon VCS_REVERT = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_revert.png"); - public static int containsFolderCounts() { + private static int containsFolderCounts() { TemplateFileTree fileTree = TemplateTreePane.getInstance().getTemplateFileTree(); if (fileTree.getSelectionPaths() == null) { return 0; @@ -51,7 +51,7 @@ public class VcsHelper { return fileTree.getSelectionPaths().length - fileTree.getSelectedTemplatePaths().length; } - public static int selectedTemplateCounts() { + private static int selectedTemplateCounts() { TemplateFileTree fileTree = TemplateTreePane.getInstance().getTemplateFileTree(); if (fileTree.getSelectionPaths() == null) { return 0; @@ -60,5 +60,9 @@ public class VcsHelper { return fileTree.getSelectedTemplatePaths().length; } + public static boolean isUnSelectedTemplate() { + return VcsHelper.containsFolderCounts() + VcsHelper.selectedTemplateCounts() > 1; + } + } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionTable.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionTable.java index 500a57f15d..aa9c87ca01 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionTable.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionTable.java @@ -25,7 +25,9 @@ public class FileVersionTable extends JTable { public static FileVersionTable getInstance() { if (instance == null) { synchronized (FileVersionTable.class) { - instance = new FileVersionTable(); + if (instance == null) { + instance = new FileVersionTable(); + } } } return instance; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java index dc33d029da..a85a2668ef 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java @@ -50,8 +50,9 @@ public class FileVersionsPanel extends BasicPane { public static FileVersionsPanel getInstance() { if (instance == null) { synchronized (FileVersionsPanel.class) { - instance = new FileVersionsPanel(); - + if (instance == null) { + instance = new FileVersionsPanel(); + } } } return instance; From 0574c315ad813e0125d495eb544ad07a1cf592f3 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 Apr 2019 13:25:12 +0800 Subject: [PATCH 08/21] =?UTF-8?q?REPORT-14835=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/vcs/common/VcsHelper.java | 18 +++++++++++++ .../src/main/java/com/fr/start/Designer.java | 25 +++---------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java index 006603fde2..fc9d4e940f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java @@ -1,9 +1,13 @@ package com.fr.design.mainframe.vcs.common; import com.fr.base.BaseUtils; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.TemplateTreePane; import com.fr.design.gui.itree.filetree.TemplateFileTree; import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.JTemplate; +import com.fr.stable.StringUtils; +import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; import javax.swing.Icon; @@ -64,5 +68,19 @@ public class VcsHelper { return VcsHelper.containsFolderCounts() + VcsHelper.selectedTemplateCounts() > 1; } + public static String getEdittingFilename() { + JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + String editingFilePath = jt.getEditingFILE().getPath(); + if (editingFilePath.startsWith(ProjectConstants.REPORTLETS_NAME)) { + editingFilePath = editingFilePath.replaceFirst(ProjectConstants.REPORTLETS_NAME, StringUtils.EMPTY); + } else if (editingFilePath.startsWith(VcsHelper.VCS_CACHE_DIR)) { + editingFilePath = editingFilePath.replaceFirst(VcsHelper.VCS_CACHE_DIR, StringUtils.EMPTY); + } + if (editingFilePath.startsWith("/")) { + editingFilePath = editingFilePath.substring(1); + } + return editingFilePath; + } + } diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index 4ad08f2baa..f7cb825eda 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -62,7 +62,7 @@ import com.fr.start.preload.ImagePreLoader; import com.fr.start.server.ServerTray; import com.fr.workspace.WorkContext; import com.fr.workspace.server.vcs.VcsOperator; -import com.fr.design.mainframe.vcs.common.Constants; +import com.fr.design.mainframe.vcs.common.VcsHelper; import javax.swing.JComponent; import javax.swing.JOptionPane; @@ -280,7 +280,7 @@ public class Designer extends BaseDesigner { jt.stopEditing(); jt.saveTemplate(); jt.requestFocus(); - String fileName = getEditingFilename(); + String fileName = VcsHelper.getEdittingFilename(); int latestFileVersion = 0; try { latestFileVersion = WorkContext.getCurrent().get(VcsOperator.class).getLatestFileVersion(fileName); @@ -288,15 +288,14 @@ public class Designer extends BaseDesigner { } catch (Exception e1) { FineLoggerFactory.getLogger().error(e1.getMessage()); } - try { if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) { - WorkContext.getCurrent().get(VcsOperator.class).saveVersionFromCache(Constants.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); + WorkContext.getCurrent().get(VcsOperator.class).saveVersionFromCache(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); } else { - WorkContext.getCurrent().get(VcsOperator.class).saveVersion(Constants.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); + WorkContext.getCurrent().get(VcsOperator.class).saveVersion(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); } } catch (Exception e1) { FineLoggerFactory.getLogger().error(e1.getMessage()); @@ -307,22 +306,6 @@ public class Designer extends BaseDesigner { return saveButton; } - public static String getEditingFilename() { - JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - String editingFilePath = jt.getEditingFILE().getPath(); - //TODO 如果是cache里的文件,也会走到这里,这里是找到reportlets去掉的。万一刚好cache/reportlets会出问题 - if (editingFilePath.startsWith(ProjectConstants.REPORTLETS_NAME)) { - editingFilePath = editingFilePath.replaceFirst(ProjectConstants.REPORTLETS_NAME, StringUtils.EMPTY); - } else if (editingFilePath.startsWith(Constants.VCS_CACHE_DIR)) { - editingFilePath = editingFilePath.replaceFirst(Constants.VCS_CACHE_DIR, StringUtils.EMPTY); - } - //TODO refactor 考虑直接用reportlets/xxx/x/x/x/x/x// or /xx/x/x/x/x/x - if (editingFilePath.startsWith("/")) { - editingFilePath = editingFilePath.substring(1); - } - return editingFilePath; - } - private UIButton createUndoButton() { undo = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/undo.png")); undo.setToolTipText(KeySetUtils.UNDO.getMenuKeySetName()); From 82d2302ffa175b5931e3f12e498601559497cc83 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 Apr 2019 14:21:52 +0800 Subject: [PATCH 09/21] =?UTF-8?q?REPORT-14835=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/PreferencePane.java | 14 ++++----- .../mainframe/vcs/common/VcsHelper.java | 2 +- .../mainframe/vcs/ui/FileVersionDialog.java | 29 ++++++++++--------- .../src/main/java/com/fr/start/Designer.java | 3 +- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 7dc762f313..e7db515af5 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -203,17 +203,17 @@ public class PreferencePane extends BasicPane { } private void createVcsSettingPane(JPanel generalPane) { - JPanel vcsPane = FRGUIPaneFactory.createVerticalTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("版本控制")); + JPanel vcsPane = FRGUIPaneFactory.createVerticalTitledBorderPane(Toolkit.i18nText("Fine-Design_Vcs_Title")); generalPane.add(vcsPane); - vcsEnableCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("保存自动生成版本")); - saveCommitCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("备注版本不会自动清理")); + vcsEnableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Vcs_SaveAuto")); + saveCommitCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Vcs_No_Delete")); saveIntervalEditor = new IntegerEditor(30); JPanel memorySpace = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); - UILabel label1 = new UILabel(" 每 "); - UILabel label2 = new UILabel(" 分钟每个用户同个模板最多保留一个模板"); - memorySpace.add(label1); + UILabel everyLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Every")); + UILabel delayLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Delay")); + memorySpace.add(everyLabel); memorySpace.add(saveIntervalEditor); - memorySpace.add(label2); + memorySpace.add(delayLabel); vcsEnableCheckBox.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java index fc9d4e940f..4e1809d6d1 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java @@ -68,7 +68,7 @@ public class VcsHelper { return VcsHelper.containsFolderCounts() + VcsHelper.selectedTemplateCounts() > 1; } - public static String getEdittingFilename() { + public static String getEditingFilename() { JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); String editingFilePath = jt.getEditingFILE().getPath(); if (editingFilePath.startsWith(ProjectConstants.REPORTLETS_NAME)) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java index 4ed8df7c66..4ac537a183 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java @@ -6,6 +6,7 @@ import com.fr.design.gui.date.UIDatePicker; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.i18n.Toolkit; import com.fr.report.ReportContext; import com.fr.report.entity.VcsEntity; @@ -27,8 +28,8 @@ import static com.fr.design.mainframe.vcs.common.VcsHelper.EMPTY_BORDER_BOTTOM; public class FileVersionDialog extends UIDialog { public static final long DELAY = 24 * 60 * 60 * 1000; - private UIButton okBtn = new UIButton("确定"); - private UIButton cancelBtn = new UIButton("取消"); + private UIButton okBtn = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK")); + private UIButton cancelBtn = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Utils_Design_Action_Cancel")); private DateEditor dateEditor; private UITextField textField; @@ -37,17 +38,17 @@ public class FileVersionDialog extends UIDialog { super(frame); setUndecorated(true); JPanel panel = new JPanel(new BorderLayout()); - Box box0 = Box.createHorizontalBox(); - box0.setBorder(EMPTY_BORDER_BOTTOM); - box0.add(new UILabel("生成日期")); - box0.add(Box.createHorizontalGlue()); - dateEditor = new DateEditor(new Date(), true, "生成日期", UIDatePicker.STYLE_CN_DATE1); - box0.add(dateEditor); - Box box1 = Box.createHorizontalBox(); - box1.setBorder(EMPTY_BORDER_BOTTOM); - box1.add(new UILabel("备注关键词 ")); + Box upBox = Box.createHorizontalBox(); + upBox.setBorder(EMPTY_BORDER_BOTTOM); + upBox.add(new UILabel(Toolkit.i18nText("Fine-Design_Vcs_buildTime"))); + upBox.add(Box.createHorizontalGlue()); + dateEditor = new DateEditor(new Date(), true, "", UIDatePicker.STYLE_CN_DATE1); + upBox.add(dateEditor); + Box downBox = Box.createHorizontalBox(); + downBox.setBorder(EMPTY_BORDER_BOTTOM); + downBox.add(new UILabel(Toolkit.i18nText("Fine-Design_Vcs_CommitMsg"))); textField = new UITextField(); - box1.add(textField); + downBox.add(textField); Box box2 = Box.createHorizontalBox(); box2.add(Box.createHorizontalGlue()); box2.setBorder(EMPTY_BORDER); @@ -69,8 +70,8 @@ public class FileVersionDialog extends UIDialog { FileVersionDialog.this.setVisible(false); } }); - panel.add(box0, BorderLayout.NORTH); - panel.add(box1, BorderLayout.CENTER); + panel.add(upBox, BorderLayout.NORTH); + panel.add(downBox, BorderLayout.CENTER); panel.add(box2, BorderLayout.SOUTH); add(panel); setSize(new Dimension(220, 100)); diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index f7cb825eda..458efaef99 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -53,7 +53,6 @@ import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.lifecycle.LifecycleFatalError; -import com.fr.stable.project.ProjectConstants; import com.fr.stable.xml.XMLTools; import com.fr.start.fx.SplashFx; import com.fr.start.jni.SplashMac; @@ -280,7 +279,7 @@ public class Designer extends BaseDesigner { jt.stopEditing(); jt.saveTemplate(); jt.requestFocus(); - String fileName = VcsHelper.getEdittingFilename(); + String fileName = VcsHelper.getEditingFilename(); int latestFileVersion = 0; try { latestFileVersion = WorkContext.getCurrent().get(VcsOperator.class).getLatestFileVersion(fileName); From 1ec46c20d5bf6dfcf06ed6c8c668bf873c2ce47b Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 Apr 2019 15:13:17 +0800 Subject: [PATCH 10/21] =?UTF-8?q?REPORT-14835=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/start/Designer.java | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index 458efaef99..edd26cb05d 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -279,32 +279,34 @@ public class Designer extends BaseDesigner { jt.stopEditing(); jt.saveTemplate(); jt.requestFocus(); - String fileName = VcsHelper.getEditingFilename(); - int latestFileVersion = 0; - try { - latestFileVersion = WorkContext.getCurrent().get(VcsOperator.class).getLatestFileVersion(fileName); - - } catch (Exception e1) { - FineLoggerFactory.getLogger().error(e1.getMessage()); - } - try { - if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) { - WorkContext.getCurrent().get(VcsOperator.class).saveVersionFromCache(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); - String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); - FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); - - } else { - WorkContext.getCurrent().get(VcsOperator.class).saveVersion(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); - } - } catch (Exception e1) { - FineLoggerFactory.getLogger().error(e1.getMessage()); + if (DesignerEnvManager.getEnvManager().isVcsEnable()) { + dealWithVcs(jt); } - } }); return saveButton; } + /** + * 版本控制 + * @param jt + */ + private void dealWithVcs(JTemplate jt) { + try { + String fileName = VcsHelper.getEditingFilename(); + int latestFileVersion = WorkContext.getCurrent().get(VcsOperator.class).getLatestFileVersion(fileName); + if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) { + WorkContext.getCurrent().get(VcsOperator.class).saveVersionFromCache(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); + String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); + FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); + } else { + WorkContext.getCurrent().get(VcsOperator.class).saveVersion(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error("vcs error: {}", e.getMessage()); + } + } + private UIButton createUndoButton() { undo = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/undo.png")); undo.setToolTipText(KeySetUtils.UNDO.getMenuKeySetName()); From dd073e92553effd885bc5a779cfe54757f0234bb Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 Apr 2019 15:33:51 +0800 Subject: [PATCH 11/21] =?UTF-8?q?REPORT-14835=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vcs/ui/FileVersionCellEditor.java | 15 ++++---------- .../mainframe/vcs/ui/FileVersionDialog.java | 5 +++-- .../mainframe/vcs/ui/FileVersionRowPanel.java | 6 +----- .../mainframe/vcs/ui/FileVersionsPanel.java | 6 +----- .../src/main/java/com/fr/start/Designer.java | 20 ++++++++----------- 5 files changed, 17 insertions(+), 35 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java index 265a4f69f0..b8bf36356d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java @@ -35,24 +35,17 @@ public class FileVersionCellEditor extends AbstractCellEditor implements TableCe @Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { - String fileOfVersion = null; + String fileOfVersion; Component editor = row == 0 ? firstRowPanel : renderAndEditor; if (isSelected) { return editor; } else if (row == 0) { String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); - try { - fileOfVersion = WorkContext.getCurrent().get(VcsOperator.class).getFileOfCurrent(path.replaceFirst("/", "")); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage()); - } + fileOfVersion = WorkContext.getCurrent().get(VcsOperator.class).getFileOfCurrent(path.replaceFirst("/", "")); } else { renderAndEditor.update((VcsEntity) value); - try { - fileOfVersion = WorkContext.getCurrent().get(VcsOperator.class).getFileOfFileVersion(((VcsEntity) value).getFilename(), ((VcsEntity) value).getVersion()); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage()); - } + fileOfVersion = WorkContext.getCurrent().get(VcsOperator.class).getFileOfFileVersion(((VcsEntity) value).getFilename(), ((VcsEntity) value).getVersion()); + } editor.setBackground(VcsHelper.TABLE_SELECT_BACKGROUND); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java index 4ac537a183..6bcb206a02 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java @@ -7,8 +7,9 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.i18n.Toolkit; -import com.fr.report.ReportContext; import com.fr.report.entity.VcsEntity; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.vcs.VcsOperator; import javax.swing.AbstractAction; import javax.swing.Box; @@ -59,7 +60,7 @@ public class FileVersionDialog extends UIDialog { public void actionPerformed(ActionEvent e) { FileVersionDialog.this.setVisible(false); Date date = dateEditor.getValue(); - List vcsEntities = ReportContext.getInstance().getVcsController().queryFilterFileVersions(date, new Date(date.getTime() + DELAY), textField.getText()); + List vcsEntities = WorkContext.getCurrent().get(VcsOperator.class).getFilterVersions(date, new Date(date.getTime() + DELAY), textField.getText()); FileVersionTable.getInstance().updateModel(1, vcsEntities); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java index 11464df749..45e80e2620 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java @@ -63,11 +63,7 @@ public class FileVersionRowPanel extends JPanel { public void actionPerformed(ActionEvent evt) { if (JOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Confirm"), Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Title"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { - try { - WorkContext.getCurrent().get(VcsOperator.class).rollbackTo(vcsEntity); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage()); - } + WorkContext.getCurrent().get(VcsOperator.class).rollbackTo(vcsEntity); FileVersionsPanel.getInstance().exitVcs(vcsEntity.getFilename()); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java index a85a2668ef..2e68e0e33c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java @@ -134,11 +134,7 @@ public class FileVersionsPanel extends BasicPane { } titleLabel.setText(filename); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); - try { - FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage()); - } + FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); } public void showFileVersionsPane() { diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index edd26cb05d..fae55cc4ae 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -292,18 +292,14 @@ public class Designer extends BaseDesigner { * @param jt */ private void dealWithVcs(JTemplate jt) { - try { - String fileName = VcsHelper.getEditingFilename(); - int latestFileVersion = WorkContext.getCurrent().get(VcsOperator.class).getLatestFileVersion(fileName); - if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) { - WorkContext.getCurrent().get(VcsOperator.class).saveVersionFromCache(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); - String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); - FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); - } else { - WorkContext.getCurrent().get(VcsOperator.class).saveVersion(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); - } - } catch (Exception e) { - FineLoggerFactory.getLogger().error("vcs error: {}", e.getMessage()); + String fileName = VcsHelper.getEditingFilename(); + int latestFileVersion = WorkContext.getCurrent().get(VcsOperator.class).getLatestFileVersion(fileName); + if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) { + WorkContext.getCurrent().get(VcsOperator.class).saveVersionFromCache(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); + String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); + FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); + } else { + WorkContext.getCurrent().get(VcsOperator.class).saveVersion(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); } } From a69ccf48f7efe2c0a74d419846e480173fcfe888 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 Apr 2019 15:43:03 +0800 Subject: [PATCH 12/21] rt --- designer-realize/src/main/java/com/fr/start/Designer.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index fae55cc4ae..3f194ca2a0 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -46,6 +46,7 @@ import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.module.Module; import com.fr.module.ModuleContext; +import com.fr.report.entity.VcsEntity; import com.fr.runtime.FineRuntime; import com.fr.stable.BuildContext; import com.fr.stable.OperatingSystem; @@ -293,7 +294,8 @@ public class Designer extends BaseDesigner { */ private void dealWithVcs(JTemplate jt) { String fileName = VcsHelper.getEditingFilename(); - int latestFileVersion = WorkContext.getCurrent().get(VcsOperator.class).getLatestFileVersion(fileName); + VcsEntity entity = WorkContext.getCurrent().get(VcsOperator.class).getLatestFileVersion(fileName); + int latestFileVersion = entity == null ? 0 : entity.getVersion(); if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) { WorkContext.getCurrent().get(VcsOperator.class).saveVersionFromCache(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); From 837727f66c57d22356e9efb8726b7e0977a0e7bc Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 Apr 2019 16:40:09 +0800 Subject: [PATCH 13/21] =?UTF-8?q?REPORT-14835=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VcsCacheFileNodeFile.java | 9 ++++---- .../mainframe/vcs/common/VcsHelper.java | 20 ++++++++++++++--- .../vcs/ui/FileVersionCellEditor.java | 3 +-- .../src/main/java/com/fr/start/Designer.java | 22 ++++++++++++------- 4 files changed, 36 insertions(+), 18 deletions(-) rename designer-base/src/main/java/com/fr/design/mainframe/vcs/{proxy => common}/VcsCacheFileNodeFile.java (88%) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/proxy/VcsCacheFileNodeFile.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCacheFileNodeFile.java similarity index 88% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/proxy/VcsCacheFileNodeFile.java rename to designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCacheFileNodeFile.java index 9ddc411d49..9933fc0e74 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/proxy/VcsCacheFileNodeFile.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCacheFileNodeFile.java @@ -1,7 +1,6 @@ -package com.fr.design.mainframe.vcs.proxy; +package com.fr.design.mainframe.vcs.common; import com.fr.base.io.XMLEncryptUtils; -import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; @@ -30,7 +29,7 @@ public class VcsCacheFileNodeFile extends FileNodeFILE { * @throws Exception */ @Override - public InputStream asInputStream() throws Exception { + public InputStream asInputStream() { if (node == null) { return null; } @@ -56,13 +55,13 @@ public class VcsCacheFileNodeFile extends FileNodeFILE { * @throws Exception */ @Override - public OutputStream asOutputStream() throws Exception { + public OutputStream asOutputStream() { if (ComparatorUtils.equals(node, null)) { return null; } String envPath = node.getEnvPath(); - // envPath必须以reportlets开头 + // envPath必须以reportLets开头 if (!envPath.startsWith(VcsHelper.VCS_CACHE_DIR)) { return null; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java index 4e1809d6d1..ee6135718a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java @@ -1,11 +1,13 @@ package com.fr.design.mainframe.vcs.common; import com.fr.base.BaseUtils; +import com.fr.design.DesignerEnvManager; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.TemplateTreePane; import com.fr.design.gui.itree.filetree.TemplateFileTree; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JTemplate; +import com.fr.report.entity.VcsEntity; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; @@ -13,14 +15,19 @@ import com.fr.workspace.WorkContext; import javax.swing.Icon; import javax.swing.border.EmptyBorder; import java.awt.Color; +import java.util.Date; import static com.fr.stable.StableUtils.pathJoin; - +/** + * Created by XiaXiang on 2019/4/17. + */ public class VcsHelper { - public final static String VCS_DIR = "vcs"; + private final static String VCS_DIR = "vcs"; public final static String VCS_CACHE_DIR = pathJoin(VCS_DIR, "cache"); + private static final int MINUTE = 60 * 1000; + public final static String CURRENT_USERNAME = WorkContext.getCurrent().isLocal() ? Toolkit.i18nText("Fine-Design_Vcs_Local_User") @@ -51,7 +58,7 @@ public class VcsHelper { if (fileTree.getSelectionPaths().length == 0) { return 0; } - //所有的num减去模板的num,得到文件夹的num + //所有的num减去模板的count,得到文件夹的count return fileTree.getSelectionPaths().length - fileTree.getSelectedTemplatePaths().length; } @@ -82,5 +89,12 @@ public class VcsHelper { return editingFilePath; } + public static boolean needSaveVersion(VcsEntity entity) { + if (entity == null) { + return true; + } + return new Date().getTime() - entity.getTime().getTime() > DesignerEnvManager.getEnvManager().getSaveInterval() * MINUTE || StringUtils.isNotBlank(entity.getCommitMsg()); + } + } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java index b8bf36356d..ccb6fa93f9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java @@ -6,9 +6,8 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.vcs.common.VcsHelper; -import com.fr.design.mainframe.vcs.proxy.VcsCacheFileNodeFile; +import com.fr.design.mainframe.vcs.common.VcsCacheFileNodeFile; import com.fr.file.filetree.FileNode; -import com.fr.log.FineLoggerFactory; import com.fr.report.entity.VcsEntity; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index 3f194ca2a0..fc38b989db 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -32,7 +32,7 @@ import com.fr.design.mainframe.bbs.UserInfoLabel; import com.fr.design.mainframe.bbs.UserInfoPane; import com.fr.design.mainframe.template.info.TemplateInfoCollector; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; -import com.fr.design.mainframe.vcs.proxy.VcsCacheFileNodeFile; +import com.fr.design.mainframe.vcs.common.VcsCacheFileNodeFile; import com.fr.design.mainframe.vcs.ui.FileVersionTable; import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.MenuDef; @@ -295,14 +295,20 @@ public class Designer extends BaseDesigner { private void dealWithVcs(JTemplate jt) { String fileName = VcsHelper.getEditingFilename(); VcsEntity entity = WorkContext.getCurrent().get(VcsOperator.class).getLatestFileVersion(fileName); - int latestFileVersion = entity == null ? 0 : entity.getVersion(); - if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) { - WorkContext.getCurrent().get(VcsOperator.class).saveVersionFromCache(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); - String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); - FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); - } else { - WorkContext.getCurrent().get(VcsOperator.class).saveVersion(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); + int latestFileVersion = 0; + if (entity != null) { + latestFileVersion = entity.getVersion(); } + if (VcsHelper.needSaveVersion(entity)) { + if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) { + WorkContext.getCurrent().get(VcsOperator.class).saveVersionFromCache(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); + String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); + FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); + } else { + WorkContext.getCurrent().get(VcsOperator.class).saveVersion(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); + } + } + } private UIButton createUndoButton() { From 011b82f5f1567d278989d41aa9865a07045a1d15 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 Apr 2019 16:46:18 +0800 Subject: [PATCH 14/21] rt --- designer-realize/src/main/java/com/fr/start/Designer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index fc38b989db..16e9cd687c 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -265,7 +265,7 @@ public class Designer extends BaseDesigner { */ @Override public UIButton[] createUp() { - return new UIButton[]{createSaveButton(), createUndoButton(), createRedoButton(), }; + return new UIButton[]{createSaveButton(), createUndoButton(), createRedoButton()}; } From 264b98625ec28a971278c2f6fb2763611ce20946 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 Apr 2019 17:54:54 +0800 Subject: [PATCH 15/21] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/vcs/common/VcsHelper.java | 6 +-- .../src/main/java/com/fr/start/Designer.java | 39 ++++++++++++------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java index ee6135718a..c5adecccf1 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java @@ -89,11 +89,11 @@ public class VcsHelper { return editingFilePath; } - public static boolean needSaveVersion(VcsEntity entity) { + public static boolean needDeleteVersion(VcsEntity entity) { if (entity == null) { - return true; + return false; } - return new Date().getTime() - entity.getTime().getTime() > DesignerEnvManager.getEnvManager().getSaveInterval() * MINUTE || StringUtils.isNotBlank(entity.getCommitMsg()); + return new Date().getTime() - entity.getTime().getTime() < DesignerEnvManager.getEnvManager().getSaveInterval() * MINUTE && StringUtils.isBlank(entity.getCommitMsg()); } diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index 16e9cd687c..a2f6c92c76 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -292,22 +292,31 @@ public class Designer extends BaseDesigner { * 版本控制 * @param jt */ - private void dealWithVcs(JTemplate jt) { - String fileName = VcsHelper.getEditingFilename(); - VcsEntity entity = WorkContext.getCurrent().get(VcsOperator.class).getLatestFileVersion(fileName); - int latestFileVersion = 0; - if (entity != null) { - latestFileVersion = entity.getVersion(); - } - if (VcsHelper.needSaveVersion(entity)) { - if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) { - WorkContext.getCurrent().get(VcsOperator.class).saveVersionFromCache(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); - String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); - FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); - } else { - WorkContext.getCurrent().get(VcsOperator.class).saveVersion(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); + private void dealWithVcs(final JTemplate jt) { + new Thread(new Runnable() { + @Override + public void run() { + String fileName = VcsHelper.getEditingFilename(); + VcsOperator operator = WorkContext.getCurrent().get(VcsOperator.class); + VcsEntity entity = operator.getFileVersionByIndex(fileName, 0); + int latestFileVersion = 0; + if (entity != null) { + latestFileVersion = entity.getVersion(); + } + if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) { + operator.saveVersionFromCache(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); + String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); + FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); + } else { + operator.saveVersion(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); + } + VcsEntity oldEntity = WorkContext.getCurrent().get(VcsOperator.class).getFileVersionByIndex(fileName, 1); + if (VcsHelper.needDeleteVersion(oldEntity)) { + operator.deleteVersion(oldEntity.getFilename(), oldEntity.getVersion()); + } + } - } + }).start(); } From 473a17bbcb46c74850bcd74dfe545afb57fa2810 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 Apr 2019 18:11:06 +0800 Subject: [PATCH 16/21] bug fix --- .../main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java index c5adecccf1..c922531f45 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java @@ -72,7 +72,7 @@ public class VcsHelper { } public static boolean isUnSelectedTemplate() { - return VcsHelper.containsFolderCounts() + VcsHelper.selectedTemplateCounts() > 1; + return VcsHelper.containsFolderCounts() + VcsHelper.selectedTemplateCounts() != 1; } public static String getEditingFilename() { From 499b9f70a68335741beddb90e6fea088e61df30a Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 Apr 2019 18:13:20 +0800 Subject: [PATCH 17/21] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java index c922531f45..06764bb9b4 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java @@ -76,7 +76,7 @@ public class VcsHelper { } public static String getEditingFilename() { - JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); String editingFilePath = jt.getEditingFILE().getPath(); if (editingFilePath.startsWith(ProjectConstants.REPORTLETS_NAME)) { editingFilePath = editingFilePath.replaceFirst(ProjectConstants.REPORTLETS_NAME, StringUtils.EMPTY); From 06128b908828ed61c2a28590c62d7849ac51d263 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 Apr 2019 18:36:04 +0800 Subject: [PATCH 18/21] =?UTF-8?q?REPORT-14835=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesignerFrameFileDealerPane.java | 6 +++--- .../fr/design/mainframe/vcs/ui/FileVersionCellEditor.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index 7685974df5..32b9d11401 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -302,13 +302,13 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt } // 如果模板已经打开了,关掉,避免出现2个同名tab(1个是模板,1个是版本) - closeOpendTemplate(path, isCurrentEditing); + closeOpenedTemplate(path, isCurrentEditing); FileVersionsPanel fileVersionTablePanel = FileVersionsPanel.getInstance(); fileVersionTablePanel.showFileVersionsPane(); } - private void closeOpendTemplate(String path, boolean isCurrentEditing) { - for (JTemplate jTemplate : HistoryTemplateListCache.getInstance().getHistoryList()) { + private void closeOpenedTemplate(String path, boolean isCurrentEditing) { + for (JTemplate jTemplate : HistoryTemplateListCache.getInstance().getHistoryList()) { if (ComparatorUtils.equals(jTemplate.getEditingFILE().getPath(), path)) { if (isCurrentEditing) { MutilTempalteTabPane.getInstance().setIsCloseCurrent(true); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java index ccb6fa93f9..bdb4bc1eea 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java @@ -50,7 +50,7 @@ public class FileVersionCellEditor extends AbstractCellEditor implements TableCe editor.setBackground(VcsHelper.TABLE_SELECT_BACKGROUND); if (StringUtils.isNotEmpty(fileOfVersion)) { //先关闭当前打开的模板版本 - JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); jt.stopEditing(); MutilTempalteTabPane.getInstance().setIsCloseCurrent(true); MutilTempalteTabPane.getInstance().closeFormat(jt); From 68999ff909bad062c5625c1da4a0309e1f243199 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 Apr 2019 19:29:59 +0800 Subject: [PATCH 19/21] =?UTF-8?q?REPORT-14835=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/vcs/common/VcsHelper.java | 16 ++++++++-------- .../mainframe/vcs/ui/EditFileVersionDialog.java | 11 ++++++----- .../mainframe/vcs/ui/FileVersionDialog.java | 3 ++- .../mainframe/vcs/ui/FileVersionRowPanel.java | 4 ++-- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java index 06764bb9b4..310d4e7e31 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java @@ -1,12 +1,12 @@ package com.fr.design.mainframe.vcs.common; -import com.fr.base.BaseUtils; import com.fr.design.DesignerEnvManager; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.TemplateTreePane; import com.fr.design.gui.itree.filetree.TemplateFileTree; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JTemplate; +import com.fr.general.IOUtils; import com.fr.report.entity.VcsEntity; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; @@ -40,13 +40,13 @@ public class VcsHelper { public final static EmptyBorder EMPTY_BORDER_BOTTOM = new EmptyBorder(10, 10, 10, 10); - public final static Icon VCS_LIST_PNG = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/vcs_list.png"); - public final static Icon VCS_BACK_PNG = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/vcs_back.png"); - public final static Icon VCS_FILTER_PNG = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_filter@1x.png"); - public final static Icon VCS_EDIT_PNG = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_edit.png"); - public final static Icon VCS_DELETE_PNG = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_delete.png"); - public final static Icon VCS_USER_PNG = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_user@1x.png"); - public final static Icon VCS_REVERT = BaseUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_revert.png"); + public final static Icon VCS_LIST_PNG = IOUtils.readIcon("/com/fr/design/mainframe/vcs/images/vcs_list.png"); + public final static Icon VCS_BACK_PNG = IOUtils.readIcon("/com/fr/design/mainframe/vcs/images/vcs_back.png"); + public final static Icon VCS_FILTER_PNG = IOUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_filter@1x.png"); + public final static Icon VCS_EDIT_PNG = IOUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_edit.png"); + public final static Icon VCS_DELETE_PNG = IOUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_delete.png"); + public final static Icon VCS_USER_PNG = IOUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_user@1x.png"); + public final static Icon VCS_REVERT = IOUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_revert.png"); private static int containsFolderCounts() { TemplateFileTree fileTree = TemplateTreePane.getInstance().getTemplateFileTree(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java index 455b0dac1a..f6533de4df 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java @@ -17,6 +17,7 @@ import java.awt.BorderLayout; import java.awt.Component; import java.awt.FlowLayout; import java.awt.Frame; +import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -42,7 +43,7 @@ public class EditFileVersionDialog extends UIDialog { initComponents(); setModal(true); - setTitle(InterProviderFactory.getProvider().getLocText("Fine-Design_Vcs_Save_Version")); + setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Vcs_Save_Version")); setSize(300, 220); setResizable(false); GUICoreUtils.centerWindow(this); @@ -52,13 +53,13 @@ public class EditFileVersionDialog extends UIDialog { private void initComponents() { JPanel fontPane = new JPanel(new BorderLayout()); - fontPane.add(new UILabel(" " + InterProviderFactory.getProvider().getLocText("Fine-Design_Vcs_Version_Message") + ":"), BorderLayout.NORTH); + fontPane.add(new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Vcs_Version_Message") + ":"), BorderLayout.NORTH); msgTestArea.setBorder(null); UIScrollPane scrollPane = new UIScrollPane(msgTestArea); Component[][] components = new Component[][]{ - new Component[]{new UILabel(" " + InterProviderFactory.getProvider().getLocText("Fine-Design_Vcs_Version_Number") + ":"), versionLabel}, + new Component[]{new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Vcs_Version_Number") + ":"), versionLabel}, new Component[]{fontPane, scrollPane} }; double[] rowSizes = new double[]{25, 100}; @@ -69,8 +70,8 @@ public class EditFileVersionDialog extends UIDialog { JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT)); add(buttonPane, BorderLayout.SOUTH); - UIButton ok = new UIButton(InterProviderFactory.getProvider().getLocText("OK")); - UIButton cancel = new UIButton(InterProviderFactory.getProvider().getLocText("Cancel")); + UIButton ok = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_OK")); + UIButton cancel = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Design_Action_Cancel")); buttonPane.add(ok); buttonPane.add(cancel); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java index 6bcb206a02..6f6c925382 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java @@ -8,6 +8,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.i18n.Toolkit; import com.fr.report.entity.VcsEntity; +import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.server.vcs.VcsOperator; @@ -43,7 +44,7 @@ public class FileVersionDialog extends UIDialog { upBox.setBorder(EMPTY_BORDER_BOTTOM); upBox.add(new UILabel(Toolkit.i18nText("Fine-Design_Vcs_buildTime"))); upBox.add(Box.createHorizontalGlue()); - dateEditor = new DateEditor(new Date(), true, "", UIDatePicker.STYLE_CN_DATE1); + dateEditor = new DateEditor(new Date(), true, StringUtils.EMPTY, UIDatePicker.STYLE_CN_DATE1); upBox.add(dateEditor); Box downBox = Box.createHorizontalBox(); downBox.setBorder(EMPTY_BORDER_BOTTOM); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java index 45e80e2620..cc2e399838 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java @@ -32,7 +32,7 @@ public class FileVersionRowPanel extends JPanel { private VcsEntity vcsEntity; private UILabel versionLabel = new UILabel(); - private UILabel usernameLabel = new UILabel("", VcsHelper.VCS_USER_PNG, SwingConstants.LEFT); + private UILabel usernameLabel = new UILabel(StringUtils.EMPTY, VcsHelper.VCS_USER_PNG, SwingConstants.LEFT); private UITextPane timeAndMsgLabel = new UITextPane(); private UILabel timeLabel = new UILabel(); private EditFileVersionDialog editDialog; @@ -74,7 +74,7 @@ public class FileVersionRowPanel extends JPanel { deleteBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { - if (JOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Vcs_Version_Delete_Confirm"), Toolkit.i18nText("FR-Designer_Remove"), + if (JOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Vcs_Delete-Confirm"), Toolkit.i18nText("Fine-Design_Vcs_Remove"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { try { WorkContext.getCurrent().get(VcsOperator.class).deleteVersion(vcsEntity.getFilename(), vcsEntity.getVersion()); From 13eb847dc074fda896d3204a05ac7e60777d7372 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 Apr 2019 19:41:41 +0800 Subject: [PATCH 20/21] =?UTF-8?q?REPORT-14835=20=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java index cc2e399838..78f8c62f44 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java @@ -57,7 +57,7 @@ public class FileVersionRowPanel extends JPanel { // confirm + delete UIButton confirmBtn = new UIButton(VcsHelper.VCS_REVERT); confirmBtn.set4ToolbarButton(); - confirmBtn.setToolTipText(Toolkit.i18nText("Fine-Design_Vcs_Version_Revert")); + confirmBtn.setToolTipText(Toolkit.i18nText("Fine-Design_Vcs_Revert")); confirmBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { @@ -70,7 +70,7 @@ public class FileVersionRowPanel extends JPanel { }); UIButton deleteBtn = new UIButton(VcsHelper.VCS_DELETE_PNG); deleteBtn.set4ToolbarButton(); - deleteBtn.setToolTipText(Toolkit.i18nText("Fine-Design_Vcs_Version_Delete")); + deleteBtn.setToolTipText(Toolkit.i18nText("Fine-Design_Vcs_Delete")); deleteBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { @@ -93,6 +93,7 @@ public class FileVersionRowPanel extends JPanel { }); UIButton editBtn = new UIButton(VcsHelper.VCS_EDIT_PNG); editBtn.set4ToolbarButton(); + editBtn.setToolTipText(Toolkit.i18nText("Fine-Design_Vcs_Edit")); editBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { From b8e00090508f20e43dfd542b0d050569edf252e6 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 Apr 2019 19:48:38 +0800 Subject: [PATCH 21/21] =?UTF-8?q?REPORT-14835=20=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/vcs/common/VcsHelper.java | 14 +++++++------- .../fr/design/images/vcs}/icon_back_normal@2x.png | Bin .../com/fr/design/images/vcs}/icon_delete.png | Bin .../com/fr/design/images/vcs}/icon_delete@2x.png | Bin .../com/fr/design/images/vcs}/icon_edit.png | Bin .../com/fr/design/images/vcs}/icon_edit@2x.png | Bin .../com/fr/design/images/vcs}/icon_filter@1x.png | Bin .../com/fr/design/images/vcs}/icon_filter@2x.png | Bin .../fr/design/images/vcs}/icon_list_disabled.png | Bin .../design/images/vcs}/icon_list_disabled@2x.png | Bin .../fr/design/images/vcs}/icon_list_normal@2x.png | Bin .../com/fr/design/images/vcs}/icon_revert.png | Bin .../com/fr/design/images/vcs}/icon_revert@2x.png | Bin .../fr/design/images/vcs}/icon_save_disabled.png | Bin .../design/images/vcs}/icon_save_disabled@2x.png | Bin .../fr/design/images/vcs}/icon_save_normal@2x.png | Bin .../com/fr/design/images/vcs}/icon_user@1x.png | Bin .../com/fr/design/images/vcs}/icon_user@2x.png | Bin .../com/fr/design/images/vcs}/vcs_back.png | Bin .../com/fr/design/images/vcs}/vcs_list.png | Bin .../com/fr/design/images/vcs}/vcs_save.png | Bin 21 files changed, 7 insertions(+), 7 deletions(-) rename designer-base/src/main/{java/com/fr/design/mainframe/vcs/images => resources/com/fr/design/images/vcs}/icon_back_normal@2x.png (100%) rename designer-base/src/main/{java/com/fr/design/mainframe/vcs/images => resources/com/fr/design/images/vcs}/icon_delete.png (100%) rename designer-base/src/main/{java/com/fr/design/mainframe/vcs/images => resources/com/fr/design/images/vcs}/icon_delete@2x.png (100%) rename designer-base/src/main/{java/com/fr/design/mainframe/vcs/images => resources/com/fr/design/images/vcs}/icon_edit.png (100%) rename designer-base/src/main/{java/com/fr/design/mainframe/vcs/images => resources/com/fr/design/images/vcs}/icon_edit@2x.png (100%) rename designer-base/src/main/{java/com/fr/design/mainframe/vcs/images => resources/com/fr/design/images/vcs}/icon_filter@1x.png (100%) rename designer-base/src/main/{java/com/fr/design/mainframe/vcs/images => resources/com/fr/design/images/vcs}/icon_filter@2x.png (100%) rename designer-base/src/main/{java/com/fr/design/mainframe/vcs/images => resources/com/fr/design/images/vcs}/icon_list_disabled.png (100%) rename designer-base/src/main/{java/com/fr/design/mainframe/vcs/images => resources/com/fr/design/images/vcs}/icon_list_disabled@2x.png (100%) rename designer-base/src/main/{java/com/fr/design/mainframe/vcs/images => resources/com/fr/design/images/vcs}/icon_list_normal@2x.png (100%) rename designer-base/src/main/{java/com/fr/design/mainframe/vcs/images => resources/com/fr/design/images/vcs}/icon_revert.png (100%) rename designer-base/src/main/{java/com/fr/design/mainframe/vcs/images => resources/com/fr/design/images/vcs}/icon_revert@2x.png (100%) rename designer-base/src/main/{java/com/fr/design/mainframe/vcs/images => resources/com/fr/design/images/vcs}/icon_save_disabled.png (100%) rename designer-base/src/main/{java/com/fr/design/mainframe/vcs/images => resources/com/fr/design/images/vcs}/icon_save_disabled@2x.png (100%) rename designer-base/src/main/{java/com/fr/design/mainframe/vcs/images => resources/com/fr/design/images/vcs}/icon_save_normal@2x.png (100%) rename designer-base/src/main/{java/com/fr/design/mainframe/vcs/images => resources/com/fr/design/images/vcs}/icon_user@1x.png (100%) rename designer-base/src/main/{java/com/fr/design/mainframe/vcs/images => resources/com/fr/design/images/vcs}/icon_user@2x.png (100%) rename designer-base/src/main/{java/com/fr/design/mainframe/vcs/images => resources/com/fr/design/images/vcs}/vcs_back.png (100%) rename designer-base/src/main/{java/com/fr/design/mainframe/vcs/images => resources/com/fr/design/images/vcs}/vcs_list.png (100%) rename designer-base/src/main/{java/com/fr/design/mainframe/vcs/images => resources/com/fr/design/images/vcs}/vcs_save.png (100%) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java index 310d4e7e31..27c606f4c3 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java @@ -40,13 +40,13 @@ public class VcsHelper { public final static EmptyBorder EMPTY_BORDER_BOTTOM = new EmptyBorder(10, 10, 10, 10); - public final static Icon VCS_LIST_PNG = IOUtils.readIcon("/com/fr/design/mainframe/vcs/images/vcs_list.png"); - public final static Icon VCS_BACK_PNG = IOUtils.readIcon("/com/fr/design/mainframe/vcs/images/vcs_back.png"); - public final static Icon VCS_FILTER_PNG = IOUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_filter@1x.png"); - public final static Icon VCS_EDIT_PNG = IOUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_edit.png"); - public final static Icon VCS_DELETE_PNG = IOUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_delete.png"); - public final static Icon VCS_USER_PNG = IOUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_user@1x.png"); - public final static Icon VCS_REVERT = IOUtils.readIcon("/com/fr/design/mainframe/vcs/images/icon_revert.png"); + public final static Icon VCS_LIST_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/vcs_list.png"); + public final static Icon VCS_BACK_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/vcs_back.png"); + public final static Icon VCS_FILTER_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/icon_filter@1x.png"); + public final static Icon VCS_EDIT_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/icon_edit.png"); + public final static Icon VCS_DELETE_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/icon_delete.png"); + public final static Icon VCS_USER_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/icon_user@1x.png"); + public final static Icon VCS_REVERT = IOUtils.readIcon("/com/fr/design/images/vcs/icon_revert.png"); private static int containsFolderCounts() { TemplateFileTree fileTree = TemplateTreePane.getInstance().getTemplateFileTree(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_back_normal@2x.png b/designer-base/src/main/resources/com/fr/design/images/vcs/icon_back_normal@2x.png similarity index 100% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_back_normal@2x.png rename to designer-base/src/main/resources/com/fr/design/images/vcs/icon_back_normal@2x.png diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_delete.png b/designer-base/src/main/resources/com/fr/design/images/vcs/icon_delete.png similarity index 100% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_delete.png rename to designer-base/src/main/resources/com/fr/design/images/vcs/icon_delete.png diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_delete@2x.png b/designer-base/src/main/resources/com/fr/design/images/vcs/icon_delete@2x.png similarity index 100% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_delete@2x.png rename to designer-base/src/main/resources/com/fr/design/images/vcs/icon_delete@2x.png diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_edit.png b/designer-base/src/main/resources/com/fr/design/images/vcs/icon_edit.png similarity index 100% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_edit.png rename to designer-base/src/main/resources/com/fr/design/images/vcs/icon_edit.png diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_edit@2x.png b/designer-base/src/main/resources/com/fr/design/images/vcs/icon_edit@2x.png similarity index 100% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_edit@2x.png rename to designer-base/src/main/resources/com/fr/design/images/vcs/icon_edit@2x.png diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_filter@1x.png b/designer-base/src/main/resources/com/fr/design/images/vcs/icon_filter@1x.png similarity index 100% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_filter@1x.png rename to designer-base/src/main/resources/com/fr/design/images/vcs/icon_filter@1x.png diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_filter@2x.png b/designer-base/src/main/resources/com/fr/design/images/vcs/icon_filter@2x.png similarity index 100% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_filter@2x.png rename to designer-base/src/main/resources/com/fr/design/images/vcs/icon_filter@2x.png diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_list_disabled.png b/designer-base/src/main/resources/com/fr/design/images/vcs/icon_list_disabled.png similarity index 100% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_list_disabled.png rename to designer-base/src/main/resources/com/fr/design/images/vcs/icon_list_disabled.png diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_list_disabled@2x.png b/designer-base/src/main/resources/com/fr/design/images/vcs/icon_list_disabled@2x.png similarity index 100% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_list_disabled@2x.png rename to designer-base/src/main/resources/com/fr/design/images/vcs/icon_list_disabled@2x.png diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_list_normal@2x.png b/designer-base/src/main/resources/com/fr/design/images/vcs/icon_list_normal@2x.png similarity index 100% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_list_normal@2x.png rename to designer-base/src/main/resources/com/fr/design/images/vcs/icon_list_normal@2x.png diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_revert.png b/designer-base/src/main/resources/com/fr/design/images/vcs/icon_revert.png similarity index 100% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_revert.png rename to designer-base/src/main/resources/com/fr/design/images/vcs/icon_revert.png diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_revert@2x.png b/designer-base/src/main/resources/com/fr/design/images/vcs/icon_revert@2x.png similarity index 100% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_revert@2x.png rename to designer-base/src/main/resources/com/fr/design/images/vcs/icon_revert@2x.png diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_save_disabled.png b/designer-base/src/main/resources/com/fr/design/images/vcs/icon_save_disabled.png similarity index 100% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_save_disabled.png rename to designer-base/src/main/resources/com/fr/design/images/vcs/icon_save_disabled.png diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_save_disabled@2x.png b/designer-base/src/main/resources/com/fr/design/images/vcs/icon_save_disabled@2x.png similarity index 100% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_save_disabled@2x.png rename to designer-base/src/main/resources/com/fr/design/images/vcs/icon_save_disabled@2x.png diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_save_normal@2x.png b/designer-base/src/main/resources/com/fr/design/images/vcs/icon_save_normal@2x.png similarity index 100% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_save_normal@2x.png rename to designer-base/src/main/resources/com/fr/design/images/vcs/icon_save_normal@2x.png diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_user@1x.png b/designer-base/src/main/resources/com/fr/design/images/vcs/icon_user@1x.png similarity index 100% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_user@1x.png rename to designer-base/src/main/resources/com/fr/design/images/vcs/icon_user@1x.png diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_user@2x.png b/designer-base/src/main/resources/com/fr/design/images/vcs/icon_user@2x.png similarity index 100% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/images/icon_user@2x.png rename to designer-base/src/main/resources/com/fr/design/images/vcs/icon_user@2x.png diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/vcs_back.png b/designer-base/src/main/resources/com/fr/design/images/vcs/vcs_back.png similarity index 100% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/images/vcs_back.png rename to designer-base/src/main/resources/com/fr/design/images/vcs/vcs_back.png diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/vcs_list.png b/designer-base/src/main/resources/com/fr/design/images/vcs/vcs_list.png similarity index 100% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/images/vcs_list.png rename to designer-base/src/main/resources/com/fr/design/images/vcs/vcs_list.png diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/images/vcs_save.png b/designer-base/src/main/resources/com/fr/design/images/vcs/vcs_save.png similarity index 100% rename from designer-base/src/main/java/com/fr/design/mainframe/vcs/images/vcs_save.png rename to designer-base/src/main/resources/com/fr/design/images/vcs/vcs_save.png