Browse Source

Merging in latest from upstream (DESIGN/design:refs/heads/feature/10.0)

* commit 'ca02d9cb1beeb8e40a079a8183c6f3134f1d1924':
  sonar问题修复,无jira任务
  无jira任务,sonar问题修复
  无JIRA任务 为了能提供SDK做的控件结构修改(续)
  无JIRA任务,sonar问题修复
  REPORT-20323 sonar问题修复
  sonar修复
persist/11.0
vito 5 years ago
parent
commit
735bbff844
  1. 6
      designer-base/src/main/java/com/fr/design/gui/frpane/CommitTabbedPane.java
  2. 13
      designer-base/src/main/java/com/fr/design/layout/TableLayout.java
  3. 3
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java
  4. 3
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellRender.java
  5. 3
      designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java
  6. 9
      designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java
  7. 11
      designer-form/src/main/java/com/fr/design/designer/creator/XCheckBox.java
  8. 9
      designer-form/src/main/java/com/fr/design/designer/creator/XDateEditor.java
  9. 4
      designer-form/src/main/java/com/fr/design/gui/xpane/ToolTipEditor.java
  10. 16
      designer-form/src/main/java/com/fr/design/mainframe/FormArea.java
  11. 20
      designer-form/src/main/java/com/fr/design/mainframe/FormDesignerDropTarget.java
  12. 10
      designer-form/src/main/java/com/fr/design/widget/ui/designer/component/FormWidgetValuePane.java
  13. 2
      designer-realize/src/main/java/com/fr/design/actions/cell/style/AlignmentAction.java
  14. 3
      designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontSizeAction.java
  15. 4
      designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java
  16. 2
      designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java
  17. 5
      designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java
  18. 7
      designer-realize/src/main/java/com/fr/design/mainframe/AuthorityEditToolBarPane.java
  19. 2
      designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java
  20. 5
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  21. 3
      designer-realize/src/main/java/com/fr/design/mainframe/SheetAuthorityEditPane.java
  22. 3
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java
  23. 3
      designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java
  24. 6
      designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java

6
designer-base/src/main/java/com/fr/design/gui/frpane/CommitTabbedPane.java

@ -296,7 +296,7 @@ public class CommitTabbedPane extends JComponent implements MouseListener, Mous
double[] x = {startX, startX, startX + tabWidth, startX + tabWidth, startX}; double[] x = {startX, startX, startX + tabWidth, startX + tabWidth, startX};
double[] y = {-1, getHeight(), getHeight(), -1, -1}; double[] y = {-1, getHeight(), getHeight(), -1, -1};
RoundRectangle2D.Double rect1 = new RoundRectangle2D.Double(startX, 1, this.getWidth(), this.getHeight(), 7, 7); RoundRectangle2D.Double rect1 = new RoundRectangle2D.Double(startX, 1, this.getWidth(), this.getHeight(), 7, 7);
g2d.setPaint(new GradientPaint(1, 1, new Color(255, 255, 255), 1, getHeight() - 1, UIConstants.NORMAL_BACKGROUND)); g2d.setPaint(new GradientPaint(1, 1, new Color(255, 255, 255), 1, getHeight() - 1f, UIConstants.NORMAL_BACKGROUND));
GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, x.length); GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, x.length);
generalPath.moveTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); generalPath.moveTo((float) x[0] + CORNOR_RADIUS, (float) y[0]);
@ -345,9 +345,9 @@ public class CommitTabbedPane extends JComponent implements MouseListener, Mous
double[] x = {startX, startX, startX + tabWidth, startX + tabWidth, startX}; double[] x = {startX, startX, startX + tabWidth, startX + tabWidth, startX};
double[] y = {-1, getHeight() - 1, getHeight() - 1, -1, -1}; double[] y = {-1, getHeight() - 1, getHeight() - 1, -1, -1};
if (selfIndex == mouseOveredIndex) { if (selfIndex == mouseOveredIndex) {
g2d.setPaint(new GradientPaint(1, 1, new Color(255, 255, 255), 1, getHeight() - 1, UIConstants.NORMAL_BACKGROUND)); g2d.setPaint(new GradientPaint(1, 1, new Color(255, 255, 255), 1, getHeight() - 1f, UIConstants.NORMAL_BACKGROUND));
} else { } else {
g2d.setPaint(new GradientPaint(1, 1, UIConstants.NORMAL_BACKGROUND, 1, getHeight() - 1, UIConstants.NORMAL_BACKGROUND)); g2d.setPaint(new GradientPaint(1, 1, UIConstants.NORMAL_BACKGROUND, 1, getHeight() - 1f, UIConstants.NORMAL_BACKGROUND));
} }

