Browse Source

Merge pull request #4224 in DESIGN/design from release/10.0 to bugfix/10.0

* commit '8ccf7acb4584407f306e27224a9f21f8ac87bd7b':
  REPORT-52085 装有老版本的新自适应插件 frm无法打开
  REPORT-51442 菜单栏和数据集面板灰化问题
bugfix/10.0
superman 4 years ago
parent
commit
9647c8585c
  1. 26
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  2. 14
      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. 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.api.StoreProcedureAssist;
import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.ForbiddenUpdateAction;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.TableDataCreatorProducer; import com.fr.design.data.datapane.TableDataCreatorProducer;
import com.fr.design.data.datapane.TableDataNameObjectCreator; 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.ibutton.UILockButton;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.i18n.Toolkit;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
import com.fr.design.mainframe.DockingView; import com.fr.design.mainframe.DockingView;
import com.fr.design.menu.LineSeparator; import com.fr.design.menu.LineSeparator;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ToolBarDef;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import java.util.HashSet;
import java.util.Set;
import javax.swing.AbstractButton; import javax.swing.AbstractButton;
import javax.swing.Action; import javax.swing.Action;
import javax.swing.DefaultCellEditor; import javax.swing.DefaultCellEditor;
@ -61,6 +64,16 @@ import java.util.Objects;
* Time: 16:23 * Time: 16:23
*/ */
public abstract class BasicTableDataTreePane extends DockingView implements ResponseDataSourceChange { 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 PROCEDURE_NAME_INDEX = 4;
protected static final int TEMPLATE_TABLE_DATA = 0; protected static final int TEMPLATE_TABLE_DATA = 0;
protected static final int SERVER_TABLE_DATA = 1; protected static final int SERVER_TABLE_DATA = 1;
@ -69,6 +82,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
protected UIHeadGroup buttonGroup; protected UIHeadGroup buttonGroup;
protected String[] allDSNames; protected String[] allDSNames;
protected ConnectionTableAction connectionTableAction; protected ConnectionTableAction connectionTableAction;
protected ToolBarDef toolbarDef;
private String type = ""; private String type = "";
@ -399,7 +413,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
return prefix + count; return prefix + count;
} }
protected class PreviewTableDataAction extends ForbiddenUpdateAction { protected class PreviewTableDataAction extends UpdateAction {
private TableDataTree dataTree; private TableDataTree dataTree;
public PreviewTableDataAction(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() {
}
} }

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

@ -1,12 +1,10 @@
package com.fr.design.data.datapane; package com.fr.design.data.datapane;
import com.fr.base.BaseUtils;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.data.impl.TableDataSourceDependent; import com.fr.data.impl.TableDataSourceDependent;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.ForbiddenUpdateAction;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.data.BasicTableDataTreePane; import com.fr.design.data.BasicTableDataTreePane;
@ -102,7 +100,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
removeAction = new RemoveAction(); removeAction = new RemoveAction();
previewTableDataAction = new PreviewTableDataAction(dataTree); previewTableDataAction = new PreviewTableDataAction(dataTree);
connectionTableAction = new ConnectionTableAction(); connectionTableAction = new ConnectionTableAction();
ToolBarDef toolbarDef = new ToolBarDef(); toolbarDef = new ToolBarDef();
toolbarDef.addShortCut(addMenuDef, SeparatorDef.DEFAULT, editAction, removeAction, SeparatorDef.DEFAULT, previewTableDataAction, connectionTableAction); toolbarDef.addShortCut(addMenuDef, SeparatorDef.DEFAULT, editAction, removeAction, SeparatorDef.DEFAULT, previewTableDataAction, connectionTableAction);
UIToolbar toolBar = ToolBarDef.createJToolBar(); UIToolbar toolBar = ToolBarDef.createJToolBar();
toolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.TOOLBAR_BORDER_COLOR)); toolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.TOOLBAR_BORDER_COLOR));
@ -244,7 +242,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
dg.setVisible(true); dg.setVisible(true);
} }
private class EditAction extends ForbiddenUpdateAction { private class EditAction extends UpdateAction {
public EditAction() { public EditAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit"));
this.setMnemonic('E'); this.setMnemonic('E');
@ -261,7 +259,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
} }
} }
private class RemoveAction extends ForbiddenUpdateAction { private class RemoveAction extends UpdateAction {
public RemoveAction() { public RemoveAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove")); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"));
@ -343,8 +341,10 @@ public class TableDataTreePane extends BasicTableDataTreePane {
dataTree.refresh(); dataTree.refresh();
} }
@Override
public void checkEnable() {
this.checkButtonEnabled();
}
public void addDataPane(final AbstractTableDataPane<?> uPanel, String paneName) { public void addDataPane(final AbstractTableDataPane<?> uPanel, String paneName) {
final NamePane nPanel = uPanel.asNamePane(); final NamePane nPanel = uPanel.asNamePane();

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.actions.core.ActionFactory;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.data.BasicTableDataTreePane;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
@ -821,6 +822,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
((UIToolbar ) toolbarComponent).refreshUIToolBar(); ((UIToolbar ) toolbarComponent).refreshUIToolBar();
} }
combineUp.refreshUIToolBar(); combineUp.refreshUIToolBar();
this.ad.updateEnable();
} }
public JComponent getToolbarComponent() { 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.base.iofile.attr.DesignBanCopyAttrMark;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.base.mode.DesignerMode; import com.fr.design.base.mode.DesignerMode;
import com.fr.design.data.BasicTableDataTreePane;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import javax.swing.JComponent;
import javax.swing.JLayeredPane; import javax.swing.JLayeredPane;
@ -97,6 +99,11 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
DesignerContext.getDesignerFrame().refreshUIToolBar(); DesignerContext.getDesignerFrame().refreshUIToolBar();
DesignerFrameFileDealerPane.getInstance().stateChange(); DesignerFrameFileDealerPane.getInstance().stateChange();
EastRegionContainerPane.getInstance().updateAllPropertyPane(); EastRegionContainerPane.getInstance().updateAllPropertyPane();
JComponent downPane = WestRegionContainerPane.getInstance().getDownPane();
if (downPane instanceof BasicTableDataTreePane) {
BasicTableDataTreePane dataTreePane = (BasicTableDataTreePane) downPane;
dataTreePane.refreshToolBar();
}
checkLoadingPane(); checkLoadingPane();
layeredPane.moveToFront(loadingPane); layeredPane.moveToFront(loadingPane);
} }
@ -110,12 +117,22 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
layeredPane.moveToFront(transparentPane); layeredPane.moveToFront(transparentPane);
DesignerContext.getDesignerFrame().refreshUIToolBar(); DesignerContext.getDesignerFrame().refreshUIToolBar();
EastRegionContainerPane.getInstance().updateAllPropertyPane(); EastRegionContainerPane.getInstance().updateAllPropertyPane();
JComponent downPane = WestRegionContainerPane.getInstance().getDownPane();
if (downPane instanceof BasicTableDataTreePane) {
BasicTableDataTreePane dataTreePane = (BasicTableDataTreePane) downPane;
dataTreePane.refreshToolBar();
}
} }
public void hideCover() { public void hideCover() {
transparentPane.stop(); transparentPane.stop();
layeredPane.moveToFront(component); layeredPane.moveToFront(component);
EastRegionContainerPane.getInstance().updateAllPropertyPane(); EastRegionContainerPane.getInstance().updateAllPropertyPane();
JComponent downPane = WestRegionContainerPane.getInstance().getDownPane();
if (downPane instanceof BasicTableDataTreePane) {
BasicTableDataTreePane dataTreePane = (BasicTableDataTreePane) downPane;
dataTreePane.checkEnable();
}
} }
protected JTemplate<?, ?> getSelectedJTemplate() { 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 * 更新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()); toolBar.add(this.createUIButton());
} }
private boolean checkEnable(JComponent component) { private boolean checkEnable() {
if (FORBIDDEN_SET.contains(component.getName())) { if (FORBIDDEN_SET.contains(this.getName())) {
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
boolean flag = true; boolean flag = true;
if (template != null) { if (template != null) {
flag = template.checkEnable(); flag = template.checkEnable();
} }
component.setEnabled(flag);
if (!flag) { if (!flag) {
return false; return false;
} }
@ -442,9 +445,6 @@ public class MenuDef extends ShortCut {
if (!(source instanceof JMenu)) { if (!(source instanceof JMenu)) {
return; return;
} }
if (!checkEnable(createJMenu())) {
return;
}
MenuDef.this.updateMenu(); MenuDef.this.updateMenu();
} }
}; };
@ -454,7 +454,7 @@ public class MenuDef extends ShortCut {
public void mouseReleased(MouseEvent evt) { public void mouseReleased(MouseEvent evt) {
Object source = evt.getSource(); Object source = evt.getSource();
UIButton button = (UIButton) source; UIButton button = (UIButton) source;
if (!checkEnable(button)) { if (!button.isEnabled()) {
return; return;
} }
if (isEastAttr) { if (isEastAttr) {

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

@ -1,7 +1,11 @@
package com.fr.design.menu; 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.UIToolBarUI;
import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.mainframe.JTemplate;
import java.util.Set;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.swing.*; 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());
}
}
}
}
}
} }

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.file.FILE;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WBorderLayout;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
@ -57,20 +58,33 @@ class FormApp extends AbstractAppProvider {
@Override @Override
public JTemplate<?, ?> call() throws Exception { public JTemplate<?, ?> call() throws Exception {
OpenResult<Form, Parameter[]> result = worker.getResult(); OpenResult<Form, Parameter[]> result = worker.getResult();
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, return compatibleForm(result.getBaseBook(), result.getRef(), tplFile, classType);
new Object[]{result.getBaseBook(), tplFile, result.getRef()}, classType, BaseJForm.class);
} }
}); });
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Report_Template_Opening_And_Waiting", tplFile.getName()) + "..."); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Report_Template_Opening_And_Waiting", tplFile.getName()) + "...");
worker.start(tplFile.getPath()); worker.start(tplFile.getPath());
OpenResult<Form, Parameter[]> result = worker.getResult(); OpenResult<Form, Parameter[]> result = worker.getResult();
if (result != null) { if (result != null) {
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, return compatibleForm(result.getBaseBook(), new Parameter[0], tplFile, classType);
new Object[]{result.getBaseBook(), tplFile, new Parameter[0]}, classType, BaseJForm.class);
} }
return emptyForm; 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 @Override
public Form asIOFile(FILE file) { public Form asIOFile(FILE file) {

Loading…
Cancel
Save