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. 105
      designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java

105
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.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
@ -24,6 +26,7 @@ import com.fr.base.GraphHelper;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.actions.UpdateAction;
import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ibutton.UIButton;
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.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.main.impl.WorkBook;
import com.fr.poly.PolyDesigner;
import com.fr.report.poly.PolyWorkSheet;
import com.fr.report.report.TemplateReport;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ProductConstants;
import org.apache.tools.ant.taskdefs.Sleep;
/**
* 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 Icon ADD_WORK_SHEET = BaseUtils.readIcon("com/fr/base/images/oem/addworksheet.png");
protected static final Icon ADD_POLY_SHEET = BaseUtils.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 POLY_SHEET_ICON = BaseUtils.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 = BaseUtils.readIcon("com/fr/design/images/sheet/left_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 = BaseUtils.readIcon("com/fr/design/images/sheet/left_hover@1x.png");
private static final Icon DISABLED_RIGHT_ICON = BaseUtils.readIcon("com/fr/design/images/sheet/right_hover@1x.png");
private static final Icon ADD_WORK_SHEET = IOUtils.readIcon("com/fr/base/images/oem/addworksheet.png");
protected static final Icon ADD_POLY_SHEET = IOUtils.readIcon("com/fr/design/images/sheet/addpolysheet.png");
private static final Icon WORK_SHEET_ICON = IOUtils.readIcon("com/fr/base/images/oem/worksheet.png");
private static final Icon POLY_SHEET_ICON = IOUtils.readIcon("com/fr/design/images/sheet/polysheet.png");
private static final Icon LEFT_ICON = IOUtils.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 DISABLED_LEFT_ICON = IOUtils.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 int NUM = 10;
private static final int ICON_SEP_DISTANCE = 8;
private static final int TOOLBAR_HEIGHT = 16;
@ -144,6 +149,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
this.setBorder(null);
this.setForeground(new Color(99, 99, 99));
leftButton = new UIButton(LEFT_ICON) {
@Override
public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT);
}
@ -163,6 +169,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
leftButton.set4ToolbarButton();
leftButton.setDisabledIcon(DISABLED_LEFT_ICON);
rightButton = new UIButton(RIGHT_ICON) {
@Override
public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT);
}
@ -197,7 +204,14 @@ 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() {
@ -205,27 +219,31 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
@Override
public void actionPerformed(ActionEvent e) {
int s = scrollIndex;
if (s == lastOneIndex && s != 0) {
scrollIndex--;
lastOneIndex--;
repaint();
} else {
while (s > lastOneIndex && showCount != 0) {
scrollIndex++;
lastOneIndex++;
repaint();
}
while (s < lastOneIndex && scrollIndex > 0) {
scrollIndex--;
lastOneIndex--;
repaint();
}
}
moveLeft();
}
};
}
private void moveLeft() {
int s = scrollIndex;
if (s == lastOneIndex && s != 0) {
scrollIndex--;
lastOneIndex--;
repaint();
} else {
while (s > lastOneIndex && showCount != 0) {
scrollIndex++;
lastOneIndex++;
repaint();
}
while (s < lastOneIndex && scrollIndex > 0) {
scrollIndex--;
lastOneIndex--;
repaint();
}
}
}
/**
* 设置选择index
*
@ -282,6 +300,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
*
* @param e 鼠标事件
*/
@Override
public void mouseDragged(MouseEvent e) {
if (isAuthorityEditing) {
return;
@ -295,6 +314,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
*
* @param e 鼠标事件
*/
@Override
public void mouseMoved(MouseEvent e) {
}
@ -423,15 +443,6 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
}
generalPath.closePath();
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);
// peter:画字符
g2d.setPaint(getForeground());
@ -470,13 +481,6 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
g2d.fill(generalPath);
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;
g2d.drawRect((int)startX, 0, width, (int)textHeight);
@ -560,6 +564,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
*
* @param e 鼠标事件
*/
@Override
public void mouseClicked(MouseEvent e) {
}
@ -568,6 +573,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
*
* @param evt 鼠标事件
*/
@Override
public void mousePressed(MouseEvent evt) {
isReleased = false;
int reportcount = reportComposite.getEditingWorkBook().getReportCount();
@ -586,7 +592,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
boolean needRefreshPropertiesPane = getSelectedIndex() != i;
setSelectedIndex(i);
if (needRefreshPropertiesPane) {
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane();
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane();
}
isBlank = false;
@ -629,11 +635,11 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
}
}
protected void addInsertGridShortCut(MenuDef def){
def.addShortCut(new GridReportInsertAction());
}
protected void firstInsertActionPerformed(){
new GridReportInsertAction().actionPerformed(null);
}
@ -644,6 +650,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
*
* @param e 鼠标事件
*/
@Override
public void mouseReleased(MouseEvent e) {
this.isReleased = true;
this.setReleasedXY(e.getX(), e.getY());
@ -737,6 +744,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
*
* @param e 鼠标事件
*/
@Override
public void mouseEntered(MouseEvent e) {
}
@ -745,6 +753,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
*
* @param e 鼠标事件
*/
@Override
public void mouseExited(MouseEvent e) {
}
@ -772,7 +781,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
protected abstract class SheetInsertAction extends UpdateAction {
SheetInsertAction() {
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
@ -945,7 +954,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
private class CopySheetAction extends UpdateAction {
CopySheetAction() {
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

Loading…
Cancel
Save