Browse Source

Merge pull request #10355 in DESIGN/design from release/11.0 to final/11.0

* commit '9b7cc899a330a92ad96be8cd3c1df40ac3f8d9a2':
  REPORT-82112 模板锁定,超管强制解锁的按钮没了--抽方法,看起来更整洁
  REPORT-82112 模板锁定,超管强制解锁的按钮没了--改了一下非final变量改回小写
  REPORT-82112 模板锁定,超管强制解锁的按钮没了
  REPORT-81973 搜索模板时没预加载完就开始搜索,没构建出模板树
  REPORT-75998 更换菜单位置到“模板”
  REPORT-81880 优化模板定位逻辑
  REPORT-81880 优化模板定位逻辑
  REPORT-81880 优化模板定位逻辑
new-design
superman 2 years ago
parent
commit
578727ea06
  1. 3
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java
  2. 50
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  3. 36
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  4. 5
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  5. 6
      designer-base/src/main/java/com/fr/design/mainframe/manager/search/searcher/control/pane/TemplateTreeSearchToolbarPane.java
  6. 8
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  7. 18
      designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java
  8. BIN
      designer-base/src/main/resources/com/fr/design/images/replace/replace.png
  9. 3
      designer-base/src/main/resources/com/fr/design/images/replace/replace_normal.svg
  10. 1
      designer-realize/src/main/java/com/fr/design/actions/replace/ITReplaceAction.java
  11. 7
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java

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