13
designer-base/src/main/java/com/fr/design/layout/TableLayout.java

@ -322,7 +322,6 @@ public class TableLayout implements LayoutManager2, Serializable {
this row/column. */ this row/column. */
public static final double MINIMUM = -3.0; public static final double MINIMUM = -3.0;
public static final double EPSILON = 0.0000001;
//****************************************************************************** //******************************************************************************
//** Constructors *** //** Constructors ***
@ -1808,8 +1807,8 @@ public class TableLayout implements LayoutManager2, Serializable {
for (counter = entry.cr1[z]; counter <= entry.cr2[z]; counter++) for (counter = entry.cr1[z]; counter <= entry.cr2[z]; counter++)
if (crSpec[z][counter] >= 1.0) if (crSpec[z][counter] >= 1.0)
scalableSize -= crSpec[z][counter]; scalableSize -= crSpec[z][counter];
else if (Math.abs(crSpec[z][counter] - PREFERRED) < EPSILON || else if (AssistUtils.equals(crSpec[z][counter], PREFERRED) ||
Math.abs(crSpec[z][counter] - MINIMUM) < EPSILON) { AssistUtils.equals(crSpec[z][counter], MINIMUM)) {
scalableSize -= crPrefMin[counter]; scalableSize -= crPrefMin[counter];
} }
@ -1825,13 +1824,13 @@ public class TableLayout implements LayoutManager2, Serializable {
// Add scaled size to relativeWidth // Add scaled size to relativeWidth
relativeSize += crSpec[z][counter]; relativeSize += crSpec[z][counter];
// Cr is fill // Cr is fill
else if (Math.abs(crSpec[z][counter] - FILL) < EPSILON && Math.abs(fillSizeRatio - 0.0) >= EPSILON) else if (AssistUtils.equals(crSpec[z][counter], FILL) && !AssistUtils.equals(fillSizeRatio, 0.0))
// Add fill size to relativeWidth // Add fill size to relativeWidth
relativeSize += fillSizeRatio; relativeSize += fillSizeRatio;
} }
// Determine the total scaled size as estimated by this component // Determine the total scaled size as estimated by this component
if (Math.abs(relativeSize - 0) < EPSILON) if (AssistUtils.equals(relativeSize, 0))
temp = 0; temp = 0;
else else
temp = (int) (scalableSize / relativeSize + 0.5); temp = (int) (scalableSize / relativeSize + 0.5);
@ -1852,8 +1851,8 @@ public class TableLayout implements LayoutManager2, Serializable {
if (crSpec[z][counter] >= 1.0) if (crSpec[z][counter] >= 1.0)
totalSize += (int) (crSpec[z][counter] + 0.5); totalSize += (int) (crSpec[z][counter] + 0.5);
// Is the current cr a preferred/minimum size // Is the current cr a preferred/minimum size
else if (Math.abs(crSpec[z][counter] - PREFERRED) < EPSILON|| else if (AssistUtils.equals(crSpec[z][counter], PREFERRED) ||
Math.abs(crSpec[z][counter] - MINIMUM) < EPSILON) { AssistUtils.equals(crSpec[z][counter], MINIMUM)) {
// Add preferred/minimum width // Add preferred/minimum width
totalSize += crPrefMin[counter]; totalSize += crPrefMin[counter];
} }

3
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java

@ -10,6 +10,7 @@ import com.fr.design.mainframe.vcs.common.VcsCacheFileNodeFile;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.report.entity.VcsEntity; import com.fr.report.entity.VcsEntity;
import com.fr.stable.AssistUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.VcsOperator;
@ -67,7 +68,7 @@ public class FileVersionCellEditor extends AbstractCellEditor implements TableCe
} }
double height = editor.getPreferredSize().getHeight(); double height = editor.getPreferredSize().getHeight();
if (table.getRowHeight(row) != height) { if (!AssistUtils.equals(table.getRowHeight(row), height)) {
table.setRowHeight(row, (int) height + VcsHelper.OFFSET); table.setRowHeight(row, (int) height + VcsHelper.OFFSET);
} }
return editor; return editor;

