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】新自适应开发者预览支持调整模板布局
persist/11.0
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 的模板;
// selectIndex 没有变化,但是对应的模板已经变成了前一张模板 // selectIndex 没有变化,但是对应的模板已经变成了前一张模板
if (closeIconIndex == selectedIndex || isCloseCurrent) { if (closeIconIndex == selectedIndex || isCloseCurrent) {
// 如果 closeIconIndex 是最后一个被渲染画出的,那么预览上一个,防止数组越界 // 如果当前关闭的模板在最右侧,那么预览上一个,防止数组越界
if (closeIconIndex >= maxPaintIndex) { if (selectedIndex >= maxPaintIndex) {
// selectIndex 不会 <0 因为如果关闭的是打开的最后一个模板,那么关闭之后 openedTemplate.isEmpty() = true // selectIndex 不会 <0 因为如果关闭的是打开的最后一个模板,那么关闭之后 openedTemplate.isEmpty() = true
selectedIndex--; 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.FileNodeFILE;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.file.filetree.IOFileNodeFilter; import com.fr.file.filetree.IOFileNodeFilter;
import com.fr.form.fit.web.editpreview.FileLockStateObservable;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -47,6 +48,8 @@ import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Objects; import java.util.Objects;
import java.util.Observable;
import java.util.Observer;
import static javax.swing.JOptionPane.WARNING_MESSAGE; import static javax.swing.JOptionPane.WARNING_MESSAGE;
import static javax.swing.JOptionPane.YES_NO_OPTION; import static javax.swing.JOptionPane.YES_NO_OPTION;
@ -76,6 +79,13 @@ public class TemplateTreePane extends JPanel implements FileOperations {
scrollPane.setBorder(null); scrollPane.setBorder(null);
contentPane.add(scrollPane, BorderLayout.CENTER); contentPane.add(scrollPane, BorderLayout.CENTER);
FileLockStateObservable.getInstance().addObserver(new Observer() {
@Override
public void update(Observable o, Object arg) {
TemplateTreePane.this.refresh();
}
});
/* /*
* Tree.MouseAdapter * Tree.MouseAdapter
*/ */
@ -202,7 +212,6 @@ public class TemplateTreePane extends JPanel implements FileOperations {
@Override @Override
public void openFile() { public void openFile() {
// 判断是否是远程设计的锁定文件 // 判断是否是远程设计的锁定文件
if (!WorkContext.getCurrent().isLocal()) {
FileNode node = reportletsTree.getSelectedFileNode(); FileNode node = reportletsTree.getSelectedFileNode();
if (node == null) { if (node == null) {
return; return;
@ -211,7 +220,6 @@ public class TemplateTreePane extends JPanel implements FileOperations {
if (lock != null && !lock.equals(node.getUserID())) { if (lock != null && !lock.equals(node.getUserID())) {
return; return;
} }
}
String reportPath = reportletsTree.getSelectedTemplatePath(); String reportPath = reportletsTree.getSelectedTemplatePath();
final String selectedFilePath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, reportPath); final String selectedFilePath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, reportPath);
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(selectedFilePath, false))); 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.design.mainframe.JTemplate;
import com.fr.stable.Filter; import com.fr.stable.Filter;
import com.fr.stable.StringUtils;
import com.fr.stable.fun.mark.Mutable; import com.fr.stable.fun.mark.Mutable;
import java.util.Map; import java.util.Map;
@ -62,5 +63,13 @@ public interface PreviewProvider extends Mutable, Filter<JTemplate> {
*/ */
String getActionType(); 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 lock = node.getLock();
String name = node.getName(); String name = node.getName();
if (treeNode.hasFullAuthority()) { 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", "(", ")"); name = name + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked", "(", ")");
} }
this.setIcon(FileTreeIcon.getIcon(node)); 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); provider.onClick(JForm.this);
} }
}); });
if(StringUtils.isNotEmpty(provider.tooltipForPopItem())){
item.setToolTipText(provider.tooltipForPopItem());
}
menuItems.add(item); menuItems.add(item);
} }
return menuItems.toArray(new UIMenuItem[menuItems.size()]); 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; package com.fr.design.preview;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.fun.impl.AbstractPreviewProvider; import com.fr.design.fun.impl.AbstractPreviewProvider;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.general.web.ParameterConstants; import com.fr.general.web.ParameterConstants;
@ -17,7 +19,7 @@ public class DeveloperPreview extends AbstractPreviewProvider {
@Override @Override
public String nameForPopupItem() { public String nameForPopupItem() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Developer_Preview"); return Toolkit.i18nText("Fine-Designer_Fit_Developer_Preview");
} }
@Override @Override
@ -35,11 +37,21 @@ public class DeveloperPreview extends AbstractPreviewProvider {
return PREVIEW_TYPE; 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 @Override
public Map<String, Object> parametersForPreview() { public Map<String, Object> parametersForPreview() {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
map.put(ParameterConstants.OP, "developer_preview"); map.put(ParameterConstants.OP, "editable_preview");
return map; return map;
} }

Loading…
Cancel
Save