Browse Source

抽出static方便OEM

master
hugh 8 years ago
parent
commit
a098ae8d6c
  1. 22
      designer/src/com/fr/design/mainframe/SheetNameTabPane.java

22
designer/src/com/fr/design/mainframe/SheetNameTabPane.java

@ -273,7 +273,17 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
leftButton.setEnabled(buttonEnabled); leftButton.setEnabled(buttonEnabled);
rightButton.setEnabled(buttonEnabled); rightButton.setEnabled(buttonEnabled);
} }
/**
* 抽出来方便OEM
* @return
*/
public Icon getAddWorkSheet(){
return ADD_WORK_SHEET;
}
public Icon getWorkSheetIcon(){
return WORK_SHEET_ICON;
}
@Override @Override
/** /**
* 画Tab * 画Tab
@ -290,7 +300,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
double textHeight = this.getSize().getHeight() - 1; double textHeight = this.getSize().getHeight() - 1;
widthArray = calculateWidthArray(); widthArray = calculateWidthArray();
int operationWidth = GRAP + ADD_WORK_SHEET.getIconWidth() + ICON_SEP_DISTANCE + ADD_POLY_SHEET.getIconWidth(); int operationWidth = GRAP + getAddWorkSheet().getIconWidth() + ICON_SEP_DISTANCE + ADD_POLY_SHEET.getIconWidth();
double maxWidth = getWidth() - operationWidth - buttonPane.getWidth();// 最大宽度 double maxWidth = getWidth() - operationWidth - buttonPane.getWidth();// 最大宽度
paintBackgroundAndLine(g2d, textHeight, maxWidth, charWidth, textAscent); paintBackgroundAndLine(g2d, textHeight, maxWidth, charWidth, textAscent);
checkButton(showCount < widthArray.length); checkButton(showCount < widthArray.length);
@ -321,7 +331,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName(); String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName();
isNeedPaintedAuthority = templateReport.getWorkSheetPrivilegeControl().checkInvisible(selectedRoles); isNeedPaintedAuthority = templateReport.getWorkSheetPrivilegeControl().checkInvisible(selectedRoles);
} }
sheeticon = templateReport instanceof WorkSheet ? WORK_SHEET_ICON : POLY_SHEET_ICON; sheeticon = templateReport instanceof WorkSheet ? getWorkSheetIcon() : POLY_SHEET_ICON;
String sheetName = workBook.getReportName(i); String sheetName = workBook.getReportName(i);
if (i == selectedIndex) { if (i == selectedIndex) {
paintSelectedTab(g2d, sheeticon, textHeight, textX, sheetName, charWidth, textAscent, isNeedPaintedAuthority); paintSelectedTab(g2d, sheeticon, textHeight, textX, sheetName, charWidth, textAscent, isNeedPaintedAuthority);
@ -352,8 +362,8 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
} }
protected void paintAddButton(Graphics2D g2d){ protected void paintAddButton(Graphics2D g2d){
ADD_WORK_SHEET.paintIcon(this, g2d, iconLocation, 3); getAddWorkSheet().paintIcon(this, g2d, iconLocation, 3);
ADD_POLY_SHEET.paintIcon(this, g2d, iconLocation + ADD_WORK_SHEET.getIconWidth() + ICON_SEP_DISTANCE, 3); ADD_POLY_SHEET.paintIcon(this, g2d, iconLocation + getAddWorkSheet().getIconWidth() + ICON_SEP_DISTANCE, 3);
} }
/** /**
@ -757,7 +767,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
widthArray = calculateWidthArray(); widthArray = calculateWidthArray();
int width = widthArray[i]; int width = widthArray[i];
textX += width + 1; textX += width + 1;
int operationWidth = GRAP + ADD_WORK_SHEET.getIconWidth() + ICON_SEP_DISTANCE + ADD_POLY_SHEET.getIconWidth(); int operationWidth = GRAP + getAddWorkSheet().getIconWidth() + ICON_SEP_DISTANCE + ADD_POLY_SHEET.getIconWidth();
double maxWidth = getWidth() - operationWidth - buttonPane.getWidth();// 最大宽度 double maxWidth = getWidth() - operationWidth - buttonPane.getWidth();// 最大宽度
if (i < widthArray.length - 1 && textX + widthArray[i + 1] + 1 > maxWidth) { if (i < widthArray.length - 1 && textX + widthArray[i + 1] + 1 > maxWidth) {
isOvertakeWidth = true; isOvertakeWidth = true;

Loading…
Cancel
Save