Browse Source

Merge branch 'release/11.0' of ssh://code.fineres.com:7999/~tommy/design into release/11.0

bugfix/11.0
kuangshuai 3 years ago
parent
commit
dc2148c574
  1. 40
      designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java
  2. 12
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java
  3. 6
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/LoadingMenuItem.java
  4. 50
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/SharedComponentActionMenuItemUI.java
  5. 5
      designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java

40
designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java

@ -218,6 +218,10 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
this.add(editorPane, BorderLayout.CENTER); this.add(editorPane, BorderLayout.CENTER);
} }
public void reset() {
editorPane.populate(new SingleJavaScript[0]);
}
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Basic_Export_JS_Setting"); return Toolkit.i18nText("Fine-Design_Basic_Export_JS_Setting");
@ -399,6 +403,8 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
private static final long serialVersionUID = -6564079764032351372L; private static final long serialVersionUID = -6564079764032351372L;
private UIComboBox exportTypeComboBox;
public ExportTypeCombobox() { public ExportTypeCombobox() {
exportTypeComboBox = getComboBoxWithModel(new String[]{ExportJavaScript.EXPORT_PDF, ExportJavaScript.EXPORT_EXCEL_PAGE, ExportJavaScript.EXPORT_EXCEL_SIMPLE, ExportJavaScript.EXPORT_EXCEL_SHEET, ExportJavaScript.EXPORT_WORD, ExportJavaScript.EXPORT_IMAGE} exportTypeComboBox = getComboBoxWithModel(new String[]{ExportJavaScript.EXPORT_PDF, ExportJavaScript.EXPORT_EXCEL_PAGE, ExportJavaScript.EXPORT_EXCEL_SIMPLE, ExportJavaScript.EXPORT_EXCEL_SHEET, ExportJavaScript.EXPORT_WORD, ExportJavaScript.EXPORT_IMAGE}
, EXPORT_TYPES_MAP); , EXPORT_TYPES_MAP);
@ -449,6 +455,24 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
public FileNameCombobox() { public FileNameCombobox() {
fileNameComboBox = getComboBoxWithModel(new String[]{DEFAULT, CUSTOM}, FILENAME_TYPE_MAP); fileNameComboBox = getComboBoxWithModel(new String[]{DEFAULT, CUSTOM}, FILENAME_TYPE_MAP);
fileNameComboBox.addItemListener(e -> {
if (e.getStateChange() == ItemEvent.SELECTED) {
final int row = table.getSelectedRow();
if (row == -1) {
return;
}
SingleJavaScript js = getList().get(row);
Object ob = fileNameComboBox.getSelectedItem();
if (ob != null) {
String value = ob.toString();
js.setDefaultFileName(StringUtils.equals(value, DEFAULT));
if (js.isDefaultFileName()) {
js.setFileName(StringUtils.EMPTY);
}
}
table.repaint();
}
});
this.addCellEditorListener(new CellEditorListener() { this.addCellEditorListener(new CellEditorListener() {
@Override @Override
@ -458,15 +482,6 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override @Override
public void editingStopped(ChangeEvent e) { public void editingStopped(ChangeEvent e) {
if (table.getSelectedRow() == -1) {
return;
}
SingleJavaScript js = getList().get(table.getSelectedRow());
Object ob = fileNameComboBox.getSelectedItem();
if (ob != null) {
String value = ob.toString();
js.setDefaultFileName(StringUtils.equals(value, DEFAULT));
}
fireTableDataChanged(); fireTableDataChanged();
} }
}); });
@ -514,7 +529,11 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override @Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
if (value != null) {
fileNameFormulaEditor.setValue(BaseFormula.createFormulaBuilder().build(value));
} else {
fileNameFormulaEditor.setValue(BaseFormula.createFormulaBuilder().build()); fileNameFormulaEditor.setValue(BaseFormula.createFormulaBuilder().build());
}
return fileNameFormulaEditor; return fileNameFormulaEditor;
} }
@ -633,7 +652,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
} }
ParameterProvider[] providers = (ParameterProvider[]) value; ParameterProvider[] providers = (ParameterProvider[]) value;
if (providers != null) { if (providers != null) {
paraSettingPane.refresh(Arrays.asList(providers)); paraSettingPane.refresh(new ArrayList<>(Arrays.asList(providers)));
} }
return paraButton; return paraButton;
} }
@ -758,6 +777,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
public void populateBean(ExportJavaScript ob) { public void populateBean(ExportJavaScript ob) {
if (ob == null) { if (ob == null) {
ob = new ExportJavaScript(); ob = new ExportJavaScript();
otherTemplatePane.reset();
} }
this.templateRadioGroup.selectIndexButton(ob.isCurrentTemplate() ? 0 : 1); this.templateRadioGroup.selectIndexButton(ob.isCurrentTemplate() ? 0 : 1);
if (ob.isCurrentTemplate()) { if (ob.isCurrentTemplate()) {

12
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java

@ -141,6 +141,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
if (saveAsButton != null) { if (saveAsButton != null) {
saveAsButton.setEnabled(StringUtils.isNotEmpty(name)); saveAsButton.setEnabled(StringUtils.isNotEmpty(name));
} }
actionListener.onInitialize(theme);
isPopulating = false; isPopulating = false;
} }
@ -218,6 +219,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
super.afterCommit(); super.afterCommit();
saveButton.setEnabled(false); saveButton.setEnabled(false);
saveAsButton.setEnabled(true); saveAsButton.setEnabled(true);
actionListener.onSaved(config.cachedFetch(getName()));
DesignerToastMsgUtil.toastPrompt(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Save_Successfully")); DesignerToastMsgUtil.toastPrompt(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Save_Successfully"));
} }
}); });
@ -342,11 +344,21 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
} }
public interface TemplateThemeProfileActionListener { public interface TemplateThemeProfileActionListener {
void onInitialize(TemplateTheme theme);
void onThemeNameChecked(String name, boolean valid); void onThemeNameChecked(String name, boolean valid);
void onSaved(TemplateTheme theme);
} }
public static class TemplateThemeProfileActionAdapter implements TemplateThemeProfileActionListener { public static class TemplateThemeProfileActionAdapter implements TemplateThemeProfileActionListener {
@Override
public void onInitialize(TemplateTheme theme) {}
@Override @Override
public void onThemeNameChecked(String name, boolean valid) { } public void onThemeNameChecked(String name, boolean valid) { }
@Override
public void onSaved(TemplateTheme theme) {}
} }
} }

