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. 95
      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. 24
      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. 6
      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. 6
      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. 12
      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[] y = {-1, getHeight(), getHeight(), -1, -1};
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.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[] y = {-1, getHeight() - 1, getHeight() - 1, -1, -1};
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 {
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. */
public static final double MINIMUM = -3.0;
public static final double EPSILON = 0.0000001;
//******************************************************************************
//** Constructors ***
@ -1808,8 +1807,8 @@ public class TableLayout implements LayoutManager2, Serializable {
for (counter = entry.cr1[z]; counter <= entry.cr2[z]; counter++)
if (crSpec[z][counter] >= 1.0)
scalableSize -= crSpec[z][counter];
else if (Math.abs(crSpec[z][counter] - PREFERRED) < EPSILON ||
Math.abs(crSpec[z][counter] - MINIMUM) < EPSILON) {
else if (AssistUtils.equals(crSpec[z][counter], PREFERRED) ||
AssistUtils.equals(crSpec[z][counter], MINIMUM)) {
scalableSize -= crPrefMin[counter];
}
@ -1825,13 +1824,13 @@ public class TableLayout implements LayoutManager2, Serializable {
// Add scaled size to relativeWidth
relativeSize += crSpec[z][counter];
// 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
relativeSize += fillSizeRatio;
}
// Determine the total scaled size as estimated by this component
if (Math.abs(relativeSize - 0) < EPSILON)
if (AssistUtils.equals(relativeSize, 0))
temp = 0;
else
temp = (int) (scalableSize / relativeSize + 0.5);
@ -1852,8 +1851,8 @@ public class TableLayout implements LayoutManager2, Serializable {
if (crSpec[z][counter] >= 1.0)
totalSize += (int) (crSpec[z][counter] + 0.5);
// Is the current cr a preferred/minimum size
else if (Math.abs(crSpec[z][counter] - PREFERRED) < EPSILON||
Math.abs(crSpec[z][counter] - MINIMUM) < EPSILON) {
else if (AssistUtils.equals(crSpec[z][counter], PREFERRED) ||
AssistUtils.equals(crSpec[z][counter], MINIMUM)) {
// Add preferred/minimum width
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.general.ComparatorUtils;
import com.fr.report.entity.VcsEntity;
import com.fr.stable.AssistUtils;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.vcs.VcsOperator;
@ -67,7 +68,7 @@ public class FileVersionCellEditor extends AbstractCellEditor implements TableCe
}
double height = editor.getPreferredSize().getHeight();
if (table.getRowHeight(row) != height) {
if (!AssistUtils.equals(table.getRowHeight(row), height)) {
table.setRowHeight(row, (int) height + VcsHelper.OFFSET);
}
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.report.entity.VcsEntity;
import com.fr.stable.AssistUtils;
import javax.swing.JPanel;
import javax.swing.JTable;
@ -34,7 +35,7 @@ public class FileVersionCellRender implements TableCellRenderer {
editor.setBackground(isSelected ? TABLE_SELECT_BACKGROUND : TREE_BACKGROUND);
double height = editor.getPreferredSize().getHeight();
if (table.getRowHeight(row) != height) {
if (!AssistUtils.equals(table.getRowHeight(row), height)) {
table.setRowHeight(row, (int) height + VcsHelper.OFFSET);
}
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.ColorSelectDialog;
import com.fr.design.style.color.ColorSelectable;
import com.fr.stable.AssistUtils;
/**
* TODO:面板缩放的功能没有考虑就是尾值过大导致超过界面显示的情况原来的那个实现完全是个BUG要缩放的情况也比较少就干脆以后弄吧
@ -217,7 +218,7 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
* @return 同上
*/
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.ColorSelectable;
import com.fr.general.FRFont;
import com.fr.stable.AssistUtils;
import com.fr.stable.Constants;
import com.fr.stable.OperatingSystem;
import com.fr.stable.StringUtils;
@ -890,10 +891,10 @@ public final class GUICoreUtils {
* @return 同上
*/
public static boolean isTheSameRect(Rectangle oneRect, Rectangle otherRect) {
return oneRect.getX() == otherRect.getX()
&& oneRect.getY() == otherRect.getY()
&& oneRect.getWidth() == otherRect.getWidth()
&& oneRect.getHeight() == otherRect.getHeight();
return AssistUtils.equals(oneRect.getX(), otherRect.getX())
&& AssistUtils.equals(oneRect.getY(), otherRect.getY())
&& AssistUtils.equals(oneRect.getWidth(), otherRect.getWidth())
&& AssistUtils.equals(oneRect.getHeight(), otherRect.getHeight());
}
/**

95
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.mainframe.widget.editors.WidgetValueEditor;
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.core.PropertyChangeAdapter;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import java.awt.Dimension;
import javax.swing.*;
import java.awt.*;
import java.beans.IntrospectionException;
/**
@ -21,72 +20,72 @@ import java.beans.IntrospectionException;
* @since 6.5.3
*/
public class XCheckBox extends XWidgetCreator {
public XCheckBox(CheckBox widget, Dimension initSize) {
super(widget, initSize);
}
@Override
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), new CRPropertyDescriptor[] {
new CRPropertyDescriptor("text", this.data.getClass()).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Text"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() {
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), new CRPropertyDescriptor[]{
new CRPropertyDescriptor("text", this.data.getClass()).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Text"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
((UICheckBox) editor).setText(((CheckBox) data).getText());
}
}),
new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Value")).setEditorClass(WidgetValueEditor.class)
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
((UICheckBox) editor).setText(((CheckBox) data).getText());
}
}),
new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Value")).setEditorClass(WidgetValueEditor.class)
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
WidgetValue value = ((CheckBox) data).getWidgetValue();
if (value != null && value.getValue() instanceof Boolean) {
((UICheckBox) editor).setSelected((Boolean) value.getValue());
}
}
}),
new CRPropertyDescriptor("fontSize", this.data.getClass(), "getFontSize", "setFontSize")
.setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Font_Size"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced")
});
}
@Override
public void propertyChange() {
ValueInitializer value = ((CheckBox) data).getWidgetValue();
if (value != null && value.getValue() instanceof Boolean) {
((UICheckBox) editor).setSelected((Boolean) value.getValue());
}
}
}),
new CRPropertyDescriptor("fontSize", this.data.getClass(), "getFontSize", "setFontSize")
.setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Font_Size"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced")
});
}
@Override
protected JComponent initEditor() {
if (editor == null) {
editor = new UICheckBox();
editor.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0));
editor.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0));
}
return editor;
}
@Override
protected void initXCreatorProperties() {
super.initXCreatorProperties();
UICheckBox jCheckBox = (UICheckBox) editor;
CheckBox check = (CheckBox) data;
jCheckBox.setText(check.getText());
if (check.getWidgetValue() != null && check.getWidgetValue().getValue() instanceof Boolean) {
jCheckBox.setSelected((Boolean) check.getWidgetValue().getValue());
}
}
super.initXCreatorProperties();
UICheckBox jCheckBox = (UICheckBox) editor;
CheckBox check = (CheckBox) data;
jCheckBox.setText(check.getText());
if (check.getWidgetValue() != null && check.getWidgetValue().getValue() instanceof Boolean) {
jCheckBox.setSelected((Boolean) check.getWidgetValue().getValue());
}
}
@Override
protected String getIconName() {
return "check_box_16.png";
}
public void firePropertyChange(){
((UICheckBox) editor).setText(((CheckBox) data).getText());
WidgetValue value = ((CheckBox) data).getWidgetValue();
if (value != null && value.getValue() instanceof Boolean) {
((UICheckBox) editor).setSelected((Boolean) value.getValue());
}
}
public void firePropertyChange() {
((UICheckBox) editor).setText(((CheckBox) data).getText());
ValueInitializer value = ((CheckBox) data).getWidgetValue();
if (value != null && value.getValue() instanceof Boolean) {
((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.form.ui.DateEditor;
import com.fr.form.ui.WidgetValue;
import com.fr.form.ui.concept.data.ValueInitializer;
import com.fr.general.DateUtils;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.JComponent;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.*;
import java.awt.*;
import java.beans.IntrospectionException;
import java.util.Date;
@ -84,7 +83,7 @@ public class XDateEditor extends XDirectWriteEditor {
private void initFieldText() {
DateEditor dateEditor = (DateEditor) data;
if (dateEditor.getWidgetValue() != null) {
WidgetValue widgetValue = dateEditor.getWidgetValue();
ValueInitializer widgetValue = dateEditor.getWidgetValue();
//控件值.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.EditorHolder;
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.GeneralContext;
import com.fr.plugin.context.PluginContext;
@ -77,7 +77,7 @@ public class ToolTipEditor extends JWindow {
createWidget.setWidgetName(widget.getWidgetName());
createWidget.setEnabled(widget.isEnabled());
createWidget.setVisible(widget.isVisible());
WidgetValue.convertWidgetValue((DataControl) createWidget, widget.getWidgetValue().getValue());
WidgetValueUtils.convertWidgetValue((DataControl) createWidget, widget.getWidgetValue().getValue());
XCreator creator = null;
creator = parent.replace(createWidget, holder);
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.ui.container.WBorderLayout;
import com.fr.general.FRScreen;
import com.fr.stable.AssistUtils;
import javax.swing.JComponent;
@ -226,7 +227,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
// slidePane.populateBean(screenValue);
if (root.acceptType(XWFitLayout.class)) {
XWFitLayout layout = (XWFitLayout) root;
if (screenValue != DEFAULT_SLIDER) {
if ( !AssistUtils.equals(screenValue, DEFAULT_SLIDER) ) {
reCalculateRoot(screenValue, true);
} else {
// 组件间隔啊
@ -354,7 +355,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
// double value = slidePane.updateBean();
//重置滑块的值为默认值100
START_VALUE = DEFAULT_SLIDER;
if (screenValue == DEFAULT_SLIDER) {
if ( AssistUtils.equals(screenValue, DEFAULT_SLIDER) ) {
layout.getParent().setSize(width, height + designer.getParaHeight());
FormArea.this.validate();
} else {
@ -370,7 +371,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
* @param value
*/
private void reCalculateRoot(double value, boolean needCalculateParaHeight) {
if (value == START_VALUE) {
if ( AssistUtils.equals(value, START_VALUE) ) {
return;
}
double percent = (value - START_VALUE) / START_VALUE;
@ -734,15 +735,15 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
this.horicalMax = (int) totalSize.getHeight();
// 撤销时会refreshRoot,导致layout大小变为默认大小
// 按照之前设置的宽高和百分比重置下容器size
if (width != widthPane.getValue()) {
if ( !AssistUtils.equals(width, widthPane.getValue()) ) {
widthPane.setValue(width);
reCalculateWidth((int) width);
}
if (height != heightPane.getValue()) {
if ( !AssistUtils.equals(height, heightPane.getValue()) ) {
heightPane.setValue(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();
// 撤销时先refreshRoot了,此处去掉内边距再增加间隔
layout.moveContainerMargin();
@ -817,6 +818,9 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
Rectangle rec = new Rectangle(left + (right - DESIGNERWIDTH) / 2, TOPGAP, right, bottom);
//是否为表单
if (isValid) {
if (hbarPreferredSize == null) {
throw new IllegalArgumentException("hbarPreferredSize can not be null!");
}
int maxHeight = bottom - hbarPreferredSize.height - resize.height - TOPGAP * 2;
int maxWidth = right - vbarPreferredSize.width;
DESIGNERWIDTH = DESIGNERWIDTH > maxWidth ? maxWidth : DESIGNERWIDTH;

24
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.Widget;
import com.fr.form.ui.WidgetValue;
import com.fr.form.ui.concept.data.ValueInitializer;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import java.awt.Point;
import java.awt.*;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
@ -31,7 +32,8 @@ public class FormDesignerDropTarget extends DropTargetAdapter {
/**
* 响应拖拽进入事件
* @param dtde 需要被处理的拖拽事件
*
* @param dtde 需要被处理的拖拽事件
*/
public void dragEnter(DropTargetDragEvent dtde) {
dtde.acceptDrag(dtde.getDropAction());
@ -39,6 +41,7 @@ public class FormDesignerDropTarget extends DropTargetAdapter {
/**
* 处理拖拽经过事件
*
* @param dtde 需要被处理的拖拽事件
*/
public void dragOver(DropTargetDragEvent dtde) {
@ -52,7 +55,8 @@ public class FormDesignerDropTarget extends DropTargetAdapter {
/**
* 处理拖拽释放事件
* @param dtde 需要被处理的拖拽事件
*
* @param dtde 需要被处理的拖拽事件
*/
public void drop(DropTargetDropEvent dtde) {
Transferable tr = dtde.getTransferable();
@ -75,22 +79,16 @@ public class FormDesignerDropTarget extends DropTargetAdapter {
if (!(widget instanceof DataControl)) {
return;
}
WidgetValue oldvalue = ((DataControl) widget).getWidgetValue();
WidgetValue newValue = new WidgetValue(new DataBinding((String[][]) o));
if (!ComparatorUtils.equals(oldvalue, newValue)) {
ValueInitializer oldValue = ((DataControl) widget).getWidgetValue();
ValueInitializer newValue = new WidgetValue(new DataBinding((String[][]) o));
if (!ComparatorUtils.equals(oldValue, newValue)) {
((DataControl) widget).setWidgetValue(newValue);
designer.fireTargetModified();
}
creator.rebuid();
designer.getSelectionModel().setSelectedCreator(creator);
} catch (UnsupportedFlavorException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} catch (IOException e) {
} catch (UnsupportedFlavorException | 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;
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.mainframe.widget.editors.DataBindingEditor;
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.form.ui.DataControl;
import com.fr.form.ui.WidgetValue;
import com.fr.form.ui.concept.data.ValueInitializer;
import com.fr.general.ComparatorUtils;
import javax.swing.*;
import java.awt.*;
@ -112,7 +116,7 @@ public class FormWidgetValuePane extends JPanel {
}
public void populate(DataControl ob) {
WidgetValue widgetValue = ob.getWidgetValue();
ValueInitializer widgetValue = ob.getWidgetValue();
if (widgetValue != null) {
for (int i = 0; i < editor.length; i++) {
if (editor[i].accept(widgetValue.getValue())) {

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

@ -110,8 +110,10 @@ 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")});
}
for (int i = 0; i < 3; i++) {
group.getButton(i).setRoundBorder(true, UIConstants.ARC);
group.getButton(i).setBorderPainted(true);
if (group != null) {
group.getButton(i).setRoundBorder(true, UIConstants.ARC);
group.getButton(i).setBorderPainted(true);
}
}
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.general.ComparatorUtils;
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()) {
style = StyleUtils.setReportFontSize(style, defStyle.getFRFont().getSize());
}
if (selectedFontSize == style.getFRFont().getSize()) {
if (AssistUtils.equals(selectedFontSize, style.getFRFont().getSize())){
return style;
}
style = StyleUtils.setReportFontSize(style, selectedFontSize);

6
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));
String sortFormula = dSColumn.getSortFormula();
if (sortFormula != null && sortFormula.length() >= 1) {
sortFormulaTextField.setText(sortFormula);
} else {
sortFormulaTextField.setText(sortFormula);
}
sortFormulaTextField.setText(sortFormula);
}
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();
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);
}

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

@ -140,10 +140,11 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
@Override
public void populateBean(Listener listener) {
this.listener = listener;
if (this.listener == null) {
if (listener == null){
this.listener = new Listener();
return;
}
this.listener = listener;
this.nameText.setText(listener.getEventName());
JavaScript js = listener.getAction();
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.webattr.ToolBarButton;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
@ -204,7 +205,7 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane {
public void populateType() {
if (name.getText() == "") {
if (StringUtils.isEmpty(name.getText())) {
type.setText("");
} else {
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();
}
}
if (names != "") {
if (StringUtils.isNotEmpty(names)) {
names = names.substring(1);
}
name.setText(names);
@ -226,7 +227,7 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane {
public void populateCheckPane() {
checkPane.removeAll();
if (name.getText() == "") {
if (StringUtils.isEmpty(name.getText())) {
return;
}
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();
if (style == null) {
style = style.DEFAULT_STYLE;
style = Style.DEFAULT_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.worksheet.WorkSheet;
import com.fr.stable.ArrayUtils;
import com.fr.stable.AssistUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.module.Module;
@ -469,7 +470,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
double creatorWidth = blockCreator.getEditorBounds().width;
double areaHeight = polyDezi.polyArea.getHeight();
double areaWidth = polyDezi.polyArea.getWidth();
if (creatorWidth == 0 || creatorHeight == 0) {
if(AssistUtils.equals(creatorWidth,0) || AssistUtils.equals(creatorHeight,0)){
return resolution;
}
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];
double rowLength = reportPane.getSelection().getSelectedRows().length;
double rowExtent = reportPane.getGrid().getVerticalExtent();
if (columnLength == 0 || rowLength == 0) {
if(AssistUtils.equals(columnLength,0) || AssistUtils.equals(rowLength,0)){
return resolution;
}
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.privilege.finegrain.WorkSheetPrivilegeControl;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
@ -115,7 +116,7 @@ public class SheetAuthorityEditPane extends AuthorityEditPane {
populateName();
populateType();
checkPane.removeAll();
if (name.getText() == "") {
if (StringUtils.isEmpty(name.getText())){
return;
}
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();
if (style == null) {
style = style.DEFAULT_STYLE;
style = Style.DEFAULT_STYLE;
}
style = stylePane.updateStyle(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.report.ReportHelper;
import com.fr.report.worksheet.FormElementCase;
import com.fr.stable.AssistUtils;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
@ -128,7 +129,7 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
int row = reportPane.getSelection().getSelectedRows()[0];
double rowLength = reportPane.getSelection().getSelectedRows().length;
double rowExtent = reportPane.getGrid().getVerticalExtent();
if (columnLength == 0 || rowLength == 0) {
if (AssistUtils.equals(columnLength, 0d) || AssistUtils.equals(rowLength, 0d)) {
return ScreenResolution.getScreenResolution();
}
double time = (columnExtent / columnLength) < (rowExtent / rowLength) ? (columnExtent / columnLength) : (rowExtent / rowLength);

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

Loading…
Cancel
Save