3
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellRender.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe.vcs.ui;
import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.report.entity.VcsEntity; import com.fr.report.entity.VcsEntity;
import com.fr.stable.AssistUtils;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JTable; import javax.swing.JTable;
@ -34,7 +35,7 @@ public class FileVersionCellRender implements TableCellRenderer {
editor.setBackground(isSelected ? TABLE_SELECT_BACKGROUND : TREE_BACKGROUND); editor.setBackground(isSelected ? TABLE_SELECT_BACKGROUND : TREE_BACKGROUND);
double height = editor.getPreferredSize().getHeight(); double height = editor.getPreferredSize().getHeight();
if (table.getRowHeight(row) != height) { if (!AssistUtils.equals(table.getRowHeight(row), height)) {
table.setRowHeight(row, (int) height + VcsHelper.OFFSET); table.setRowHeight(row, (int) height + VcsHelper.OFFSET);
} }
return editor; return editor;

3
designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java

@ -29,6 +29,7 @@ import com.fr.design.style.color.ColorSelectConfigManager;
import com.fr.design.style.color.ColorSelectDetailPane; import com.fr.design.style.color.ColorSelectDetailPane;
import com.fr.design.style.color.ColorSelectDialog; import com.fr.design.style.color.ColorSelectDialog;
import com.fr.design.style.color.ColorSelectable; import com.fr.design.style.color.ColorSelectable;
import com.fr.stable.AssistUtils;
/** /**
* TODO:面板缩放的功能没有考虑就是尾值过大导致超过界面显示的情况原来的那个实现完全是个BUG要缩放的情况也比较少就干脆以后弄吧 * TODO:面板缩放的功能没有考虑就是尾值过大导致超过界面显示的情况原来的那个实现完全是个BUG要缩放的情况也比较少就干脆以后弄吧
@ -217,7 +218,7 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
* @return 同上 * @return 同上
*/ */
public boolean isOriginalPlace() { public boolean isOriginalPlace() {
return startLabel.getValue() == min && endLabel.getValue() == max; return AssistUtils.equals(startLabel.getValue(), min) && AssistUtils.equals(endLabel.getValue(), max);
} }
/** /**

9
designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java

@ -31,6 +31,7 @@ import com.fr.design.style.color.ColorFactory;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.style.color.ColorSelectable; import com.fr.design.style.color.ColorSelectable;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.stable.AssistUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -890,10 +891,10 @@ public final class GUICoreUtils {
* @return 同上 * @return 同上
*/ */
public static boolean isTheSameRect(Rectangle oneRect, Rectangle otherRect) { public static boolean isTheSameRect(Rectangle oneRect, Rectangle otherRect) {
return oneRect.getX() == otherRect.getX() return AssistUtils.equals(oneRect.getX(), otherRect.getX())
&& oneRect.getY() == otherRect.getY() && AssistUtils.equals(oneRect.getY(), otherRect.getY())
&& oneRect.getWidth() == otherRect.getWidth() && AssistUtils.equals(oneRect.getWidth(), otherRect.getWidth())
&& oneRect.getHeight() == otherRect.getHeight(); && AssistUtils.equals(oneRect.getHeight(), otherRect.getHeight());
} }
/** /**

11
designer-form/src/main/java/com/fr/design/designer/creator/XCheckBox.java

@ -7,13 +7,12 @@ import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.mainframe.widget.editors.WidgetValueEditor; import com.fr.design.mainframe.widget.editors.WidgetValueEditor;
import com.fr.form.ui.CheckBox; import com.fr.form.ui.CheckBox;
import com.fr.form.ui.WidgetValue; import com.fr.form.ui.concept.data.ValueInitializer;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.BorderFactory; import javax.swing.*;
import javax.swing.JComponent; import java.awt.*;
import java.awt.Dimension;
import java.beans.IntrospectionException; import java.beans.IntrospectionException;
/** /**
@ -45,7 +44,7 @@ public class XCheckBox extends XWidgetCreator {
@Override @Override
public void propertyChange() { public void propertyChange() {
WidgetValue value = ((CheckBox) data).getWidgetValue(); ValueInitializer value = ((CheckBox) data).getWidgetValue();
if (value != null && value.getValue() instanceof Boolean) { if (value != null && value.getValue() instanceof Boolean) {
((UICheckBox) editor).setSelected((Boolean) value.getValue()); ((UICheckBox) editor).setSelected((Boolean) value.getValue());
} }
@ -84,7 +83,7 @@ public class XCheckBox extends XWidgetCreator {
public void firePropertyChange() { public void firePropertyChange() {
((UICheckBox) editor).setText(((CheckBox) data).getText()); ((UICheckBox) editor).setText(((CheckBox) data).getText());
WidgetValue value = ((CheckBox) data).getWidgetValue(); ValueInitializer value = ((CheckBox) data).getWidgetValue();
if (value != null && value.getValue() instanceof Boolean) { if (value != null && value.getValue() instanceof Boolean) {
((UICheckBox) editor).setSelected((Boolean) value.getValue()); ((UICheckBox) editor).setSelected((Boolean) value.getValue());
} }

9
designer-form/src/main/java/com/fr/design/designer/creator/XDateEditor.java

@ -12,15 +12,14 @@ import com.fr.design.mainframe.widget.editors.WidgetValueEditor;
import com.fr.design.mainframe.widget.renderer.DateCellRenderer; import com.fr.design.mainframe.widget.renderer.DateCellRenderer;
import com.fr.form.ui.DateEditor; import com.fr.form.ui.DateEditor;
import com.fr.form.ui.WidgetValue; import com.fr.form.ui.WidgetValue;
import com.fr.form.ui.concept.data.ValueInitializer;
import com.fr.general.DateUtils; import com.fr.general.DateUtils;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.JComponent; import javax.swing.*;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.Color;
import java.awt.Dimension;
import java.beans.IntrospectionException; import java.beans.IntrospectionException;
import java.util.Date; import java.util.Date;
@ -84,7 +83,7 @@ public class XDateEditor extends XDirectWriteEditor {
private void initFieldText() { private void initFieldText() {
DateEditor dateEditor = (DateEditor) data; DateEditor dateEditor = (DateEditor) data;
if (dateEditor.getWidgetValue() != null) { if (dateEditor.getWidgetValue() != null) {
WidgetValue widgetValue = dateEditor.getWidgetValue(); ValueInitializer widgetValue = dateEditor.getWidgetValue();
//控件值.toString //控件值.toString
String valueStr = widgetValue.toString(); String valueStr = widgetValue.toString();
//控件值 //控件值

4
designer-form/src/main/java/com/fr/design/gui/xpane/ToolTipEditor.java

@ -15,7 +15,7 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.DataControl; import com.fr.form.ui.DataControl;
import com.fr.form.ui.EditorHolder; import com.fr.form.ui.EditorHolder;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.WidgetValue; import com.fr.form.ui.WidgetValueUtils;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
@ -77,7 +77,7 @@ public class ToolTipEditor extends JWindow {
createWidget.setWidgetName(widget.getWidgetName()); createWidget.setWidgetName(widget.getWidgetName());
createWidget.setEnabled(widget.isEnabled()); createWidget.setEnabled(widget.isEnabled());
createWidget.setVisible(widget.isVisible()); createWidget.setVisible(widget.isVisible());
WidgetValue.convertWidgetValue((DataControl) createWidget, widget.getWidgetValue().getValue()); WidgetValueUtils.convertWidgetValue((DataControl) createWidget, widget.getWidgetValue().getValue());
XCreator creator = null; XCreator creator = null;
creator = parent.replace(createWidget, holder); creator = parent.replace(createWidget, holder);
Component designer = holder.getDesignerEditor().getEditorTarget().getParent(); Component designer = holder.getDesignerEditor().getEditorTarget().getParent();

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

@ -23,6 +23,7 @@ import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.main.mobile.FormMobileAttr; import com.fr.form.main.mobile.FormMobileAttr;
import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WBorderLayout;
import com.fr.general.FRScreen; import com.fr.general.FRScreen;
import com.fr.stable.AssistUtils;
import javax.swing.JComponent; import javax.swing.JComponent;
@ -226,7 +227,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
// slidePane.populateBean(screenValue); // slidePane.populateBean(screenValue);
if (root.acceptType(XWFitLayout.class)) { if (root.acceptType(XWFitLayout.class)) {
XWFitLayout layout = (XWFitLayout) root; XWFitLayout layout = (XWFitLayout) root;
if (screenValue != DEFAULT_SLIDER) { if ( !AssistUtils.equals(screenValue, DEFAULT_SLIDER) ) {
reCalculateRoot(screenValue, true); reCalculateRoot(screenValue, true);
} else { } else {
// 组件间隔啊 // 组件间隔啊
@ -354,7 +355,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
// double value = slidePane.updateBean(); // double value = slidePane.updateBean();
//重置滑块的值为默认值100 //重置滑块的值为默认值100
START_VALUE = DEFAULT_SLIDER; START_VALUE = DEFAULT_SLIDER;
if (screenValue == DEFAULT_SLIDER) { if ( AssistUtils.equals(screenValue, DEFAULT_SLIDER) ) {
layout.getParent().setSize(width, height + designer.getParaHeight()); layout.getParent().setSize(width, height + designer.getParaHeight());
FormArea.this.validate(); FormArea.this.validate();
} else { } else {
@ -370,7 +371,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
* @param value * @param value
*/ */
private void reCalculateRoot(double value, boolean needCalculateParaHeight) { private void reCalculateRoot(double value, boolean needCalculateParaHeight) {
if (value == START_VALUE) { if ( AssistUtils.equals(value, START_VALUE) ) {
return; return;
} }
double percent = (value - START_VALUE) / START_VALUE; double percent = (value - START_VALUE) / START_VALUE;
@ -734,15 +735,15 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
this.horicalMax = (int) totalSize.getHeight(); this.horicalMax = (int) totalSize.getHeight();
// 撤销时会refreshRoot,导致layout大小变为默认大小 // 撤销时会refreshRoot,导致layout大小变为默认大小
// 按照之前设置的宽高和百分比重置下容器size // 按照之前设置的宽高和百分比重置下容器size
if (width != widthPane.getValue()) { if ( !AssistUtils.equals(width, widthPane.getValue()) ) {
widthPane.setValue(width); widthPane.setValue(width);
reCalculateWidth((int) width); reCalculateWidth((int) width);
} }
if (height != heightPane.getValue()) { if ( !AssistUtils.equals(height, heightPane.getValue()) ) {
heightPane.setValue(height); heightPane.setValue(height);
reCalculateHeight((int) height); reCalculateHeight((int) height);
} }
if (designer.getRootComponent().acceptType(XWFitLayout.class) && slide == DEFAULT_SLIDER) { if (designer.getRootComponent().acceptType(XWFitLayout.class) && AssistUtils.equals(slide, DEFAULT_SLIDER) ) {
XWFitLayout layout = (XWFitLayout) designer.getRootComponent(); XWFitLayout layout = (XWFitLayout) designer.getRootComponent();
// 撤销时先refreshRoot了,此处去掉内边距再增加间隔 // 撤销时先refreshRoot了,此处去掉内边距再增加间隔
layout.moveContainerMargin(); layout.moveContainerMargin();
@ -817,6 +818,9 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
Rectangle rec = new Rectangle(left + (right - DESIGNERWIDTH) / 2, TOPGAP, right, bottom); Rectangle rec = new Rectangle(left + (right - DESIGNERWIDTH) / 2, TOPGAP, right, bottom);
//是否为表单 //是否为表单
if (isValid) { if (isValid) {
if (hbarPreferredSize == null) {
throw new IllegalArgumentException("hbarPreferredSize can not be null!");
}
int maxHeight = bottom - hbarPreferredSize.height - resize.height - TOPGAP * 2; int maxHeight = bottom - hbarPreferredSize.height - resize.height - TOPGAP * 2;
int maxWidth = right - vbarPreferredSize.width; int maxWidth = right - vbarPreferredSize.width;
DESIGNERWIDTH = DESIGNERWIDTH > maxWidth ? maxWidth : DESIGNERWIDTH; DESIGNERWIDTH = DESIGNERWIDTH > maxWidth ? maxWidth : DESIGNERWIDTH;

20
designer-form/src/main/java/com/fr/design/mainframe/FormDesignerDropTarget.java

@ -6,10 +6,11 @@ import com.fr.form.ui.DataControl;
import com.fr.form.ui.IframeEditor; import com.fr.form.ui.IframeEditor;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.WidgetValue; import com.fr.form.ui.WidgetValue;
import com.fr.form.ui.concept.data.ValueInitializer;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import java.awt.Point; import java.awt.*;
import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable; import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.datatransfer.UnsupportedFlavorException;
@ -31,6 +32,7 @@ public class FormDesignerDropTarget extends DropTargetAdapter {
/** /**
* 响应拖拽进入事件 * 响应拖拽进入事件
*
* @param dtde 需要被处理的拖拽事件 * @param dtde 需要被处理的拖拽事件
*/ */
public void dragEnter(DropTargetDragEvent dtde) { public void dragEnter(DropTargetDragEvent dtde) {
@ -39,6 +41,7 @@ public class FormDesignerDropTarget extends DropTargetAdapter {
/** /**
* 处理拖拽经过事件 * 处理拖拽经过事件
*
* @param dtde 需要被处理的拖拽事件 * @param dtde 需要被处理的拖拽事件
*/ */
public void dragOver(DropTargetDragEvent dtde) { public void dragOver(DropTargetDragEvent dtde) {
@ -52,6 +55,7 @@ public class FormDesignerDropTarget extends DropTargetAdapter {
/** /**
* 处理拖拽释放事件 * 处理拖拽释放事件
*
* @param dtde 需要被处理的拖拽事件 * @param dtde 需要被处理的拖拽事件
*/ */
public void drop(DropTargetDropEvent dtde) { public void drop(DropTargetDropEvent dtde) {
@ -75,22 +79,16 @@ public class FormDesignerDropTarget extends DropTargetAdapter {
if (!(widget instanceof DataControl)) { if (!(widget instanceof DataControl)) {
return; return;
} }
WidgetValue oldvalue = ((DataControl) widget).getWidgetValue(); ValueInitializer oldValue = ((DataControl) widget).getWidgetValue();
WidgetValue newValue = new WidgetValue(new DataBinding((String[][]) o)); ValueInitializer newValue = new WidgetValue(new DataBinding((String[][]) o));
if (!ComparatorUtils.equals(oldvalue, newValue)) { if (!ComparatorUtils.equals(oldValue, newValue)) {
((DataControl) widget).setWidgetValue(newValue); ((DataControl) widget).setWidgetValue(newValue);
designer.fireTargetModified(); designer.fireTargetModified();
} }
creator.rebuid(); creator.rebuid();
designer.getSelectionModel().setSelectedCreator(creator); designer.getSelectionModel().setSelectedCreator(creator);
} catch (UnsupportedFlavorException e) { } catch (UnsupportedFlavorException | IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
} }
private void setSrcForIframeEditor() {
} }
} }

10
designer-form/src/main/java/com/fr/design/widget/ui/designer/component/FormWidgetValuePane.java

@ -1,7 +1,11 @@
package com.fr.design.widget.ui.designer.component; package com.fr.design.widget.ui.designer.component;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.editor.editor.*; import com.fr.design.editor.editor.BooleanEditor;
import com.fr.design.editor.editor.DateEditor;
import com.fr.design.editor.editor.DoubleEditor;
import com.fr.design.editor.editor.Editor;
import com.fr.design.editor.editor.FormulaEditor;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.mainframe.widget.editors.DataBindingEditor; import com.fr.design.mainframe.widget.editors.DataBindingEditor;
import com.fr.design.mainframe.widget.editors.DataTableEditor; import com.fr.design.mainframe.widget.editors.DataTableEditor;
@ -9,9 +13,9 @@ import com.fr.design.mainframe.widget.editors.ServerDataBindingEditor;
import com.fr.design.mainframe.widget.editors.ServerDataTableEditor; import com.fr.design.mainframe.widget.editors.ServerDataTableEditor;
import com.fr.form.ui.DataControl; import com.fr.form.ui.DataControl;
import com.fr.form.ui.WidgetValue; import com.fr.form.ui.WidgetValue;
import com.fr.form.ui.concept.data.ValueInitializer;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -112,7 +116,7 @@ public class FormWidgetValuePane extends JPanel {
} }
public void populate(DataControl ob) { public void populate(DataControl ob) {
WidgetValue widgetValue = ob.getWidgetValue(); ValueInitializer widgetValue = ob.getWidgetValue();
if (widgetValue != null) { if (widgetValue != null) {
for (int i = 0; i < editor.length; i++) { for (int i = 0; i < editor.length; i++) {
if (editor[i].accept(widgetValue.getValue())) { if (editor[i].accept(widgetValue.getValue())) {

2
designer-realize/src/main/java/com/fr/design/actions/cell/style/AlignmentAction.java

@ -110,9 +110,11 @@ public class AlignmentAction extends ButtonGroupAction implements StyleActionInt
group.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Left"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Right")}); group.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Left"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Right")});
} }
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
if (group != null) {
group.getButton(i).setRoundBorder(true, UIConstants.ARC); group.getButton(i).setRoundBorder(true, UIConstants.ARC);
group.getButton(i).setBorderPainted(true); group.getButton(i).setBorderPainted(true);
} }
}
return group; return group;
} }

3
designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontSizeAction.java

@ -15,6 +15,7 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.stable.AssistUtils;
/** /**
@ -51,7 +52,7 @@ public class ReportFontSizeAction extends AbstractStyleAction {
if (style.getFRFont().getSize() == defStyle.getFRFont().getSize()) { if (style.getFRFont().getSize() == defStyle.getFRFont().getSize()) {
style = StyleUtils.setReportFontSize(style, defStyle.getFRFont().getSize()); style = StyleUtils.setReportFontSize(style, defStyle.getFRFont().getSize());
} }
if (selectedFontSize == style.getFRFont().getSize()) { if (AssistUtils.equals(selectedFontSize, style.getFRFont().getSize())){
return style; return style;
} }
style = StyleUtils.setReportFontSize(style, selectedFontSize); style = StyleUtils.setReportFontSize(style, selectedFontSize);

4
designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java

@ -247,11 +247,7 @@ public class DSColumnAdvancedPane extends BasicPane {
this.sortOrderComboBox.setSortOrder(new SortOrder(sort)); this.sortOrderComboBox.setSortOrder(new SortOrder(sort));
String sortFormula = dSColumn.getSortFormula(); String sortFormula = dSColumn.getSortFormula();
if (sortFormula != null && sortFormula.length() >= 1) {
sortFormulaTextField.setText(sortFormula); sortFormulaTextField.setText(sortFormula);
} else {
sortFormulaTextField.setText(sortFormula);
}
} }
public void update(CellElement cellElement) { public void update(CellElement cellElement) {

2
designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java

@ -263,7 +263,7 @@ public class SelectedDataColumnPane extends BasicPane {
SimpleDSColumn simpleDSColumn = updateColumnPane(); SimpleDSColumn simpleDSColumn = updateColumnPane();
dsColumn.setDSName(Objects.requireNonNull(simpleDSColumn).getDsName()); dsColumn.setDSName(Objects.requireNonNull(simpleDSColumn).getDsName());
dsColumn.setColumn(simpleDSColumn.getColumn()); dsColumn.setColumn(Objects.requireNonNull(simpleDSColumn).getColumn());
dsColumn.setParameters((ps != null && ps.length > 0) ? ps : null); dsColumn.setParameters((ps != null && ps.length > 0) ? ps : null);
} }

5
designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java

@ -140,10 +140,11 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
@Override @Override
public void populateBean(Listener listener) { public void populateBean(Listener listener) {
this.listener = listener; if (listener == null){
if (this.listener == null) {
this.listener = new Listener(); this.listener = new Listener();
return;
} }
this.listener = listener;
this.nameText.setText(listener.getEventName()); this.nameText.setText(listener.getEventName());
JavaScript js = listener.getAction(); JavaScript js = listener.getAction();
for (int i = 0; i < this.cards.size(); i++) { for (int i = 0; i < this.cards.size(); i++) {

7
designer-realize/src/main/java/com/fr/design/mainframe/AuthorityEditToolBarPane.java

@ -13,6 +13,7 @@ import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.webattr.ToolBarButton; import com.fr.design.webattr.ToolBarButton;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
@ -204,7 +205,7 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane {
public void populateType() { public void populateType() {
if (name.getText() == "") { if (StringUtils.isEmpty(name.getText())) {
type.setText(""); type.setText("");
} else { } else {
type.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Toolbar_Button")); type.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Toolbar_Button"));
@ -218,7 +219,7 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane {
names += "," + buttonlists.get(i).getNameOption().optionName(); names += "," + buttonlists.get(i).getNameOption().optionName();
} }
} }
if (names != "") { if (StringUtils.isNotEmpty(names)) {
names = names.substring(1); names = names.substring(1);
} }
name.setText(names); name.setText(names);
@ -226,7 +227,7 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane {
public void populateCheckPane() { public void populateCheckPane() {
checkPane.removeAll(); checkPane.removeAll();
if (name.getText() == "") { if (StringUtils.isEmpty(name.getText())) {
return; return;
} }
double f = TableLayout.FILL; double f = TableLayout.FILL;

2
designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java

@ -157,7 +157,7 @@ public class FormatBrushAction extends ElementCaseAction {
} }
Style style = cellElement.getStyle(); Style style = cellElement.getStyle();
if (style == null) { if (style == null) {
style = style.DEFAULT_STYLE; style = Style.DEFAULT_STYLE;
} }
referencedStyle[i][j] = style; referencedStyle[i][j] = style;

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

@ -89,6 +89,7 @@ import com.fr.report.elementcase.TemplateElementCase;
import com.fr.report.poly.PolyWorkSheet; import com.fr.report.poly.PolyWorkSheet;
import com.fr.report.worksheet.WorkSheet; import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.AssistUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.module.Module; import com.fr.stable.module.Module;
@ -469,7 +470,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
double creatorWidth = blockCreator.getEditorBounds().width; double creatorWidth = blockCreator.getEditorBounds().width;
double areaHeight = polyDezi.polyArea.getHeight(); double areaHeight = polyDezi.polyArea.getHeight();
double areaWidth = polyDezi.polyArea.getWidth(); double areaWidth = polyDezi.polyArea.getWidth();
if (creatorWidth == 0 || creatorHeight == 0) { if(AssistUtils.equals(creatorWidth,0) || AssistUtils.equals(creatorHeight,0)){
return resolution; return resolution;
} }
double time = (areaHeight / creatorHeight) < (areaWidth / creatorWidth) ? (areaHeight / creatorHeight) : (areaWidth / creatorWidth); double time = (areaHeight / creatorHeight) < (areaWidth / creatorWidth) ? (areaHeight / creatorHeight) : (areaWidth / creatorWidth);
@ -486,7 +487,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
int row = reportPane.getSelection().getSelectedRows()[0]; int row = reportPane.getSelection().getSelectedRows()[0];
double rowLength = reportPane.getSelection().getSelectedRows().length; double rowLength = reportPane.getSelection().getSelectedRows().length;
double rowExtent = reportPane.getGrid().getVerticalExtent(); double rowExtent = reportPane.getGrid().getVerticalExtent();
if (columnLength == 0 || rowLength == 0) { if(AssistUtils.equals(columnLength,0) || AssistUtils.equals(rowLength,0)){
return resolution; return resolution;
} }
double time = (columnExtent / columnLength) < (rowExtent / rowLength) ? (columnExtent / columnLength) : (rowExtent / rowLength); double time = (columnExtent / columnLength) < (rowExtent / rowLength) ? (columnExtent / columnLength) : (rowExtent / rowLength);

3
designer-realize/src/main/java/com/fr/design/mainframe/SheetAuthorityEditPane.java

@ -13,6 +13,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
import com.fr.privilege.finegrain.WorkSheetPrivilegeControl; import com.fr.privilege.finegrain.WorkSheetPrivilegeControl;
import com.fr.report.worksheet.WorkSheet; import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -115,7 +116,7 @@ public class SheetAuthorityEditPane extends AuthorityEditPane {
populateName(); populateName();
populateType(); populateType();
checkPane.removeAll(); checkPane.removeAll();
if (name.getText() == "") { if (StringUtils.isEmpty(name.getText())){
return; return;
} }
checkPane.add(populateCheckPane(), BorderLayout.CENTER); checkPane.add(populateCheckPane(), BorderLayout.CENTER);

3
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java

@ -102,7 +102,8 @@ public class CellStylePane extends AbstractCellAttrPane {
} }
Style style = cellElement.getStyle(); Style style = cellElement.getStyle();
if (style == null) { if (style == null) {
style = style.DEFAULT_STYLE; style = Style.DEFAULT_STYLE;
} }
style = stylePane.updateStyle(style); style = stylePane.updateStyle(style);
cellElement.setStyle(style); cellElement.setStyle(style);

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

@ -19,6 +19,7 @@ import com.fr.grid.Grid;
import com.fr.grid.GridUtils; import com.fr.grid.GridUtils;
import com.fr.report.ReportHelper; import com.fr.report.ReportHelper;
import com.fr.report.worksheet.FormElementCase; import com.fr.report.worksheet.FormElementCase;
import com.fr.stable.AssistUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
@ -128,7 +129,7 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
int row = reportPane.getSelection().getSelectedRows()[0]; int row = reportPane.getSelection().getSelectedRows()[0];
double rowLength = reportPane.getSelection().getSelectedRows().length; double rowLength = reportPane.getSelection().getSelectedRows().length;
double rowExtent = reportPane.getGrid().getVerticalExtent(); double rowExtent = reportPane.getGrid().getVerticalExtent();
if (columnLength == 0 || rowLength == 0) { if (AssistUtils.equals(columnLength, 0d) || AssistUtils.equals(rowLength, 0d)) {
return ScreenResolution.getScreenResolution(); return ScreenResolution.getScreenResolution();
} }
double time = (columnExtent / columnLength) < (rowExtent / rowLength) ? (columnExtent / columnLength) : (rowExtent / rowLength); double time = (columnExtent / columnLength) < (rowExtent / rowLength) ? (columnExtent / columnLength) : (rowExtent / rowLength);

6
designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java

@ -112,14 +112,18 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
if (between(evt, tmpSize1, tmpSize2)) { if (between(evt, tmpSize1, tmpSize2)) {
if (index >= dragIndex) { if (index >= dragIndex) {
try { try {
if(method != null) {
method.invoke(report, dragIndex, FU.valueOfPix(evtOffset(evt, oldEndValueSize), resolution)); method.invoke(report, dragIndex, FU.valueOfPix(evtOffset(evt, oldEndValueSize), resolution));
}
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
//sizeList.set(dragIndex, FU.valueOfPix(evtOffset(evt, oldEndValueSize), resolution)); //sizeList.set(dragIndex, FU.valueOfPix(evtOffset(evt, oldEndValueSize), resolution));
} else { } else {
try { try {
if(method != null) {
method.invoke(report, index, FU.valueOfPix(evtOffset(evt, (int) tmpSize1), resolution)); method.invoke(report, index, FU.valueOfPix(evtOffset(evt, (int) tmpSize1), resolution));
}
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
@ -127,7 +131,9 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
// from all to do. // from all to do.
for (int h = (dragIndex - 1); h > index; h--) { for (int h = (dragIndex - 1); h > index; h--) {
try { try {
if(method != null) {
method.invoke(report, h, UNIT.ZERO); method.invoke(report, h, UNIT.ZERO);
}
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }

Loading…
Cancel
Save