Browse Source

Pull request #4228: 无jira 解决冲突

Merge in DESIGN/design from ~HADES/design:feature/x to feature/x

* commit 'b69867f105899d15dcb6958f9559f944ec411466':
  REPORT-52085 装有老版本的新自适应插件 frm无法打开
  REPORT-51188 决策报表的tab块,在绝对布局下拖拽存在缩小问题
  REPORT-51442 菜单栏和数据集面板灰化问题
research/11.0
ju|剧浩宇 4 years ago
parent
commit
6a278d0638
  1. 26
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  2. 12
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  3. 2
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  4. 17
      designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java
  5. 6
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  6. 14
      designer-base/src/main/java/com/fr/design/menu/MenuDef.java
  7. 25
      designer-base/src/main/java/com/fr/design/menu/ToolBarDef.java
  8. 2
      designer-form/src/main/java/com/fr/design/mainframe/FormArea.java
  9. 22
      designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java

26
designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java

@ -6,7 +6,6 @@ import com.fr.data.TableDataSource;
import com.fr.data.api.StoreProcedureAssist;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.ForbiddenUpdateAction;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.TableDataCreatorProducer;
import com.fr.design.data.datapane.TableDataNameObjectCreator;
@ -25,16 +24,20 @@ import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.ibutton.UILockButton;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.i18n.Toolkit;
import com.fr.design.icon.IconPathConstants;
import com.fr.design.mainframe.DockingView;
import com.fr.design.menu.LineSeparator;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ToolBarDef;
import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import java.util.HashSet;
import java.util.Set;
import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.DefaultCellEditor;
@ -61,6 +64,16 @@ import java.util.Objects;
* Time: 16:23
*/
public abstract class BasicTableDataTreePane extends DockingView implements ResponseDataSourceChange {
private static final Set<String> FORBIDDEN_SET = new HashSet<>();
static {
FORBIDDEN_SET.add(Toolkit.i18nText("Fine-Design_Basic_Edit"));
FORBIDDEN_SET.add(Toolkit.i18nText("Fine-Design_Basic_Remove"));
FORBIDDEN_SET.add(Toolkit.i18nText("Fine-Design_Basic_Preview"));
FORBIDDEN_SET.add(Toolkit.i18nText("Fine-Design_Basic_Action_Add"));
}
protected static final int PROCEDURE_NAME_INDEX = 4;
protected static final int TEMPLATE_TABLE_DATA = 0;
protected static final int SERVER_TABLE_DATA = 1;
@ -69,6 +82,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
protected UIHeadGroup buttonGroup;
protected String[] allDSNames;
protected ConnectionTableAction connectionTableAction;
protected ToolBarDef toolbarDef;
private String type = "";
@ -399,7 +413,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
return prefix + count;
}
protected class PreviewTableDataAction extends ForbiddenUpdateAction {
protected class PreviewTableDataAction extends UpdateAction {
private TableDataTree dataTree;
public PreviewTableDataAction(TableDataTree dataTree) {
@ -482,4 +496,12 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
}
public void refreshToolBar() {
toolbarDef.refreshToolBar(FORBIDDEN_SET);
}
public void checkEnable() {
}
}

12
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java

@ -6,7 +6,6 @@ import com.fr.data.impl.DBTableData;
import com.fr.data.impl.TableDataSourceDependent;
import com.fr.design.DesignModelAdapter;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.ForbiddenUpdateAction;
import com.fr.design.actions.UpdateAction;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.BasicTableDataTreePane;
@ -137,7 +136,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
esdOffAction = new EsdOffAction();
ToolBarDef toolbarDef = new ToolBarDef();
toolbarDef = new ToolBarDef();
toolbarDef.addShortCut(addMenuDef, SeparatorDef.DEFAULT, editAction, removeAction, SeparatorDef.DEFAULT, previewTableDataAction, connectionTableAction, esdAction, esdOffAction);
UIToolbar toolBar = ToolBarDef.createJToolBar();
toolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.TOOLBAR_BORDER_COLOR));
@ -759,7 +758,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
}
private class EditAction extends ForbiddenUpdateAction {
private class EditAction extends UpdateAction {
public EditAction() {
this.setName(Toolkit.i18nText("Fine-Design_Basic_Edit"));
this.setMnemonic('E');
@ -785,7 +784,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
}
}
private class RemoveAction extends ForbiddenUpdateAction {
private class RemoveAction extends UpdateAction {
public RemoveAction() {
this.setName(Toolkit.i18nText("Fine-Design_Basic_Remove"));
@ -825,4 +824,9 @@ public class TableDataTreePane extends BasicTableDataTreePane {
}
}
}
@Override
public void checkEnable() {
this.checkButtonEnabled();
}
}

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

@ -12,6 +12,7 @@ import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.BasicTableDataTreePane;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.dialog.FineJOptionPane;
@ -821,6 +822,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
((UIToolbar ) toolbarComponent).refreshUIToolBar();
}
combineUp.refreshUIToolBar();
this.ad.updateEnable();
}
public JComponent getToolbarComponent() {

17
designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java

@ -6,12 +6,14 @@ package com.fr.design.mainframe;
import com.fr.base.iofile.attr.DesignBanCopyAttrMark;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.base.mode.DesignerMode;
import com.fr.design.data.BasicTableDataTreePane;
import com.fr.design.dialog.BasicPane;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
import java.awt.BorderLayout;
import java.awt.Component;
import javax.swing.JComponent;
import javax.swing.JLayeredPane;
@ -97,6 +99,11 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
DesignerContext.getDesignerFrame().refreshUIToolBar();
DesignerFrameFileDealerPane.getInstance().stateChange();
EastRegionContainerPane.getInstance().updateAllPropertyPane();
JComponent downPane = WestRegionContainerPane.getInstance().getDownPane();
if (downPane instanceof BasicTableDataTreePane) {
BasicTableDataTreePane dataTreePane = (BasicTableDataTreePane) downPane;
dataTreePane.refreshToolBar();
}
checkLoadingPane();
layeredPane.moveToFront(loadingPane);
}
@ -110,12 +117,22 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
layeredPane.moveToFront(transparentPane);
DesignerContext.getDesignerFrame().refreshUIToolBar();
EastRegionContainerPane.getInstance().updateAllPropertyPane();
JComponent downPane = WestRegionContainerPane.getInstance().getDownPane();
if (downPane instanceof BasicTableDataTreePane) {
BasicTableDataTreePane dataTreePane = (BasicTableDataTreePane) downPane;
dataTreePane.refreshToolBar();
}
}
public void hideCover() {
transparentPane.stop();
layeredPane.moveToFront(component);
EastRegionContainerPane.getInstance().updateAllPropertyPane();
JComponent downPane = WestRegionContainerPane.getInstance().getDownPane();
if (downPane instanceof BasicTableDataTreePane) {
BasicTableDataTreePane dataTreePane = (BasicTableDataTreePane) downPane;
dataTreePane.checkEnable();
}
}
protected JTemplate<?, ?> getSelectedJTemplate() {

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

@ -169,6 +169,12 @@ public abstract class ToolBarMenuDock {
}
}
public void updateEnable() {
for (int i = 0, count = ArrayUtils.getLength(menus); i < count; i++) {
menus[i].updateEnable();
}
}
/**
* 更新toolbar
*/

