Browse Source

REPORT-1178 英文国际化——20/23

master
plough 8 years ago
parent
commit
2f82bc4768
  1. 12
      designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  2. 33
      designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java

12
designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java

@ -3,7 +3,9 @@ package com.fr.design.mainframe.cell.settingpane;
import java.awt.*; import java.awt.*;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.Locale;
import com.fr.base.FRContext;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -123,8 +125,14 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
String[] AjustRowTypes = new String[]{ String[] AjustRowTypes = new String[]{
Inter.getLocText("No"), Inter.getLocText("Utils-Row_Height"), Inter.getLocText("Utils-Column_Width"), Inter.getLocText("Default")}; Inter.getLocText("No"), Inter.getLocText("Utils-Row_Height"), Inter.getLocText("Utils-Column_Width"), Inter.getLocText("Default")};
autoshrik = new UIButtonGroup(AjustRowTypes); autoshrik = new UIButtonGroup(AjustRowTypes);
autoshrik.setTwoLine(); if (FRContext.getLocale().equals(Locale.US)) {
autoshrik.setLayout(new GridLayout(2, 2, 1, 1)); // 英文显示不全,故每行一个按钮
autoshrik.setFourLine();
autoshrik.setLayout(new GridLayout(4, 1, 1, 1));
} else {
autoshrik.setTwoLine();
autoshrik.setLayout(new GridLayout(2, 2, 1, 1));
}
previewCellContent = new UICheckBox(Inter.getLocText("CellWrite-Preview_Cell_Content")); previewCellContent = new UICheckBox(Inter.getLocText("CellWrite-Preview_Cell_Content"));
printAndExportContent = new UICheckBox(Inter.getLocText("CellWrite-Print_Content")); printAndExportContent = new UICheckBox(Inter.getLocText("CellWrite-Print_Content"));

33
designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java

@ -28,6 +28,7 @@ import com.fr.design.utils.gui.GUICoreUtils;
public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver { public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
private boolean isTwoLine = false; private boolean isTwoLine = false;
private boolean isFourLine = false;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
protected List<UIToggleButton> labelButtonList; protected List<UIToggleButton> labelButtonList;
protected int selectedIndex = -1; protected int selectedIndex = -1;
@ -176,6 +177,10 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
this.isTwoLine = true; this.isTwoLine = true;
} }
public void setFourLine() {
this.isFourLine = true;
}
/** /**
* paintComponent * paintComponent
* *
@ -201,32 +206,40 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
} }
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
g2d.setColor(UIConstants.LINE_COLOR); g2d.setColor(UIConstants.LINE_COLOR);
if (!isTwoLine) { if (isTwoLine) {
int width = 0; int width = 0;
for (int i = 0; i < labelButtonList.size() - 1; i++) { int upCount = (labelButtonList.size() - 1) / 2 + 1;
for (int i = 0; i < upCount - 1; i++) {
width += labelButtonList.get(i).getWidth() + 1; width += labelButtonList.get(i).getWidth() + 1;
int height = labelButtonList.get(i).getHeight(); int height = labelButtonList.get(i).getHeight() * 2 + 1;
g.drawLine(width, 0, width, height); g.drawLine(width, 0, width, height);
} }
width += labelButtonList.get(labelButtonList.size() - 1).getWidth() + 1; width += labelButtonList.get(upCount).getWidth() + 1;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.drawRoundRect(0, 0, width, getHeight() - 1, UIConstants.ARC, UIConstants.ARC); g2d.drawRoundRect(0, 0, width, getHeight() - 1, UIConstants.ARC, UIConstants.ARC);
g2d.drawLine(0, getHeight() / 2, width, getHeight() / 2);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
} else if (isFourLine) {
// 4 * 1
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, UIConstants.ARC, UIConstants.ARC);
for (int i = 1; i <= 3; i++) {
g2d.drawLine(0, getHeight() / 4 * i, getWidth() - 1, getHeight() / 4 * i);
}
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
} else { } else {
int width = 0; int width = 0;
int upCount = (labelButtonList.size() - 1) / 2 + 1; for (int i = 0; i < labelButtonList.size() - 1; i++) {
for (int i = 0; i < upCount - 1; i++) {
width += labelButtonList.get(i).getWidth() + 1; width += labelButtonList.get(i).getWidth() + 1;
int height = labelButtonList.get(i).getHeight() * 2 + 1; int height = labelButtonList.get(i).getHeight();
g.drawLine(width, 0, width, height); g.drawLine(width, 0, width, height);
} }
width += labelButtonList.get(upCount).getWidth() + 1; width += labelButtonList.get(labelButtonList.size() - 1).getWidth() + 1;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.drawRoundRect(0, 0, width, getHeight() - 1, UIConstants.ARC, UIConstants.ARC); g2d.drawRoundRect(0, 0, width, getHeight() - 1, UIConstants.ARC, UIConstants.ARC);
g2d.drawLine(0, getHeight() / 2, width, getHeight() / 2);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
} }

Loading…
Cancel
Save