Browse Source

Merge branch 'release/10.0' of ssh://code.fineres.com:7999/~kerry/design_10.0 into release/11.0

# Conflicts:
#	designer-chart/src/main/java/com/fr/design/module/ChartPreStyleListPane.java
#	designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java
bugfix/11.0
kerry 3 years ago
parent
commit
732ce22493
  1. 6
      designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java
  2. 48
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java
  3. 55
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java
  4. 4
      designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java
  5. 23
      designer-base/src/main/java/com/fr/design/gui/ilist/JNameEdList.java
  6. 4
      designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java
  7. 47
      designer-chart/src/main/java/com/fr/design/module/ChartPreStyleListPane.java
  8. 3
      designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java
  9. 78
      designer-realize/src/main/java/com/fr/grid/GridUI.java

6
designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java

@ -28,7 +28,11 @@ public class TutorialAction extends AbstractDesignerSSO {
@Override @Override
public String getJumpUrl() { public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind(createDocKey()); return CloudCenter.getInstance().acquireUrlByKind(createDocKey(), "http://help.finereport.com");
}
public String getOffLineWarnMessage() {
return Toolkit.i18nText("Fine-Design_Offline_Helptutorial_Msg");
} }
// 生成帮助文档 sitecenter key, help.zh_CN.10 // 生成帮助文档 sitecenter key, help.zh_CN.10

48
designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java

