Browse Source

Merge pull request #877 in DESIGN/design from ~HADES/design:release/10.0 to release/10.0

* commit 'c7453bffb5e15df6b8973c3e8cd8f4819825b128':
  REPORT-16858 【10.0.3回归】设计器宽度调整到屏幕一半后连续添加10个sheet,设计器最大化后未显示所有的sheet
bugfix/10.0
Hades 6 years ago
parent
commit
14f9a0c506
  1. 69
      designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java

69
designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java

@ -3,6 +3,8 @@ package com.fr.design.mainframe;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener; import java.awt.event.MouseMotionListener;
@ -24,6 +26,7 @@ import com.fr.base.GraphHelper;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.ibutton.UIButtonUI;
@ -35,12 +38,14 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
import com.fr.poly.PolyDesigner; import com.fr.poly.PolyDesigner;
import com.fr.report.poly.PolyWorkSheet; import com.fr.report.poly.PolyWorkSheet;
import com.fr.report.report.TemplateReport; import com.fr.report.report.TemplateReport;
import com.fr.report.worksheet.WorkSheet; import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import org.apache.tools.ant.taskdefs.Sleep;
/** /**
* NameTabPane of sheets * NameTabPane of sheets
@ -52,15 +57,15 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
private static final Color LINE_COLOR = new Color(0xababab); private static final Color LINE_COLOR = new Color(0xababab);
private static final Icon ADD_WORK_SHEET = BaseUtils.readIcon("com/fr/base/images/oem/addworksheet.png"); private static final Icon ADD_WORK_SHEET = IOUtils.readIcon("com/fr/base/images/oem/addworksheet.png");
protected static final Icon ADD_POLY_SHEET = BaseUtils.readIcon("com/fr/design/images/sheet/addpolysheet.png"); protected static final Icon ADD_POLY_SHEET = IOUtils.readIcon("com/fr/design/images/sheet/addpolysheet.png");
private static final Icon WORK_SHEET_ICON = BaseUtils.readIcon("com/fr/base/images/oem/worksheet.png"); private static final Icon WORK_SHEET_ICON = IOUtils.readIcon("com/fr/base/images/oem/worksheet.png");
private static final Icon POLY_SHEET_ICON = BaseUtils.readIcon("com/fr/design/images/sheet/polysheet.png"); private static final Icon POLY_SHEET_ICON = IOUtils.readIcon("com/fr/design/images/sheet/polysheet.png");
private static final Image DESIGN_IMAGE = BaseUtils.readImage("com/fr/design/images/sheet/left_right_btn.png"); private static final Icon LEFT_ICON = IOUtils.readIcon("com/fr/design/images/sheet/left_normal@1x.png");
private static final Icon LEFT_ICON = BaseUtils.readIcon("com/fr/design/images/sheet/left_normal@1x.png"); private static final Icon RIGHT_ICON = IOUtils.readIcon("com/fr/design/images/sheet/right_normal@1x.png");
private static final Icon RIGHT_ICON = BaseUtils.readIcon("com/fr/design/images/sheet/right_normal@1x.png"); private static final Icon DISABLED_LEFT_ICON = IOUtils.readIcon("com/fr/design/images/sheet/left_hover@1x.png");
private static final Icon DISABLED_LEFT_ICON = BaseUtils.readIcon("com/fr/design/images/sheet/left_hover@1x.png"); private static final Icon DISABLED_RIGHT_ICON = IOUtils.readIcon("com/fr/design/images/sheet/right_hover@1x.png");
private static final Icon DISABLED_RIGHT_ICON = BaseUtils.readIcon("com/fr/design/images/sheet/right_hover@1x.png"); private static final int NUM = 10;
private static final int ICON_SEP_DISTANCE = 8; private static final int ICON_SEP_DISTANCE = 8;
private static final int TOOLBAR_HEIGHT = 16; private static final int TOOLBAR_HEIGHT = 16;
@ -144,6 +149,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
this.setBorder(null); this.setBorder(null);
this.setForeground(new Color(99, 99, 99)); this.setForeground(new Color(99, 99, 99));
leftButton = new UIButton(LEFT_ICON) { leftButton = new UIButton(LEFT_ICON) {
@Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT); return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT);
} }
@ -163,6 +169,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
leftButton.set4ToolbarButton(); leftButton.set4ToolbarButton();
leftButton.setDisabledIcon(DISABLED_LEFT_ICON); leftButton.setDisabledIcon(DISABLED_LEFT_ICON);
rightButton = new UIButton(RIGHT_ICON) { rightButton = new UIButton(RIGHT_ICON) {
@Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT); return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT);
} }
@ -198,6 +205,13 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
} }
}); });
DesignerContext.getDesignerFrame().addComponentListener(new ComponentAdapter(){
@Override public void componentResized(ComponentEvent e) {
for (int i = 0; i < lastOneIndex * NUM; i++) {
moveLeft();
}
}
});
} }
private ActionListener createLeftButtonActionListener() { private ActionListener createLeftButtonActionListener() {
@ -205,6 +219,12 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
moveLeft();
}
};
}
private void moveLeft() {
int s = scrollIndex; int s = scrollIndex;
if (s == lastOneIndex && s != 0) { if (s == lastOneIndex && s != 0) {
scrollIndex--; scrollIndex--;
@ -223,8 +243,6 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
} }
} }
} }
};
}
/** /**
* 设置选择index * 设置选择index
@ -282,6 +300,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
* *
* @param e 鼠标事件 * @param e 鼠标事件
*/ */
@Override
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
if (isAuthorityEditing) { if (isAuthorityEditing) {
return; return;
@ -295,6 +314,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
* *
* @param e 鼠标事件 * @param e 鼠标事件
*/ */
@Override
public void mouseMoved(MouseEvent e) { public void mouseMoved(MouseEvent e) {
} }
@ -423,15 +443,6 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
} }
generalPath.closePath(); generalPath.closePath();
g2d.fill(generalPath); g2d.fill(generalPath);
// g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
// g2d.setPaint(UIConstants.LINE_COLOR);
// if (selectedIndex == scrollIndex) {
// g2d.draw(new Line2D.Double(x[0], y[0], x[1], y[1]));
// }
// g2d.draw(new Line2D.Double(x[1], y[1], x[2], y[2]));
// g2d.draw(new Line2D.Double(x[2], y[2], x[3], y[3]));
// g2d.draw(new Line2D.Double(x[3], y[3], x[4], y[4]));
// g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
sheeticon.paintIcon(this, g2d, (int) textX + charWidth, 2); sheeticon.paintIcon(this, g2d, (int) textX + charWidth, 2);
// peter:画字符 // peter:画字符
g2d.setPaint(getForeground()); g2d.setPaint(getForeground());
@ -470,13 +481,6 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
g2d.fill(generalPath); g2d.fill(generalPath);
g2d.setPaint(LINE_COLOR); g2d.setPaint(LINE_COLOR);
// if (i == scrollIndex) {
// g2d.draw(new Line2D.Double(x[0], y[0], x[1], y[1]));
// }
// g2d.draw(new Line2D.Double(x[1], y[1], x[2], y[2]));
// g2d.draw(new Line2D.Double(x[2], y[2], x[3], y[3]));
// g2d.draw(new Line2D.Double(x[3], y[3], x[4], y[4]));
// g2d.draw(new Line2D.Double(x[4], y[4], x[5], y[5]));
double startX = textX > 0 ? textX - 1 : textX; double startX = textX > 0 ? textX - 1 : textX;
g2d.drawRect((int)startX, 0, width, (int)textHeight); g2d.drawRect((int)startX, 0, width, (int)textHeight);
@ -560,6 +564,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
* *
* @param e 鼠标事件 * @param e 鼠标事件
*/ */
@Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
} }
@ -568,6 +573,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
* *
* @param evt 鼠标事件 * @param evt 鼠标事件
*/ */
@Override
public void mousePressed(MouseEvent evt) { public void mousePressed(MouseEvent evt) {
isReleased = false; isReleased = false;
int reportcount = reportComposite.getEditingWorkBook().getReportCount(); int reportcount = reportComposite.getEditingWorkBook().getReportCount();
@ -586,7 +592,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
boolean needRefreshPropertiesPane = getSelectedIndex() != i; boolean needRefreshPropertiesPane = getSelectedIndex() != i;
setSelectedIndex(i); setSelectedIndex(i);
if (needRefreshPropertiesPane) { if (needRefreshPropertiesPane) {
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane();
} }
isBlank = false; isBlank = false;
@ -644,6 +650,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
* *
* @param e 鼠标事件 * @param e 鼠标事件
*/ */
@Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
this.isReleased = true; this.isReleased = true;
this.setReleasedXY(e.getX(), e.getY()); this.setReleasedXY(e.getX(), e.getY());
@ -737,6 +744,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
* *
* @param e 鼠标事件 * @param e 鼠标事件
*/ */
@Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
} }
@ -745,6 +753,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
* *
* @param e 鼠标事件 * @param e 鼠标事件
*/ */
@Override
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
} }
@ -772,7 +781,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
protected abstract class SheetInsertAction extends UpdateAction { protected abstract class SheetInsertAction extends UpdateAction {
SheetInsertAction() { SheetInsertAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Insert") + getTemplateReportType()); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Insert") + getTemplateReportType());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/base/images/cell/control/add.png"));
} }
@Override @Override
@ -945,7 +954,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
private class CopySheetAction extends UpdateAction { private class CopySheetAction extends UpdateAction {
CopySheetAction() { CopySheetAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Copy")); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Copy"));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_edit/copy.png"));
} }
@Override @Override

Loading…
Cancel
Save