6
designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/LoadingMenuItem.java

@ -23,7 +23,7 @@ public class LoadingMenuItem extends UIMenuItem {
super(action); super(action);
setOpaque(true); setOpaque(true);
setBackground(ColorConstants.BACKGROUND); setBackground(ColorConstants.BACKGROUND);
setUI(new SharedComponentActionMenuItemUI(false)); setUI(new SharedComponentActionMenuItemUI());
} }
public void startLoading() { public void startLoading() {
@ -40,6 +40,10 @@ public class LoadingMenuItem extends UIMenuItem {
repaint(); repaint();
} }
public boolean isLoading() {
return loading;
}
@Override @Override
protected void paintBorder(Graphics g) { protected void paintBorder(Graphics g) {
super.paintBorder(g); super.paintBorder(g);

50
designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/SharedComponentActionMenuItemUI.java

@ -2,6 +2,8 @@ package com.fr.design.mainframe.share.ui.actions;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.imenu.UIMenuItemUI; import com.fr.design.gui.imenu.UIMenuItemUI;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
@ -10,6 +12,8 @@ import javax.swing.JMenu;
import javax.swing.JMenuItem; import javax.swing.JMenuItem;
import javax.swing.MenuSelectionManager; import javax.swing.MenuSelectionManager;
import java.awt.Color; import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
@ -20,16 +24,6 @@ import java.awt.Graphics2D;
*/ */
public class SharedComponentActionMenuItemUI extends UIMenuItemUI { public class SharedComponentActionMenuItemUI extends UIMenuItemUI {
private final boolean autoClosePopup;
public SharedComponentActionMenuItemUI(boolean autoClosePopup) {
this.autoClosePopup = autoClosePopup;
}
public SharedComponentActionMenuItemUI() {
this(true);
}
@Override @Override
protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) { protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) {
ButtonModel model = menuItem.getModel(); ButtonModel model = menuItem.getModel();
@ -37,19 +31,45 @@ public class SharedComponentActionMenuItemUI extends UIMenuItemUI {
int menuWidth = menuItem.getWidth(); int menuWidth = menuItem.getWidth();
int menuHeight = menuItem.getHeight(); int menuHeight = menuItem.getHeight();
g.setColor(ColorConstants.BACKGROUND);
g.fillRect(0, 0, menuWidth, menuHeight);
if (menuItem.isOpaque()) {
if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) { if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) {
GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 0); GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7);
} else {
GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, menuItem.getBackground(), 7);
} }
g.setColor(oldColor);
} else if (model.isArmed() || (menuItem instanceof JMenu &&
model.isSelected())) {
GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7);
g.setColor(oldColor); g.setColor(oldColor);
} }
}
@Override @Override
protected void doClick(MenuSelectionManager msm) { protected void doClick(MenuSelectionManager msm) {
if (autoClosePopup) { if (hasLoadingMenuItem()) {
super.doClick(msm); return;
} else { }
if (menuItem instanceof LoadingMenuItem) {
menuItem.doClick(0); menuItem.doClick(0);
} else {
super.doClick(msm);
}
}
private boolean hasLoadingMenuItem() {
Container parent = menuItem.getParent();
if (parent instanceof UIPopupMenu) {
Component[] components = parent.getComponents();
for (Component component: components) {
if (component instanceof LoadingMenuItem && ((LoadingMenuItem) component).isLoading()) {
return true;
}
}
} }
return false;
} }
} }

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

@ -58,7 +58,6 @@ class FormApp extends AbstractAppProvider {
* @return * @return
*/ */
private JTemplate<Form, ?> compatibleForm(FILE tplFile, HashMap<String, Class> classType) { private JTemplate<Form, ?> compatibleForm(FILE tplFile, HashMap<String, Class> classType) {
if (ComparatorUtils.equals(StableFactory.getRegisteredClass(BaseJForm.XML_TAG), JForm.class)) {
classType.put(Constants.ARG_2, Parameter[].class); classType.put(Constants.ARG_2, Parameter[].class);
JForm emptyForm = new JForm(new Form(new WBorderLayout("form")), tplFile); JForm emptyForm = new JForm(new Form(new WBorderLayout("form")), tplFile);
OpenWorker<OpenResult<Form, Parameter[]>> worker = new OpenWorker<>( OpenWorker<OpenResult<Form, Parameter[]>> worker = new OpenWorker<>(
@ -84,10 +83,6 @@ class FormApp extends AbstractAppProvider {
new Object[]{result.getBaseBook(), tplFile, new Parameter[0]}, classType, BaseJForm.class); new Object[]{result.getBaseBook(), tplFile, new Parameter[0]}, classType, BaseJForm.class);
} }
return emptyForm; return emptyForm;
} else {
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG,
new Object[]{getForm(tplFile), tplFile}, classType, BaseJForm.class);
}
} }
@Nullable @Nullable

Loading…
Cancel
Save