14
designer-base/src/main/java/com/fr/design/menu/MenuDef.java

@ -293,6 +293,10 @@ public class MenuDef extends ShortCut {
}
}
public void updateEnable() {
setEnabled(checkEnable());
}
/**
* 更新菜单
*
@ -406,14 +410,13 @@ public class MenuDef extends ShortCut {
toolBar.add(this.createUIButton());
}
private boolean checkEnable(JComponent component) {
if (FORBIDDEN_SET.contains(component.getName())) {
private boolean checkEnable() {
if (FORBIDDEN_SET.contains(this.getName())) {
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
boolean flag = true;
if (template != null) {
flag = template.checkEnable();
}
component.setEnabled(flag);
if (!flag) {
return false;
}
@ -442,9 +445,6 @@ public class MenuDef extends ShortCut {
if (!(source instanceof JMenu)) {
return;
}
if (!checkEnable(createJMenu())) {
return;
}
MenuDef.this.updateMenu();
}
};
@ -454,7 +454,7 @@ public class MenuDef extends ShortCut {
public void mouseReleased(MouseEvent evt) {
Object source = evt.getSource();
UIButton button = (UIButton) source;
if (!checkEnable(button)) {
if (!button.isEnabled()) {
return;
}
if (isEastAttr) {

25
designer-base/src/main/java/com/fr/design/menu/ToolBarDef.java

@ -1,7 +1,11 @@
package com.fr.design.menu;
import com.fr.design.actions.UpdateAction;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.itoolbar.UIToolBarUI;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.mainframe.JTemplate;
import java.util.Set;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@ -82,4 +86,25 @@ public class ToolBarDef {
}
}
public void refreshToolBar(Set<String> set) {
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template != null) {
for (int i = 0; i < getShortCutCount(); i++) {
ShortCut shortCut = getShortCut(i);
if (shortCut instanceof MenuDef) {
MenuDef menuDef = (MenuDef) shortCut;
if (set.contains(menuDef.getName())) {
menuDef.setEnabled(template.checkEnable());
}
}
if (shortCut instanceof UpdateAction) {
UpdateAction updateAction = (UpdateAction) shortCut;
if (set.contains(updateAction.getName())) {
updateAction.setEnabled(template.checkEnable());
}
}
}
}
}
}

2
designer-form/src/main/java/com/fr/design/mainframe/FormArea.java

@ -427,8 +427,8 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
if (root.acceptType(XWFitLayout.class)) {
XWFitLayout layout = (XWFitLayout) root;
layout.setContainerPercent(value / DEFAULT_SLIDER);
traverAndAdjust(layout, percent);
layout.adjustCreatorsWhileSlide(percent);
traverAndAdjust(layout, percent);
// 拖动滑块,先将内部组件百分比大小计算,再计算容器大小

22
designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java

@ -18,6 +18,7 @@ import com.fr.exception.TplLockedException;
import com.fr.file.FILE;
import com.fr.form.main.Form;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants;
import com.fr.stable.bridge.StableFactory;
@ -57,20 +58,33 @@ class FormApp extends AbstractAppProvider {
@Override
public JTemplate<?, ?> call() throws Exception {
OpenResult<Form, Parameter[]> result = worker.getResult();
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG,
new Object[]{result.getBaseBook(), tplFile, result.getRef()}, classType, BaseJForm.class);
return compatibleForm(result.getBaseBook(), result.getRef(), tplFile, classType);
}
});
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Report_Template_Opening_And_Waiting", tplFile.getName()) + "...");
worker.start(tplFile.getPath());
OpenResult<Form, Parameter[]> result = worker.getResult();
if (result != null) {
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG,
new Object[]{result.getBaseBook(), tplFile, new Parameter[0]}, classType, BaseJForm.class);
return compatibleForm(result.getBaseBook(), new Parameter[0], tplFile, classType);
}
return emptyForm;
}
/**
* 兼容外部注册的frm类型
*
* @return
*/
private JTemplate<Form, ?> compatibleForm(Form form, Parameter[] parameters, FILE tplFile, HashMap<String, Class> classType) {
if (ComparatorUtils.equals(StableFactory.getRegisteredClass(BaseJForm.XML_TAG).getName(), JForm.class)) {
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG,
new Object[]{form, tplFile, parameters}, classType, BaseJForm.class);
} else {
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG,
new Object[]{form, tplFile}, classType, BaseJForm.class);
}
}
@Override
public Form asIOFile(FILE file) {

Loading…
Cancel
Save