@ -306,8 +306,7 @@ public class TemplateFileTree extends EnvFileTree {
if (interceptRefresh(root)) {
return;
}
if (!TemplateTreeSearchManager.getInstance().isRefreshing()) {
if (!TemplateTreeSearchManager.getInstance().isRefreshing() || TemplateTreeSearchManager.getInstance().allFileNodes().size() != allTreeNode.size()) {
currentTreeMode.clear();
calculateNode.clear();
allTreeNode = TemplateTreeSearchManager.getInstance().allFileNodes().entrySet().stream().collect(

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

@ -886,6 +886,54 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
layeredPane.repaint();
}
/**
* 激活模板
* <p>
* activateJTemplate需要模板存在openTemplate需要模板保存过该方法模板保存与未保存皆可激活模板如果关闭并且保存过会重新打开
*
* @param templatePath 模板路径 template.getPath()
*/
public void openOrActiveTemplate(String templatePath) {
//没保存过的模板如果要激活就要从当前历史模板列表里面找
String templateName = getTemplateNameFromPath(templatePath);
if (isTemplateNeverSaved(templatePath)) {
int index = HistoryTemplateListCache.getInstance().contains(templateName);
//如果历史模板列表中存在则激活
if (index != -1) {
DesignerContext.getDesignerFrame().activateJTemplate(HistoryTemplateListCache.getInstance().getTemplate(index));
}
} else {
DesignerContext.getDesignerFrame().openTemplate(FILEFactory.createFILE(templatePath));
}
}
/**
* 指定路径的模板是否保存过
*
* @param templatePath 模板路径 template.getPath()
* @return 如果模板没保存过则返回true
*/
private boolean isTemplateNeverSaved(String templatePath) {
FILE tplFile = FILEFactory.createFILE(templatePath);
//没保存过的模板获取到的templatePath所生成的FILE文件会不存在
return tplFile == null || !tplFile.exists() || StringUtils.isEmpty(templatePath);
}
/**
* 根据模板路径获取模板名称
* @param templatePath 模板路径 template.getPath()
* @return 模板名
*/
private String getTemplateNameFromPath(String templatePath) {
FILE tplFile = FILEFactory.createFILE(templatePath);
String templateName = StringUtils.EMPTY;
if (tplFile != null) {
templateName = tplFile.getName();
}
return templateName;
}
/**
* 当前模板 停用失败
*
@ -1231,6 +1279,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
/**
* 判断是否正在进行服务器配置
*
* @return boolean
*/
public boolean isServerConfig() {
@ -1239,6 +1288,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
/**
* 设置是否正在进行服务器配置
*
* @param serverConfig
*/
public void setServerConfig(boolean serverConfig) {

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

@ -172,8 +172,8 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
tooBarPane.add(new UIMenuHighLight(), BorderLayout.SOUTH);
searchToolbarPane = new TemplateTreeSearchToolbarPane(toolBar);
searchToolbarPane.add(createUpToolBarPane(), BorderLayout.EAST);
searchToolbarPane.setPreferredSize(new Dimension(this.getWidth(), 23));
add(searchToolbarPane, BorderLayout.NORTH);
CardLayout card;
JPanel cardPane = new JPanel(card = new CardLayout());
@ -183,7 +183,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
card.show(cardPane, FILE);
TemplateTreePane.getInstance().setToolbarStateChangeListener(this);
add(cardPane, BorderLayout.CENTER);
stateChange();
}
@ -219,7 +218,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
private JPanel createUpToolBarPane() {
JPanel panel = new JPanel(new BorderLayout());
panel.add(toolBar, BorderLayout.CENTER);
if (WorkContext.getCurrent().isRoot()) {
rightToolBar = new UIToolbar(FlowLayout.RIGHT);
rightToolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.TOOLBAR_BORDER_COLOR));
@ -461,6 +459,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public void actionPerformed(ActionEvent e) {
// 交换层级
searchToolbarPane.switchPane(TemplateTreeSearchToolbarPane.SEARCH_PANE);
refreshRightToolBarByContentPaneType();
TemplateTreePane.getInstance().refreshDockingView();
TemplateTreeSearchManager.getInstance().switchToSearch(TemplateTreePane.getInstance().getTemplateFileTree());
}
@ -595,15 +594,36 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
}
}
/**
* 搜索状态下不显示rightToolBar
*/
public void refreshRightToolBarByContentPaneType() {
if (rightToolBar != null) {
if (StringUtils.equals(TemplateTreeSearchToolbarPane.contentPaneType, TemplateTreeSearchToolbarPane.SEARCH_PANE)) {
rightToolBar.setVisible(false);
}
}
}
public void refreshRightToolBarBy(FileNode fileNode) {
refreshRightToolBarByNode(fileNode);
refreshRightToolBarByContentPaneType();
}
/**
* 根据当前选中节点判断是否锁定状态
*
* @param fileNode 选中文件节点
*/
public void refreshRightToolBarByNode(FileNode fileNode) {
if (rightToolBar != null) {
boolean locked = fileNode != null
&& StringUtils.isNotEmpty(fileNode.getLock())
&& !ComparatorUtils.equals(fileNode.getLock(), fileNode.getUserID());
&& StringUtils.isNotEmpty(fileNode.getLock())
&& !ComparatorUtils.equals(fileNode.getLock(), fileNode.getUserID());
boolean visible = locked
&& WorkContext.getCurrent().isRoot()
&& WorkContext.getCurrent().get(LockInfoOperator.class).isUnLockable()
&& !WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(fileNode.getEnvPath());
&& WorkContext.getCurrent().isRoot()
&& WorkContext.getCurrent().get(LockInfoOperator.class).isUnLockable()
&& !WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(fileNode.getEnvPath());
rightToolBar.setVisible(visible);
}
}

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

@ -54,6 +54,7 @@ import com.fr.design.mainframe.toolbar.VcsScene;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.NameSeparator;
import com.fr.design.menu.ShortCut;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.preview.PagePreview;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.DesignUtils;
@ -1109,6 +1110,10 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
tplMenu.addShortCut(shortCuts4Authority());
}
//查找替换
tplMenu.addShortCut(new NameSeparator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Replace_Name_Separate")));
tplMenu.addShortCut((ShortCut) DesignModuleFactory.getITReplaceAction());
return new MenuDef[]{tplMenu};
}

6
designer-base/src/main/java/com/fr/design/mainframe/manager/search/searcher/control/pane/TemplateTreeSearchToolbarPane.java

@ -39,6 +39,11 @@ public class TemplateTreeSearchToolbarPane extends JPanel implements TreeSearchS
public static final String SEARCH_PANE = "searchPane";
/**
* 判断工具栏是处于搜索栏还是非搜索栏
*/
public static String contentPaneType = "toolbarPane";
/**
* 工具栏
*/
@ -187,6 +192,7 @@ public class TemplateTreeSearchToolbarPane extends JPanel implements TreeSearchS
*/
public void switchPane(String name) {
cardLayout.show(contentPane, name);
contentPaneType = name;
}
public void setPlaceHolder(String placeHolder) {

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

@ -580,13 +580,7 @@ public abstract class ToolBarMenuDock {
}
shortCuts.add(new AboutAction());
try {
if (DesignModuleFactory.getITReplaceAction() != null) {
shortCuts.add((ShortCut) DesignModuleFactory.getITReplaceAction().newInstance());
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return shortCuts.toArray(new ShortCut[0]);
}

18
designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java

@ -19,6 +19,7 @@ import com.fr.log.FineLoggerFactory;
import com.fr.plugin.solution.sandbox.collection.PluginSandboxCollections;
import com.fr.stable.StableUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.lang.reflect.Constructor;
import java.awt.Dialog;
@ -129,8 +130,21 @@ public class DesignModuleFactory {
instance.ITReplaceAction = r;
}
public static Class getITReplaceAction() {
return instance.ITReplaceAction;
/**
* 获取查找替换
*
* @return ITReplaceAction
*/
@Nullable
public static Object getITReplaceAction() {
try {
if (instance.ITReplaceAction != null) {
return instance.ITReplaceAction.newInstance();
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return null;
}
/**

BIN
designer-base/src/main/resources/com/fr/design/images/replace/replace.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

3
designer-base/src/main/resources/com/fr/design/images/replace/replace_normal.svg

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.90857 12.5269C3.871 12.5269 1.40857 10.0644 1.40857 7.02686C1.40857 3.98929 3.871 1.52686 6.90857 1.52686C9.94614 1.52686 12.4086 3.98929 12.4086 7.02686C12.4086 8.28787 11.9842 9.44977 11.2705 10.3775L14.3701 13.5236C14.6528 13.8062 14.6528 14.2645 14.3701 14.5472C14.0874 14.8298 13.6292 14.8298 13.3465 14.5472L10.2452 11.3995C9.31981 12.1067 8.16326 12.5269 6.90857 12.5269ZM11.4086 7.02686C11.4086 9.51214 9.39385 11.5269 6.90857 11.5269C4.42329 11.5269 2.40857 9.51214 2.40857 7.02686C2.40857 4.54157 4.42329 2.52686 6.90857 2.52686C9.39385 2.52686 11.4086 4.54157 11.4086 7.02686Z" fill="#333334"/>
</svg>

After

Width:  |  Height:  |  Size: 761 B

1
designer-realize/src/main/java/com/fr/design/actions/replace/ITReplaceAction.java

@ -29,6 +29,7 @@ public class ITReplaceAction extends UpdateAction {
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setAccelerator(getMenuKeySet().getKeyStroke());
this.setSmallIcon("/com/fr/design/images/replace/replace");
}
private static final MenuKeySet IT_REPLACE = new MenuKeySet() {

7
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java

@ -6,10 +6,12 @@ import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.file.FILE;
import com.fr.file.FILEFactory;
import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import javax.swing.AbstractCellEditor;
@ -44,14 +46,13 @@ public class ITTableButton extends AbstractCellEditor implements TableCellEditor
if (StringUtils.isNotEmpty(GeneralUtils.objectToString(content.getTrlString()))) {
ITReplaceMainDialog.setITReplaceFlag(true);
TRL trl = new TRL(GeneralUtils.objectToString(content.getTrlString()));
DesignerContext.getDesignerFrame().openTemplate(FILEFactory.createFILE(content.getTemplatePath()));
DesignerContext.getDesignerFrame().openOrActiveTemplate(content.getTemplatePath());
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().navigate(trl);
}
ITReplaceMainDialog.setITReplaceFlag(false);
}
});
}
/**

Loading…
Cancel
Save