Browse Source

Pull request #5005: REPORT-53633【FR11】新自适应开发者预览支持调整模板布局

Merge in DESIGN/design from ~KERRY/design_10.0:release/11.0 to release/11.0

* commit '29e1b13d8fdc07600e0152bf539ebd29493400c7':
  REPORT-53633【FR11】新自适应开发者预览支持调整模板布局
fix-lag
kerry 3 years ago
parent
commit
94c88d527c
  1. 14
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  2. 12
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  3. 9
      designer-base/src/main/java/com/fr/design/fun/PreviewProvider.java
  4. 2
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java
  5. 3
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  6. 16
      designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java

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

@ -731,6 +731,16 @@ public class MutilTempalteTabPane extends JComponent {
}
}
/**
* 后台关闭当前编辑模板
*/
public void closeCurrentTpl(){
JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
this.setIsCloseCurrent(true);
this.closeFormat(jTemplate);
this.closeSpecifiedTemplate(jTemplate);
}
/**
* 关闭模板
*
@ -765,8 +775,8 @@ public class MutilTempalteTabPane extends JComponent {
// 如果关闭的模板是当前选中的模板,则重新激活当前 selectIndex 的模板;
// selectIndex 没有变化,但是对应的模板已经变成了前一张模板
if (closeIconIndex == selectedIndex || isCloseCurrent) {
// 如果 closeIconIndex 是最后一个被渲染画出的,那么预览上一个,防止数组越界
if (closeIconIndex >= maxPaintIndex) {
// 如果当前关闭的模板在最右侧,那么预览上一个,防止数组越界
if (selectedIndex >= maxPaintIndex) {
// selectIndex 不会 <0 因为如果关闭的是打开的最后一个模板,那么关闭之后 openedTemplate.isEmpty() = true
selectedIndex--;
}

12
designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java

@ -17,6 +17,7 @@ import com.fr.file.FILE;
import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode;
import com.fr.file.filetree.IOFileNodeFilter;
import com.fr.form.fit.web.editpreview.FileLockStateObservable;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
@ -47,6 +48,8 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Objects;
import java.util.Observable;
import java.util.Observer;
import static javax.swing.JOptionPane.WARNING_MESSAGE;
import static javax.swing.JOptionPane.YES_NO_OPTION;
@ -76,6 +79,13 @@ public class TemplateTreePane extends JPanel implements FileOperations {
scrollPane.setBorder(null);
contentPane.add(scrollPane, BorderLayout.CENTER);
FileLockStateObservable.getInstance().addObserver(new Observer() {
@Override
public void update(Observable o, Object arg) {
TemplateTreePane.this.refresh();
}
});
/*
* Tree.MouseAdapter
*/
@ -202,7 +212,6 @@ public class TemplateTreePane extends JPanel implements FileOperations {
@Override
public void openFile() {
// 判断是否是远程设计的锁定文件
if (!WorkContext.getCurrent().isLocal()) {
FileNode node = reportletsTree.getSelectedFileNode();
if (node == null) {
return;
@ -211,7 +220,6 @@ public class TemplateTreePane extends JPanel implements FileOperations {
if (lock != null && !lock.equals(node.getUserID())) {
return;
}
}
String reportPath = reportletsTree.getSelectedTemplatePath();
final String selectedFilePath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, reportPath);
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(selectedFilePath, false)));

9
designer-base/src/main/java/com/fr/design/fun/PreviewProvider.java

@ -2,6 +2,7 @@ package com.fr.design.fun;
import com.fr.design.mainframe.JTemplate;
import com.fr.stable.Filter;
import com.fr.stable.StringUtils;
import com.fr.stable.fun.mark.Mutable;
import java.util.Map;
@ -62,5 +63,13 @@ public interface PreviewProvider extends Mutable, Filter<JTemplate> {
*/
String getActionType();
/**
* 下拉弹出菜单的提示
* @return 弹出菜单的提示
*/
default String tooltipForPopItem() {
return StringUtils.EMPTY;
}
}

2
designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java

@ -67,7 +67,7 @@ public class EnvFileTree extends RefreshableJTree {
String lock = node.getLock();
String name = node.getName();
if (treeNode.hasFullAuthority()) {
if (lock != null && !node.getUserID().equals(lock)) {
if (lock != null && !lock.equals(node.getUserID())) {
name = name + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked", "(", ")");
}
this.setIcon(FileTreeIcon.getIcon(node));

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

@ -827,6 +827,9 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
provider.onClick(JForm.this);
}
});
if(StringUtils.isNotEmpty(provider.tooltipForPopItem())){
item.setToolTipText(provider.tooltipForPopItem());
}
menuItems.add(item);
}
return menuItems.toArray(new UIMenuItem[menuItems.size()]);

16
designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java

@ -1,7 +1,9 @@
package com.fr.design.preview;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.fun.impl.AbstractPreviewProvider;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.general.web.ParameterConstants;
@ -17,7 +19,7 @@ public class DeveloperPreview extends AbstractPreviewProvider {
@Override
public String nameForPopupItem() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Developer_Preview");
return Toolkit.i18nText("Fine-Designer_Fit_Developer_Preview");
}
@Override
@ -35,11 +37,21 @@ public class DeveloperPreview extends AbstractPreviewProvider {
return PREVIEW_TYPE;
}
public String tooltipForPopItem() {
return Toolkit.i18nText("Fine-Designer_Fit_Developer_Preview_Menu_Hint");
}
@Override
public void onClick(JTemplate<?, ?> jt) {
MutilTempalteTabPane.getInstance().closeCurrentTpl();
super.onClick(jt);
}
@Override
public Map<String, Object> parametersForPreview() {
Map<String, Object> map = new HashMap<String, Object>();
map.put(ParameterConstants.OP, "developer_preview");
map.put(ParameterConstants.OP, "editable_preview");
return map;
}

Loading…
Cancel
Save