@ -25,6 +25,7 @@ import com.fr.design.gui.icombobox.UIComboBoxEditor;
import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; 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;
@ -39,7 +40,16 @@ import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.connection.DBConnectAuth; import com.fr.workspace.server.connection.DBConnectAuth;
import javax.swing.*; import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.util.Collections;
import java.util.concurrent.CancellationException;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.SwingWorker;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuEvent;
@ -50,7 +60,6 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreeNode; import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.awt.*;
import java.awt.event.FocusAdapter; import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
@ -70,6 +79,9 @@ import java.util.concurrent.FutureTask;
* @since 2012-7-11下午4:49:39 * @since 2012-7-11下午4:49:39
*/ */
public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refreshable, Previewable, Prepare4DataSourceChange { public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refreshable, Previewable, Prepare4DataSourceChange {
private static final List<String> PENDING_CONTENT = new ArrayList<>(Collections.singletonList(Toolkit.i18nText("Fine-Design_Basic_Loading") + "..."));
private static final double COLUMN_SIZE = 24; private static final double COLUMN_SIZE = 24;
/** /**
@ -91,6 +103,8 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
private SwingWorker populateWorker; private SwingWorker populateWorker;
private SwingWorker<List<String>, Void> initWorker;
private PopupMenuListener popupMenuListener = new PopupMenuListener() { private PopupMenuListener popupMenuListener = new PopupMenuListener() {
@Override @Override
@ -213,10 +227,34 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected void initDsNameComboBox() { protected void initDsNameComboBox() {
if (initWorker != null && !initWorker.isDone()) {
initWorker.cancel(true);
}
dsNameComboBox.setRefreshingModel(true); dsNameComboBox.setRefreshingModel(true);
FilterableComboBoxModel dsNameComboBoxModel = new FilterableComboBoxModel(getHasAuthConnections()); dsNameComboBox.setModel(new FilterableComboBoxModel(PENDING_CONTENT));
dsNameComboBox.setModel(dsNameComboBoxModel); initWorker = new SwingWorker<List<String>, Void>() {
dsNameComboBox.setRefreshingModel(false);
@Override
protected List<String> doInBackground() throws Exception {
return getHasAuthConnections();
}
@Override
protected void done() {
try {
FilterableComboBoxModel dsNameComboBoxModel = new FilterableComboBoxModel(get());
String selected = dsNameComboBox.getSelectedItem();
dsNameComboBox.setModel(dsNameComboBoxModel);
dsNameComboBox.setSelectedItem(selected);
dsNameComboBox.setRefreshingModel(false);
} catch (Exception e) {
if (!(e instanceof CancellationException)) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
};
initWorker.execute();
} }
protected void initComponentsLayout(PreviewLabel previewLabel, int labelSize) { protected void initComponentsLayout(PreviewLabel previewLabel, int labelSize) {

55
designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java

@ -3,12 +3,19 @@ package com.fr.design.data.datapane.connect;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import javax.swing.*; import com.fr.log.FineLoggerFactory;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Dimension;
import java.util.Iterator;
import java.util.concurrent.CancellationException;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JPanel;
import javax.swing.SwingWorker;
public abstract class ItemEditableComboBoxPanel extends JPanel { public abstract class ItemEditableComboBoxPanel extends JPanel {
/** /**
@ -16,6 +23,8 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final String PENDING = Toolkit.i18nText("Fine-Design_Basic_Loading") + "...";
protected static final Object EMPTY = new Object() { protected static final Object EMPTY = new Object() {
public String toString() { public String toString() {
return ""; return "";
@ -26,6 +35,8 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
protected UIButton editButton; protected UIButton editButton;
protected UIButton refreshButton; protected UIButton refreshButton;
private SwingWorker<Iterator<String>, Void> refreshWorker;
public ItemEditableComboBoxPanel() { public ItemEditableComboBoxPanel() {
super(); super();
@ -75,26 +86,42 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
* 刷新itemComboBox的内容 * 刷新itemComboBox的内容
*/ */
protected void refreshItems() { protected void refreshItems() {
// 记录原来选中的Item,重新加载后需要再次选中
Object lastSelectedItem = itemComboBox.getSelectedItem(); if (refreshWorker != null && !refreshWorker.isDone()) {
refreshWorker.cancel(true);
}
DefaultComboBoxModel model = ((DefaultComboBoxModel) itemComboBox.getModel()); DefaultComboBoxModel model = ((DefaultComboBoxModel) itemComboBox.getModel());
model.removeAllElements(); model.removeAllElements();
// 先加EMPTY,再加items // 先加EMPTY,再加items
model.addElement(EMPTY); model.addElement(EMPTY);
model.addElement(PENDING);
java.util.Iterator<String> itemIt = items(); refreshWorker = new SwingWorker<Iterator<String>, Void>() {
while(itemIt.hasNext()) { @Override
model.addElement(itemIt.next()); protected Iterator<String> doInBackground() throws Exception {
} return items();
}
// 再次选中之前选中的Item @Override
int idx = model.getIndexOf(lastSelectedItem); protected void done() {
if(idx < 0) { try {
idx = 0; Iterator<String> itemIt = get();
} model.removeElement(PENDING);
itemComboBox.setSelectedIndex(idx); while(itemIt.hasNext()) {
model.addElement(itemIt.next());
}
itemComboBox.setMaximumRowCount(itemComboBox.getMaximumRowCount() + 1);
} catch (Exception e) {
if (!(e instanceof CancellationException)) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
};
refreshWorker.execute();
} }
/* /*

4
designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java

@ -23,12 +23,12 @@ import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import java.util.Collection;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.util.Collection;
public abstract class JListControlPane extends JControlPane implements ListControlPaneProvider { public abstract class JListControlPane extends JControlPane implements ListControlPaneProvider {
private static final String LIST_NAME = "JControl_List"; private static final String LIST_NAME = "JControl_List";
@ -335,7 +335,7 @@ public abstract class JListControlPane extends JControlPane implements ListContr
getHelper().checkButtonEnabled(); getHelper().checkButtonEnabled();
} }
private class NameableListCellRenderer extends protected class NameableListCellRenderer extends
DefaultListCellRenderer { DefaultListCellRenderer {
@Override @Override
public Component getListCellRendererComponent(JList list, Object value, public Component getListCellRendererComponent(JList list, Object value,

23
designer-base/src/main/java/com/fr/design/gui/ilist/JNameEdList.java

@ -1,25 +1,22 @@
package com.fr.design.gui.ilist; package com.fr.design.gui.ilist;
import com.fr.design.gui.NameInspector; import com.fr.design.gui.NameInspector;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.base.Utils;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
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.*; import javax.swing.ListModel;
import javax.swing.event.CellEditorListener; import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import java.awt.*;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Vector; import java.util.Vector;
import java.awt.Component;
import java.awt.Rectangle;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
public class JNameEdList extends UIList implements CellEditorListener { public class JNameEdList extends UIList implements CellEditorListener {
private static final int ICON_WIDTH = 20; private static final int ICON_WIDTH = 20;
@ -38,6 +35,8 @@ public class JNameEdList extends UIList implements CellEditorListener {
*/ */
private String oldName; private String oldName;
private boolean replaceEmptyName = true;
public JNameEdList(ListModel dataModel) { public JNameEdList(ListModel dataModel) {
super(dataModel); super(dataModel);
} }
@ -70,6 +69,10 @@ public class JNameEdList extends UIList implements CellEditorListener {
return this.editable; return this.editable;
} }
public void setReplaceEmptyName(boolean replaceEmptyName) {
this.replaceEmptyName = replaceEmptyName;
}
public void setNameShouldNumber(boolean isNameShouldNumber) { public void setNameShouldNumber(boolean isNameShouldNumber) {
this.isNameShouldNumber = isNameShouldNumber; this.isNameShouldNumber = isNameShouldNumber;
} }
@ -301,7 +304,7 @@ public class JNameEdList extends UIList implements CellEditorListener {
ListCellEditor editor = getCellEditor(); ListCellEditor editor = getCellEditor();
if (editor != null && editorComp != null) { if (editor != null && editorComp != null) {
Object value = editor.getCellEditorValue(); Object value = editor.getCellEditorValue();
String name = StringUtils.isBlank(value.toString()) ? oldName : value.toString(); String name = StringUtils.isBlank(value.toString()) && replaceEmptyName ? oldName : value.toString();
setNameAt(name, editingIndex); setNameAt(name, editingIndex);
removeComp(); removeComp();
doAfterStopEditing(); doAfterStopEditing();

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

@ -2,6 +2,7 @@ package com.fr.design.javascript;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.extension.FileExtension;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -417,6 +418,9 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
if (path == null) { if (path == null) {
throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function_The_Selected_File_Cannot_Be_Null")); throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function_The_Selected_File_Cannot_Be_Null"));
} }
if (path.endsWith(FileExtension.CPTX.getExtension())) {
throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Function_Cptx_Unsupported"));
}
} }
/** /**

47
designer-chart/src/main/java/com/fr/design/module/ChartPreStyleListPane.java

@ -4,16 +4,25 @@ import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig; import com.fr.base.ChartPreStyleConfig;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.ShortCut4JControlPane; import com.fr.design.gui.controlpane.ShortCut4JControlPane;
import com.fr.design.gui.ilist.JNameEdList;
import com.fr.design.i18n.Toolkit;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.stable.StringUtils;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
/** /**
* @author Bjorn * @author Bjorn
@ -22,6 +31,42 @@ import java.util.Iterator;
*/ */
public class ChartPreStyleListPane extends JListControlPane { public class ChartPreStyleListPane extends JListControlPane {
public ChartPreStyleListPane() {
super();
addModNameActionListener((int index, String oldName, String newName) -> {
if (ComparatorUtils.equals(oldName, newName)) {
return;
}
String[] allNames = nameableList.getAllNames();
allNames[index] = StringUtils.EMPTY;
if (StringUtils.isEmpty(newName)) {
showTipDialog(Toolkit.i18nText("Fine-Design_Chart_Fill_Style_Empty_Name_Tip"));
nameableList.setNameAt(oldName, index);
return;
}
if (isNameRepeated(new List[]{Arrays.asList(allNames)}, newName)) {
showTipDialog(Toolkit.i18nText("Fine-Design_Chart_Fill_Style_Exist_Name_Tip", newName));
nameableList.setNameAt(oldName, index);
return;
}
populateSelectedValue();
});
}
private void showTipDialog(String content) {
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ChartPreStyleListPane.this),
content,
Toolkit.i18nText("Fine-Design_Basic_Alert"),
JOptionPane.WARNING_MESSAGE);
}
@Override
protected JNameEdList createJNameList() {
JNameEdList jNameList = super.createJNameList();
jNameList.setReplaceEmptyName(false);
return jNameList;
}
/** /**
* 创建有名字的creator * 创建有名字的creator
* *
@ -102,4 +147,4 @@ public class ChartPreStyleListPane extends JListControlPane {
this.shortCut.setEnabled(nameableList.getModel().getSize() > 1); this.shortCut.setEnabled(nameableList.getModel().getSize() > 1);
} }
} }
} }

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

@ -151,8 +151,6 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
private ScrollAction PRESS_ACTION = new ScrollAction() { private ScrollAction PRESS_ACTION = new ScrollAction() {
@Override @Override
public boolean run(MouseEvent evt, int index, double tmpSize1, double tmpSize2, int tmpIncreaseSize, int oldEndValueSize, ElementCase report, DynamicUnitList sizeList) { public boolean run(MouseEvent evt, int index, double tmpSize1, double tmpSize2, int tmpIncreaseSize, int oldEndValueSize, ElementCase report, DynamicUnitList sizeList) {
// int resolution = ScreenResolution.getScreenResolution();
if (isOnSeparatorLineIncludeZero(evt, tmpSize2, tmpIncreaseSize) || isOnNormalSeparatorLine(evt, tmpSize2)) { if (isOnSeparatorLineIncludeZero(evt, tmpSize2, tmpIncreaseSize) || isOnNormalSeparatorLine(evt, tmpSize2)) {
dragType = GridUtils.DRAG_CELL_SIZE; dragType = GridUtils.DRAG_CELL_SIZE;
isDragPermited = true; isDragPermited = true;
@ -412,7 +410,6 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
iterateScrollBar(ePane, evt, DRAG_ACTION); iterateScrollBar(ePane, evt, DRAG_ACTION);
DynamicUnitList sizeList = getSizeList(report); DynamicUnitList sizeList = getSizeList(report);
// int resolution = ScreenResolution.getScreenResolution();
this.setToolTipText2(this.createToolTipString(sizeList.get(dragIndex), sizeList.getRangeValue(0, dragIndex + 1))); this.setToolTipText2(this.createToolTipString(sizeList.get(dragIndex), sizeList.getRangeValue(0, dragIndex + 1)));
} }

78
designer-realize/src/main/java/com/fr/grid/GridUI.java

@ -10,12 +10,15 @@ import com.fr.base.background.ColorBackground;
import com.fr.base.background.ImageFileBackground; import com.fr.base.background.ImageFileBackground;
import com.fr.base.iofile.attr.WatermarkAttr; import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignerEnvManager;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fun.ReportLengthUNITProvider;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.unit.UnitConvertUtil;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
@ -48,6 +51,7 @@ import com.fr.stable.Constants;
import com.fr.stable.script.CalculatorUtils; import com.fr.stable.script.CalculatorUtils;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import com.fr.stable.unit.UNIT;
import com.fr.third.antlr.ANTLRException; import com.fr.third.antlr.ANTLRException;
import com.fr.third.guava.collect.HashMultimap; import com.fr.third.guava.collect.HashMultimap;
@ -365,10 +369,10 @@ public class GridUI extends ComponentUI {
private class DrawVerticalLineHelper extends DrawLineHelper { private class DrawVerticalLineHelper extends DrawLineHelper {
DrawVerticalLineHelper(GridRange gridRange, boolean showGridLine, boolean discardExtraGridLine, DrawVerticalLineHelper(GridRange gridRange, boolean showGridLine, boolean showExtraGridLine,
boolean showPaginateLine, double paperPaintSize, boolean showPaginateLine, double paperPaintSize,
List paginateLineList, int resolution) { List paginateLineList, int resolution) {
super(gridRange, showGridLine, discardExtraGridLine, showPaginateLine, super(gridRange, showGridLine, showExtraGridLine, showPaginateLine,
paperPaintSize, paginateLineList, resolution); paperPaintSize, paginateLineList, resolution);
} }
@ -384,47 +388,47 @@ public class GridUI extends ComponentUI {
@Override @Override
protected void iterateStart2End(Graphics2D g2d) { protected void iterateStart2End(Graphics2D g2d) {
float rowHeight, paperYAxisSumSize = 0, maxXAxisSumSize = 0, yAxisSumSize = 0; UNIT rowHeight, paperYAxisSumSize = FU.getInstance(0), maxXAxisSumSize = FU.getInstance(0), yAxisSumSize = FU.getInstance(0);
for (int i = 0; i <= gridRange.yEndIndex; i++) { for (int i = 0; i <= gridRange.yEndIndex; i++) {
if (i == 0) { if (i == 0) {
i = gridRange.yBeginIndex; i = gridRange.yBeginIndex;
for (int k = 0; k < gridRange.yBeginIndex; k++) { for (int k = 0; k < gridRange.yBeginIndex; k++) {
rowHeight = gridRange.rowHeightList.get(k).toPixF(resolution); rowHeight = gridRange.rowHeightList.get(k);
paperYAxisSumSize = paperYAxisSumSize.add(rowHeight);
paperYAxisSumSize += rowHeight; if (paperYAxisSumSize.toPixF(resolution) >= paperPaintSize) {
if (paperYAxisSumSize >= paperPaintSize) {
paperYAxisSumSize = rowHeight; paperYAxisSumSize = rowHeight;
} }
} }
} }
rowHeight = gridRange.rowHeightList.get(i).toPixF(resolution);
paperYAxisSumSize += rowHeight; rowHeight = gridRange.rowHeightList.get(i);
paperYAxisSumSize = paperYAxisSumSize.add(rowHeight);
if (showGridLine) { if (showGridLine) {
float columnWidth, xAxisSumSize = 0; UNIT columnWidth, xAxisSumSize = FU.getInstance(0);
for (int j = gridRange.xBeginIndex; j <= gridRange.xEndIndex; j++) { for (int j = gridRange.xBeginIndex; j <= gridRange.xEndIndex; j++) {
columnWidth = gridRange.columnWidthList.get(j).toPixF(resolution); columnWidth = gridRange.columnWidthList.get(j);
if (!mergeCellElementTable.get(CellPosition.value(i - 1, j)).contains(CellPosition.BOTTOM)) { if (!mergeCellElementTable.get(CellPosition.value(i - 1, j)).contains(CellPosition.BOTTOM)) {
tmpLine2D.setLine(xAxisSumSize, yAxisSumSize, xAxisSumSize + columnWidth, yAxisSumSize); tmpLine2D.setLine(xAxisSumSize.toPixF(resolution), yAxisSumSize.toPixF(resolution), xAxisSumSize.add(columnWidth).toPixF(resolution), yAxisSumSize.toPixF(resolution));
g2d.draw(tmpLine2D); g2d.draw(tmpLine2D);
} }
xAxisSumSize += columnWidth; xAxisSumSize = xAxisSumSize.add(columnWidth);
} }
if (xAxisSumSize > maxXAxisSumSize) { if (xAxisSumSize.toPixF(resolution) > maxXAxisSumSize.toPixF(resolution)) {
maxXAxisSumSize = xAxisSumSize; maxXAxisSumSize = xAxisSumSize;
} }
} }
if (showPaginateLine && paperYAxisSumSize - paperPaintSize > THRESHOLD) { if (showPaginateLine && paperYAxisSumSize.toPixF(resolution) - paperPaintSize > THRESHOLD) {
paginateLineList.add(getPaginateLine2D((int) yAxisSumSize)); paginateLineList.add(getPaginateLine2D((int) yAxisSumSize.toPixF(resolution)));
paperYAxisSumSize = rowHeight; paperYAxisSumSize = rowHeight;
} }
yAxisSumSize += rowHeight; yAxisSumSize = yAxisSumSize.add(rowHeight);
} }
// paint 最后一个横线.. // paint 最后一个横线..
if (showGridLine) { if (showGridLine) {
if (showExtraGridLine) { if (showExtraGridLine) {
drawLastLine(g2d, (int) yAxisSumSize); drawLastLine(g2d, (int) yAxisSumSize.toPixF(resolution));
} else { } else {
GraphHelper.drawLine(g2d, 0, yAxisSumSize, maxXAxisSumSize, yAxisSumSize); GraphHelper.drawLine(g2d, 0, yAxisSumSize.toPixF(resolution), maxXAxisSumSize.toPixF(resolution), yAxisSumSize.toPixF(resolution));
} }
} }
} }
@ -432,10 +436,10 @@ public class GridUI extends ComponentUI {
private class DrawHorizontalLineHelper extends DrawLineHelper { private class DrawHorizontalLineHelper extends DrawLineHelper {
DrawHorizontalLineHelper(GridRange gridRange, boolean showGridLine, boolean discardExtraGridLine, DrawHorizontalLineHelper(GridRange gridRange, boolean showGridLine, boolean showExtraGridLine,
boolean showPaginateLine, double paperPaintSize, boolean showPaginateLine, double paperPaintSize,
List paginateLineList, int resolution) { List paginateLineList, int resolution) {
super(gridRange, showGridLine, discardExtraGridLine, showPaginateLine, super(gridRange, showGridLine, showExtraGridLine, showPaginateLine,
paperPaintSize, paginateLineList, resolution); paperPaintSize, paginateLineList, resolution);
} }
@ -451,46 +455,46 @@ public class GridUI extends ComponentUI {
@Override @Override
protected void iterateStart2End(Graphics2D g2d) { protected void iterateStart2End(Graphics2D g2d) {
float columnWidth, paperXAxisSumSize = 0, maxYAxisSumSize = 0, xAxisSumSize = 0; UNIT columnWidth, paperXAxisSumSize = FU.getInstance(0), maxYAxisSumSize = FU.getInstance(0), xAxisSumSize = FU.getInstance(0);
for (int i = 0; i <= gridRange.xEndIndex; i++) { for (int i = 0; i <= gridRange.xEndIndex; i++) {
if (i == 0) { if (i == 0) {
i = gridRange.xBeginIndex; i = gridRange.xBeginIndex;
for (int k = 0; k < gridRange.xBeginIndex; k++) { for (int k = 0; k < gridRange.xBeginIndex; k++) {
columnWidth = gridRange.columnWidthList.get(k).toPixF(resolution); columnWidth = gridRange.columnWidthList.get(k);
paperXAxisSumSize += columnWidth; paperXAxisSumSize = paperXAxisSumSize.add(columnWidth);
if (paperXAxisSumSize >= paperPaintSize) { if (paperXAxisSumSize.toPixF(resolution) >= paperPaintSize) {
paperXAxisSumSize = columnWidth; paperXAxisSumSize = columnWidth;
} }
} }
} }
columnWidth = gridRange.columnWidthList.get(i).toPixF(resolution); columnWidth = gridRange.columnWidthList.get(i);
paperXAxisSumSize += columnWidth; paperXAxisSumSize = paperXAxisSumSize.add(columnWidth);
if (showGridLine) { if (showGridLine) {
float rowHeight, yAxisSumSize = 0; UNIT rowHeight, yAxisSumSize = FU.getInstance(0);
for (int j = gridRange.yBeginIndex; j <= gridRange.yEndIndex; j++) { for (int j = gridRange.yBeginIndex; j <= gridRange.yEndIndex; j++) {
rowHeight = gridRange.rowHeightList.get(j).toPixF(resolution); rowHeight = gridRange.rowHeightList.get(j);
if (!mergeCellElementTable.get(CellPosition.value(j, i - 1)).contains(CellPosition.RIGHT)) { if (!mergeCellElementTable.get(CellPosition.value(j, i - 1)).contains(CellPosition.RIGHT)) {
tmpLine2D.setLine(xAxisSumSize, yAxisSumSize, xAxisSumSize, yAxisSumSize + rowHeight); tmpLine2D.setLine(xAxisSumSize.toPixF(resolution), yAxisSumSize.toPixF(resolution), xAxisSumSize.toPixF(resolution), yAxisSumSize.add(rowHeight).toPixF(resolution));
g2d.draw(tmpLine2D); g2d.draw(tmpLine2D);
} }
yAxisSumSize += rowHeight; yAxisSumSize = yAxisSumSize.add(rowHeight);
} }
if (yAxisSumSize > maxYAxisSumSize) { if (yAxisSumSize.toPixF(resolution) > maxYAxisSumSize.toPixF(resolution)) {
maxYAxisSumSize = yAxisSumSize; maxYAxisSumSize = yAxisSumSize;
} }
} }
if (showPaginateLine && paperXAxisSumSize - paperPaintSize > THRESHOLD) { if (showPaginateLine && paperXAxisSumSize.toPixF(resolution) - paperPaintSize > THRESHOLD) {
paginateLineList.add(getPaginateLine2D((int) xAxisSumSize)); paginateLineList.add(getPaginateLine2D((int) xAxisSumSize.toPixF(resolution)));
paperXAxisSumSize = columnWidth; paperXAxisSumSize = columnWidth;
} }
xAxisSumSize += columnWidth; xAxisSumSize = xAxisSumSize.add(columnWidth);
} }
// paint 最后一个横线.. // paint 最后一个横线..
if (showGridLine) { if (showGridLine) {
if (showExtraGridLine) { if (showExtraGridLine) {
drawLastLine(g2d, (int) xAxisSumSize); drawLastLine(g2d, (int) xAxisSumSize.toPixD(resolution));
} else { } else {
GraphHelper.drawLine(g2d, xAxisSumSize, 0, xAxisSumSize, maxYAxisSumSize); GraphHelper.drawLine(g2d, xAxisSumSize.toPixF(resolution), 0, xAxisSumSize.toPixF(resolution), maxYAxisSumSize.toPixF(resolution));
} }
} }
} }

Loading…
Cancel
Save