Browse Source

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

final/11.0
kuangshuai 3 years ago
parent
commit
d841375a5b
  1. 8
      designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java
  2. 4
      designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java
  3. 23
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridControlPane.java
  4. 13
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java
  5. 33
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPane.java
  6. 16
      designer-form/src/main/java/com/fr/design/mainframe/FormArea.java
  7. 29
      designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java
  8. 65
      designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java
  9. 3
      designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellStringQuickEditor.java

8
designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java

@ -43,6 +43,7 @@ import java.awt.event.ItemListener;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.text.Format; import java.text.Format;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Arrays;
/** /**
* @author Starryi * @author Starryi
@ -151,16 +152,17 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName
protected JPanel createContentPane (Component[][] components) { protected JPanel createContentPane (Component[][] components) {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p}; double[] rowSize = new double[components.length];
Arrays.fill(rowSize, p);
double[] columnSize = {p, f}; double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; int[][] rowCount = new int[components.length][2];
Arrays.fill(rowCount, new int[] {1, 1});
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM); return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM);
} }
protected Component[][] getComponent (JPanel centerPane, JPanel typePane) { protected Component[][] getComponent (JPanel centerPane, JPanel typePane) {
return new Component[][]{ return new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format"), SwingConstants.LEFT), typePane}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format"), SwingConstants.LEFT), typePane},
new Component[]{centerPane, null}, new Component[]{centerPane, null},
new Component[]{optionPane, null}, new Component[]{optionPane, null},

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

@ -110,6 +110,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
private UICheckBox extendParametersCheckBox; private UICheckBox extendParametersCheckBox;
private ReportletParameterViewPane parameterViewPane; private ReportletParameterViewPane parameterViewPane;
private UIComboBox exportTypeComboBox; private UIComboBox exportTypeComboBox;
private UILabel fileNameTipLabel;
public CurrentTemplatePane() { public CurrentTemplatePane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -167,7 +168,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
fileNameFormulaEditor = new FormulaEditor(Toolkit.i18nText("Fine-Design_Report_Parameter_Formula")); fileNameFormulaEditor = new FormulaEditor(Toolkit.i18nText("Fine-Design_Report_Parameter_Formula"));
fileNameFormulaEditor.setVisible(false); fileNameFormulaEditor.setVisible(false);
fileNameFormulaEditor.setEnabled(false); fileNameFormulaEditor.setEnabled(false);
UILabel fileNameTipLabel = new UILabel("<html><body style=\"color:rgb(147,147,147)\">" + Toolkit.i18nText("Fine-Design_Basic_Export_JS_Title_Tip_Front") + "\\/:*?\"<>|" + Toolkit.i18nText("Fine-Design_Basic_Export_JS_Title_Tip_Back") + "</html>"); fileNameTipLabel = new UILabel("<html><body style=\"color:rgb(147,147,147)\">" + Toolkit.i18nText("Fine-Design_Basic_Export_JS_Title_Tip_Front") + "\\/:*?\"<>|" + Toolkit.i18nText("Fine-Design_Basic_Export_JS_Title_Tip_Back") + "</html>");
fileNameTipLabel.setVisible(false); fileNameTipLabel.setVisible(false);
fileNameRadioGroup.addActionListener(new ActionListener() { fileNameRadioGroup.addActionListener(new ActionListener() {
@Override @Override
@ -221,6 +222,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
if (!js.isDefaultFileName()) { if (!js.isDefaultFileName()) {
fileNameFormulaEditor.setEnabled(true); fileNameFormulaEditor.setEnabled(true);
fileNameFormulaEditor.setVisible(true); fileNameFormulaEditor.setVisible(true);
fileNameTipLabel.setVisible(true);
fileNameFormulaEditor.setValue(BaseFormula.createFormulaBuilder().build(js.getFileName())); fileNameFormulaEditor.setValue(BaseFormula.createFormulaBuilder().build(js.getFileName()));
} }
if (js.isExtendParameters()) { if (js.isExtendParameters()) {

23
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridControlPane.java

@ -22,6 +22,7 @@ import com.fr.design.menu.ToolBarDef;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.javax.annotation.Nullable;
import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.CallBackAdaptor;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -67,19 +68,19 @@ public class TemplateThemeGridControlPane<T extends TemplateTheme> extends Basic
private final Window window; private final Window window;
public static TemplateThemeGridControlPane<FormTheme> createFormThemesManagerPane(Window window) { public static TemplateThemeGridControlPane<FormTheme> createFormThemesManagerPane(@Nullable Window window) {
FormThemeConfig config = FormThemeConfig.getInstance(); FormThemeConfig config = FormThemeConfig.getInstance();
FormThemeProfilePane editPane = new FormThemeProfilePane(config); FormThemeProfilePane editPane = new FormThemeProfilePane(config);
return new TemplateThemeGridControlPane<>(window, config, editPane); return new TemplateThemeGridControlPane<>(window, config, editPane);
} }
public static TemplateThemeGridControlPane<ReportTheme> createReportThemesManagerPane(Window window) { public static TemplateThemeGridControlPane<ReportTheme> createReportThemesManagerPane(@Nullable Window window) {
ReportThemeConfig config = ReportThemeConfig.getInstance(); ReportThemeConfig config = ReportThemeConfig.getInstance();
ReportThemeProfilePane editPane = new ReportThemeProfilePane(config); ReportThemeProfilePane editPane = new ReportThemeProfilePane(config);
return new TemplateThemeGridControlPane<>(window, config, editPane); return new TemplateThemeGridControlPane<>(window, config, editPane);
} }
public TemplateThemeGridControlPane(Window window, TemplateThemeConfig<T> config, TemplateThemeProfilePane<T> profilePane) { public TemplateThemeGridControlPane(@Nullable Window window, TemplateThemeConfig<T> config, TemplateThemeProfilePane<T> profilePane) {
this.window = window; this.window = window;
this.config = config; this.config = config;
this.profilePane = profilePane; this.profilePane = profilePane;
@ -124,13 +125,15 @@ public class TemplateThemeGridControlPane<T extends TemplateTheme> extends Basic
} }
private void registerWindowListener() { private void registerWindowListener() {
window.addWindowListener(new WindowAdapter() { if (window != null) {
@Override window.addWindowListener(new WindowAdapter() {
public void windowClosed(WindowEvent e) { @Override
super.windowClosed(e); public void windowClosed(WindowEvent e) {
asyncThemeFetcher.shutdown(); super.windowClosed(e);
} asyncThemeFetcher.shutdown();
}); }
});
}
} }
private void resetEnableRemoveAction(T selectedTheme, RemoveThemeAction removeAction) { private void resetEnableRemoveAction(T selectedTheme, RemoveThemeAction removeAction) {

13
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java

@ -22,6 +22,7 @@ import com.fr.design.mainframe.theme.provider.ThemeManageActionProvider;
import com.fr.design.mainframe.theme.ui.BreadcrumbBar; import com.fr.design.mainframe.theme.ui.BreadcrumbBar;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import com.fr.third.javax.annotation.Nullable;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -62,11 +63,15 @@ public class TemplateThemeGridPagesPane extends JPanel {
private PageChangeListener pageChangeListener; private PageChangeListener pageChangeListener;
private TemplateThemeGridPagePane currentTemplateThemeGridPagePane; private TemplateThemeGridPagePane currentTemplateThemeGridPagePane;
public TemplateThemeGridPagesPane(Window window) { public TemplateThemeGridPagesPane() {
initializePane(null);
}
public TemplateThemeGridPagesPane(@Nullable Window window) {
initializePane(window); initializePane(window);
} }
private void initializePane(Window window) { private void initializePane(@Nullable Window window) {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
@ -234,7 +239,7 @@ public class TemplateThemeGridPagesPane extends JPanel {
private final JTemplate<?,?> template; private final JTemplate<?,?> template;
public final TemplateThemeGridPane<? extends TemplateTheme> themeListPane; public final TemplateThemeGridPane<? extends TemplateTheme> themeListPane;
public TemplateThemeUsingPane(Window window) { public TemplateThemeUsingPane(@Nullable Window window) {
super(); super();
setLayout(new BorderLayout()); setLayout(new BorderLayout());
setBorder(new CompoundBorder( setBorder(new CompoundBorder(
@ -273,7 +278,7 @@ public class TemplateThemeGridPagesPane extends JPanel {
public static class TemplateThemeManagingPane extends TemplateThemeGridPagePane { public static class TemplateThemeManagingPane extends TemplateThemeGridPagePane {
private final UITabbedPane tabbedPane; private final UITabbedPane tabbedPane;
public TemplateThemeManagingPane(Window window) { public TemplateThemeManagingPane(@Nullable Window window) {
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
tabbedPane = new UITabbedPane(); tabbedPane = new UITabbedPane();

33
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPane.java

@ -9,6 +9,7 @@ import com.fr.design.event.ChangeListener;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.javax.annotation.Nullable;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -56,7 +57,7 @@ public class TemplateThemeGridPane<T extends TemplateTheme> extends BasicPane {
private final Window window; private final Window window;
public TemplateThemeGridPane(Window window, boolean displayTheme4NewTemplateMarker, TemplateThemeConfig<T> config, TemplateThemeProfilePane<T> profilePane) { public TemplateThemeGridPane(@Nullable Window window, boolean displayTheme4NewTemplateMarker, TemplateThemeConfig<T> config, TemplateThemeProfilePane<T> profilePane) {
this.window = window; this.window = window;
this.displayTheme4NewTemplateMarker = displayTheme4NewTemplateMarker; this.displayTheme4NewTemplateMarker = displayTheme4NewTemplateMarker;
this.config = config; this.config = config;
@ -90,21 +91,23 @@ public class TemplateThemeGridPane<T extends TemplateTheme> extends BasicPane {
} }
private void registerWindowListener() { private void registerWindowListener() {
window.addWindowListener(new WindowAdapter() { if (window != null) {
@Override window.addWindowListener(new WindowAdapter() {
public void windowOpened(WindowEvent e) { @Override
super.windowOpened(e); public void windowOpened(WindowEvent e) {
startListenThemeConfig(); super.windowOpened(e);
asyncFetchThemes(); startListenThemeConfig();
} asyncFetchThemes();
}
@Override @Override
public void windowClosed(WindowEvent e) { public void windowClosed(WindowEvent e) {
super.windowClosed(e); super.windowClosed(e);
stopListenThemeConfig(); stopListenThemeConfig();
asyncThemeFetcher.shutdown(); asyncThemeFetcher.shutdown();
} }
}); });
}
} }
public void fillContentListPane() { public void fillContentListPane() {

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

@ -1,6 +1,5 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.common.inputevent.InputEventBaseOnOS;
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.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
@ -11,23 +10,22 @@ import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.fit.DesignerUIModeConfig;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.share.ui.base.PopupMenuItem;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.form.fit.NewFormMarkAttr;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.share.ui.base.PopupMenuItem;
import com.fr.design.scrollruler.BaseRuler; import com.fr.design.scrollruler.BaseRuler;
import com.fr.design.scrollruler.HorizontalRuler; import com.fr.design.scrollruler.HorizontalRuler;
import com.fr.design.scrollruler.RulerLayout; import com.fr.design.scrollruler.RulerLayout;
import com.fr.design.scrollruler.ScrollRulerComponent; import com.fr.design.scrollruler.ScrollRulerComponent;
import com.fr.design.scrollruler.VerticalRuler; import com.fr.design.scrollruler.VerticalRuler;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.fit.NewFormMarkAttr;
import com.fr.form.main.mobile.FormMobileAttr; import com.fr.form.main.mobile.FormMobileAttr;
import com.fr.form.ui.container.WBodyLayoutType; import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WBorderLayout;
@ -35,7 +33,6 @@ import com.fr.form.ui.container.WFitLayout;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import javax.swing.AbstractAction; import javax.swing.AbstractAction;
import javax.swing.Action; import javax.swing.Action;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -65,7 +62,6 @@ import java.awt.event.FocusEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
@ -214,7 +210,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
button.addActionListener(new ActionListener() { button.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
GUICoreUtils.showPopupMenu(popupMenu, fixLayoutSwitchButton, 0, -59); popupMenu.show(fixLayoutSwitchButton, 0, -59);
} }
}); });
button.setVisible(!isAbsoluteBodyLayout()); button.setVisible(!isAbsoluteBodyLayout());

29
designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -42,6 +42,7 @@ import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.cell.cellattr.core.group.FilterTypeEnum; import com.fr.report.cell.cellattr.core.group.FilterTypeEnum;
import com.fr.report.cell.cellattr.core.group.SelectCount; import com.fr.report.cell.cellattr.core.group.SelectCount;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.jodd.util.ArraysUtil;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
@ -60,6 +61,7 @@ import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.BOTTOM; import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.BOTTOM;
import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.EVEN; import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.EVEN;
@ -472,6 +474,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
if (cellElement != null) { if (cellElement != null) {
sortPane.update(cellElement); sortPane.update(cellElement);
valuePane.update(cellElement); valuePane.update(cellElement);
formatAttrPane.update(cellElement);
filterPane.update(cellElement); filterPane.update(cellElement);
//更新单元格扩展属性 //更新单元格扩展属性
updateExtendConfig(); updateExtendConfig();
@ -486,6 +489,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
disableListener(); disableListener();
sortPane.populate(cellElement); sortPane.populate(cellElement);
valuePane.populate(cellElement); valuePane.populate(cellElement);
formatAttrPane.populate(cellElement);
filterPane.populate(cellElement); filterPane.populate(cellElement);
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
if (cellExpandAttr == null) { if (cellExpandAttr == null) {
@ -614,15 +618,19 @@ public class CellDSColumnEditor extends CellQuickEditor {
enableListener(); enableListener();
double[] rowSize = {P, P, P, P, P, P};
double[] columnSize = {F};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
{sortPane}, {sortPane},
{filterPane}, {filterPane},
{valuePane}, {valuePane},
{formatAttrPane},
{extendableDirectionPane}, {extendableDirectionPane},
{multiNumPane} {multiNumPane}
}; };
double[] rowSize = new double[components.length];
Arrays.fill(rowSize, P);
double[] columnSize = {F};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP); return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP);
} }
@ -1233,15 +1241,20 @@ public class CellDSColumnEditor extends CellQuickEditor {
} }
public class FormatAttrPane extends AbstractAttrNoScrollPane { public class FormatAttrPane extends AbstractAttrNoScrollPane {
private final TextFormatPane formatPane; private TextFormatPane formatPane;
public FormatAttrPane() { @Override
protected JPanel createContentPane() {
this.formatPane = new TextFormatPane(); this.formatPane = new TextFormatPane();
return this.formatPane;
} }
@Override @Override
protected JPanel createContentPane() { public Dimension getPreferredSize() {
return formatPane; if (formatPane == null) {
return super.getPreferredSize();
}
return formatPane.getPreferredSize();
} }
protected void initContentPane() { protected void initContentPane() {
@ -1253,13 +1266,13 @@ public class CellDSColumnEditor extends CellQuickEditor {
} }
public void populate(CellElement cellElement) { public void populate(CellElement cellElement) {
if (cellElement != null) { if (cellElement != null && formatPane != null) {
formatPane.populateBean(cellElement.getStyle()); formatPane.populateBean(cellElement.getStyle());
} }
} }
public void update(CellElement cellElement) { public void update(CellElement cellElement) {
if (cellElement != null) { if (cellElement != null && formatPane != null) {
cellElement.setStyle(formatPane.update(cellElement.getStyle())); cellElement.setStyle(formatPane.update(cellElement.getStyle()));
} }
} }

65
designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java

@ -8,8 +8,11 @@ import com.fr.design.actions.insert.cell.FormulaCellAction;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula; import com.fr.design.formula.UIFormula;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.style.TextFormatPane;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -35,6 +38,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.util.Arrays;
/** /**
* 公式快速编辑面板同文本数字编辑拆分 * 公式快速编辑面板同文本数字编辑拆分
@ -46,6 +50,7 @@ import java.awt.event.KeyEvent;
public class CellFormulaQuickEditor extends CellQuickEditor { public class CellFormulaQuickEditor extends CellQuickEditor {
//文本域 //文本域
private UITextField formulaTextField; private UITextField formulaTextField;
private TextFormatPane formatPane;
//编辑状态 //编辑状态
private boolean isEditing = false; private boolean isEditing = false;
@ -136,10 +141,59 @@ public class CellFormulaQuickEditor extends CellQuickEditor {
pane.add(formulaButton, BorderLayout.EAST); pane.add(formulaButton, BorderLayout.EAST);
content.add(pane, BorderLayout.NORTH); content.add(pane, BorderLayout.NORTH);
Component[][] componentLines = new Component[][] {
new Component[]{EMPTY_LABEL, content},
new Component[]{createFormatPane(), null},
};
double[] rowSize = new double[componentLines.length];
Arrays.fill(rowSize, TableLayout.PREFERRED);
double[] columnSize = new double[] {TableLayout.PREFERRED, TableLayout.FILL };
return TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ return TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
new Component[]{EMPTY_LABEL, content}}, new Component[]{EMPTY_LABEL, content},
new double[]{TableLayout.PREFERRED}, new Component[]{createFormatPane(), null},
new double[]{TableLayout.PREFERRED, TableLayout.FILL}, HGAP, VGAP); },
rowSize, columnSize, HGAP, VGAP);
}
private JPanel createFormatPane() {
formatPane = new TextFormatPane();
AbstractAttrNoScrollPane container = new AbstractAttrNoScrollPane() {
@Override
protected JPanel createContentPane() {
return formatPane;
}
protected void initContentPane() {
leftContentPane = createContentPane();
if (leftContentPane != null) {
leftContentPane.setBorder(BorderFactory.createEmptyBorder());
this.add(leftContentPane, BorderLayout.CENTER);
}
}
};
container.addAttributeChangeListener(new AttributeChangeListener() {
@Override
public void attributeChange() {
isEditing = true;
CellSelection cs1 = (CellSelection) tc.getSelection();
cellElement = tc.getEditingElementCase().getTemplateCellElement(cs1.getColumn(), cs1.getRow());
if (cellElement == null) {
CellSelection cs = (CellSelection) tc.getSelection();
cellElement = DefaultThemedTemplateCellElementCase.createInstance(cs.getColumn(), cs.getRow());
tc.getEditingElementCase().addCellElement(cellElement, false);
}
cellElement.setStyle(formatPane.update(cellElement.getStyle()));
fireTargetModified();
isEditing = false;
}
});
return container;
} }
@Override @Override
@ -202,6 +256,11 @@ public class CellFormulaQuickEditor extends CellQuickEditor {
} }
showText(str); showText(str);
formulaTextField.setEditable(tc.isSelectedOneCell()); formulaTextField.setEditable(tc.isSelectedOneCell());
if (cellElement != null) {
Style style = cellElement.getStyle();
formatPane.populateBean(style);
}
} }
/** /**

3
designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellStringQuickEditor.java

@ -3,6 +3,7 @@ package com.fr.quickeditor.cellquick;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.TextFormat; import com.fr.base.TextFormat;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextarea.UITextArea;
@ -65,7 +66,7 @@ public class CellStringQuickEditor extends CellQuickEditor {
*/ */
@Override @Override
public JComponent createCenterBody() { public JComponent createCenterBody() {
JPanel content = new JPanel(new BorderLayout()); JPanel content = new JPanel(new BorderLayout(0, IntervalConstants.INTERVAL_L1));
stringTextArea = new UITextArea(); stringTextArea = new UITextArea();
stringTextArea.addKeyListener(new KeyAdapter() { stringTextArea.addKeyListener(new KeyAdapter() {

Loading…
Cancel
Save