Browse Source

Pull request #8088: KERNEL-10254 FVS表格编辑器改成表单报表块的表格编辑器

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

* commit '37cbf75c647f680fa0d820a83c1adc6b38709b73':
  KERNEL-10254 FVS表格编辑器改成表单报表块的表格编辑器
feature/x
starryi 3 years ago
parent
commit
dbd88bacb6
  1. 7
      designer-base/src/main/java/com/fr/design/mainframe/BaseJForm.java
  2. 10
      designer-base/src/main/java/com/fr/design/mainframe/JDashboard.java
  3. 11
      designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java
  4. 21
      designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCasePaneDelegate.java
  5. 33
      designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java
  6. 23
      designer-realize/src/main/java/com/fr/design/mainframe/form/FormTabPane.java

7
designer-base/src/main/java/com/fr/design/mainframe/BaseJForm.java

@ -10,7 +10,7 @@ import javax.swing.JComponent;
* Date: 13-7-15
* Time: 上午10:28
*/
public interface BaseJForm<T> extends JTemplateProvider<T> {
public interface BaseJForm<T> extends JTemplateProvider<T>, JDashboard {
String XML_TAG = "JForm";
int FORM_TAB = 0;
@ -58,4 +58,9 @@ public interface BaseJForm<T> extends JTemplateProvider<T> {
* @param ecContainer ElementCase所在container
*/
void tabChanged(int index, FormElementCaseContainerProvider ecContainer);
@Override
default void switchToDashBoardEditor() {
tabChanged(FORM_TAB);
}
}

10
designer-base/src/main/java/com/fr/design/mainframe/JDashboard.java

@ -0,0 +1,10 @@
package com.fr.design.mainframe;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2022/3/1
*/
public interface JDashboard {
void switchToDashBoardEditor();
}

11
designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java

@ -30,6 +30,7 @@ import com.fr.design.selection.SelectableElement;
import com.fr.design.selection.Selectedable;
import com.fr.design.selection.SelectionListener;
import com.fr.form.FormElementCaseProvider;
import com.fr.form.fit.common.LightTool;
import com.fr.form.main.Form;
import com.fr.grid.Grid;
import com.fr.grid.selection.CellSelection;
@ -69,8 +70,12 @@ public class FormElementCaseDesigner
}
public FormElementCaseDesigner(T sheet, Form form) {
this(sheet, form.getFormMobileAttr().isMobileOnly(), LightTool.containNewFormFlag(form));
}
public FormElementCaseDesigner(T sheet, boolean isMobileOnly, boolean isNewForm) {
super(sheet);
elementCasePane = initElementCasePane(sheet, form);
elementCasePane = initElementCasePane(sheet, isMobileOnly, isNewForm);
this.setLayout(FRGUIPaneFactory.createBorderLayout());
elementCasePane.setSelection(getDefaultSelectElement());
this.add(elementCasePane, BorderLayout.CENTER);
@ -84,8 +89,8 @@ public class FormElementCaseDesigner
}
protected FormElementCasePaneDelegate initElementCasePane(T sheet, Form form){
return new FormElementCasePaneDelegate((FormElementCase) sheet, form);
protected FormElementCasePaneDelegate initElementCasePane(T sheet, boolean isMobileOnly, boolean isNewForm){
return new FormElementCasePaneDelegate((FormElementCase) sheet, isMobileOnly, isNewForm);
}
@Override

21
designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCasePaneDelegate.java

@ -9,6 +9,7 @@ import com.fr.design.actions.form.FormECFrozenAction;
import com.fr.design.designer.creator.XElementCase;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fit.NewUIModeCellElementPainter;
import com.fr.design.fit.common.FormDesignerUtil;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
@ -40,13 +41,16 @@ import java.awt.Rectangle;
*/
public class FormElementCasePaneDelegate extends ElementCasePane<FormElementCase>{
public FormElementCasePaneDelegate(FormElementCase sheet, Form form) {
this(sheet, form.getFormMobileAttr().isMobileOnly(), LightTool.containNewFormFlag(form));
}
public FormElementCasePaneDelegate(FormElementCase sheet, boolean isMobileOnly, boolean isNewForm) {
super(sheet);
this.getGrid().setPaginateLineShowType(form.getFormMobileAttr().isMobileOnly()
this.getGrid().setPaginateLineShowType(isMobileOnly
? Grid.SINGLE_HORIZONTAL_PAGINATE_LINE
: Grid.NO_PAGINATE_LINE);
if (LightTool.containNewFormFlag(form)){
if (isNewForm){
this.getGrid().setCellElementPainter(new NewUIModeCellElementPainter());
}
this.addSelectionChangeListener(new SelectionListener() {
@ -68,8 +72,17 @@ public class FormElementCasePaneDelegate extends ElementCasePane<FormElementCase
}
private Rectangle getBoundsLineRect(TemplateElementCase elementCase) {
FormDesigner designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
final Rectangle rectangle = new Rectangle();
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (!(template instanceof JForm)) {
return rectangle;
}
FormDesigner designer = ((JForm) template).getFormDesign();
if (designer == null) {
return rectangle;
}
XElementCase xElementCase = FormDesignerUtil.getXelementCase(designer.getRootComponent(), (FormElementCase) elementCase);
if (xElementCase != null) {
rectangle.setBounds(xElementCase.getBounds());

33
designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java

@ -2,7 +2,6 @@ package com.fr.design.mainframe.form;
import com.fr.base.DynamicUnitList;
import com.fr.base.ScreenResolution;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.cell.bar.DynamicScrollBar;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
@ -11,9 +10,11 @@ import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerUIModeConfig;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JDashboard;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JFormSliderPane;
import com.fr.design.mainframe.ReportComponent;
import com.fr.design.mainframe.ReportComponentCompositeMouseWheelHandler;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JTemplateProvider;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.form.FormElementCaseContainerProvider;
import com.fr.form.FormElementCaseProvider;
@ -24,11 +25,11 @@ import com.fr.report.worksheet.FormElementCase;
import com.fr.stable.AssistUtils;
import com.fr.stable.Constants;
import javax.swing.*;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.*;
import java.awt.BorderLayout;
/**
* 整个FormElementCase编辑区域 包括滚动条中间的grid或者聚合块下面的sheetTab
@ -40,19 +41,19 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
private static final int MIN = 10;
private static final int DIR = 10;
private static final double MIN_TIME = 0.4;
public FormElementCaseDesigner elementCaseDesigner;
private BaseJForm jForm;
public final FormElementCaseDesigner elementCaseDesigner;
private final JTemplateProvider jTemplate;
private FormTabPane sheetNameTab;
private final FormTabPane sheetNameTab;
private JPanel hbarContainer;
private JFormSliderPane jSliderContainer;
public FormReportComponentComposite(BaseJForm jform, FormElementCaseDesigner elementCaseDesign, FormElementCaseContainerProvider ecContainer) {
this.jForm = jform;
public FormReportComponentComposite(JTemplateProvider jTemplate, JDashboard jDashboard, FormElementCaseDesigner<?,?,?> elementCaseDesign, String ecContainerName) {
this.jTemplate = jTemplate;
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.elementCaseDesigner = elementCaseDesign;
this.add(elementCaseDesigner, BorderLayout.CENTER);
sheetNameTab = new FormTabPane(ecContainer, jform);
sheetNameTab = new FormTabPane(ecContainerName, jDashboard);
this.add(createSouthControlPane(), BorderLayout.SOUTH);
jSliderContainer.addValueChangeListener(showValSpinnerChangeListener);
this.elementCaseDesigner.elementCasePane.getGrid().addMouseWheelListener(new FormReportComponentCompositeMouseWheelHandler(this));
@ -60,6 +61,10 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
this.jSliderContainer.setShowValue((ScreenResolution.getScreenResolution() * HUND) / Constants.DEFAULT_WEBWRITE_AND_SCREEN_RESOLUTION);
}
public FormReportComponentComposite(BaseJForm jform, FormElementCaseDesigner elementCaseDesign, FormElementCaseContainerProvider ecContainer) {
this(jform, jform, elementCaseDesign, ecContainer.getElementCaseContainerName());
}
ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
@ -167,7 +172,7 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
}
public void setComposite() {
DesignerContext.getDesignerFrame().resetToolkitByPlus((ToolBarMenuDockPlus) jForm);
DesignerContext.getDesignerFrame().resetToolkitByPlus((ToolBarMenuDockPlus) jTemplate);
this.validate();
this.repaint(40);
}
@ -182,7 +187,7 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
* 模板更新
*/
public void fireTargetModified() {
jForm.fireTargetModified();
jTemplate.fireTargetModified();
}
public JFormSliderPane getSliderContainer() {

23
designer-realize/src/main/java/com/fr/design/mainframe/form/FormTabPane.java

@ -5,6 +5,7 @@ import com.fr.base.GraphHelper;
import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.JDashboard;
import com.fr.form.FormElementCaseContainerProvider;
@ -27,8 +28,8 @@ public class FormTabPane extends JComponent implements MouseListener, MouseMotio
private static final int GAP = 5; //间隔
private BaseJForm form;
private FormElementCaseContainerProvider elementCase;
private JDashboard jDashboard;
private final String elementCaseContainerName;
//选了30度和60度的特殊角度的x,y作为经过的两个点的坐标
private double specialLocation1 = 2.5;
@ -48,8 +49,12 @@ public class FormTabPane extends JComponent implements MouseListener, MouseMotio
private int selectedIndex = -1;
public FormTabPane(FormElementCaseContainerProvider elementCase, BaseJForm form){
this.elementCase = elementCase;
this.form = form;
this(elementCase.getElementCaseContainerName(), form);
}
public FormTabPane(String elementCaseContainerName, JDashboard jDashboard){
this.elementCaseContainerName = elementCaseContainerName;
this.jDashboard = jDashboard;
this.setLayout(new BorderLayout(0, 0));
this.addMouseListener(this);
this.addMouseMotionListener(this);
@ -57,12 +62,16 @@ public class FormTabPane extends JComponent implements MouseListener, MouseMotio
this.setForeground(new Color(99, 99, 99));
}
public String getElementCaseContainerName() {
return elementCaseContainerName;
}
public void paintComponent(Graphics g){
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
calculateECWidth();
paintFormTab(g2d, 0, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Form"), POLY_SHEET_ICON);
paintECTab(g2d, formTabWidth, elementCase.getElementCaseContainerName(), WORK_SHEET_ICON);
paintECTab(g2d, formTabWidth, getElementCaseContainerName(), WORK_SHEET_ICON);
}
/**
@ -165,7 +174,7 @@ public class FormTabPane extends JComponent implements MouseListener, MouseMotio
private void calculateECWidth() {
FontMetrics fm = GraphHelper.getFontMetrics(this.getFont());
int charWidth = fm.charWidth('M');
String ECName = elementCase.getElementCaseContainerName();
String ECName = getElementCaseContainerName();
ecTabWidth = Math.max(ecTabWidth,fm.stringWidth(ECName) + charWidth * 2 + ADD_WIDTH_BY_SHEETNAME) ;
}
@ -177,7 +186,7 @@ public class FormTabPane extends JComponent implements MouseListener, MouseMotio
public void mouseClicked(MouseEvent e) {
selectedIndex = getTabIndex(e.getX());
if (selectedIndex == FORM_INDEX) {
form.tabChanged(FORM_INDEX);
jDashboard.switchToDashBoardEditor();
}
repaint();
}

Loading…
Cancel
Save