Browse Source

Merge remote-tracking branch 'mm/9.0' into 9.0

master
plough 7 years ago
parent
commit
cad0a13b56
  1. 6
      designer/src/com/fr/design/expand/ExpandFatherPane.java
  2. 35
      designer/src/com/fr/design/mainframe/ReportComponentComposite.java
  3. 44
      designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java
  4. 2
      designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  5. 2
      designer/src/com/fr/design/mainframe/cell/settingpane/CellPresentPane.java
  6. 18
      designer/src/com/fr/design/mainframe/cell/settingpane/CellStylePane.java
  7. 3
      designer/src/com/fr/grid/GridRow.java
  8. 44
      designer_base/src/com/fr/design/gui/style/BorderPane.java
  9. 64
      designer_base/src/com/fr/design/gui/style/FRFontPane.java
  10. 15
      designer_base/src/com/fr/design/gui/style/FormatPane.java
  11. 22
      designer_base/src/com/fr/design/locale/designer.properties
  12. 22
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  13. 24
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  14. 23
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  15. 22
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  16. 21
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  17. 280
      designer_base/src/com/fr/design/mainframe/JSliderPane.java
  18. 1122
      designer_form/src/com/fr/design/mainframe/FormArea.java

6
designer/src/com/fr/design/expand/ExpandFatherPane.java

@ -40,9 +40,9 @@ public abstract class ExpandFatherPane extends JPanel implements GlobalNameObser
public ExpandFatherPane() { public ExpandFatherPane() {
this.setLayout(new BorderLayout(0, LayoutConstants.VGAP_SMALL)); this.setLayout(new BorderLayout(0, LayoutConstants.VGAP_SMALL));
comboBox = new UIComboBox(new String[]{ comboBox = new UIComboBox(new String[]{
Inter.getLocText("None"), Inter.getLocText("FR-Designer_None"),
Inter.getLocText("Default"), Inter.getLocText("FR-Designer_DEFAULT"),
Inter.getLocText("Custom")}); Inter.getLocText("FR-Designer_Custom")});
final CardLayout cardLayout = new CardLayout(); final CardLayout cardLayout = new CardLayout();
customPane = new JPanel(cardLayout); customPane = new JPanel(cardLayout);
customParentColumnRowPane = new ColumnRowPane() { customParentColumnRowPane = new ColumnRowPane() {

35
designer/src/com/fr/design/mainframe/ReportComponentComposite.java

@ -6,10 +6,14 @@ import java.util.ArrayList;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JSplitPane; import javax.swing.JSplitPane;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.ScreenResolution;
import com.fr.design.designer.EditingState; import com.fr.design.designer.EditingState;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.icontainer.UIModeControlContainer; import com.fr.design.gui.icontainer.UIModeControlContainer;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -24,6 +28,10 @@ import com.fr.report.report.TemplateReport;
* @since 2012-3-27下午12:12:05 * @since 2012-3-27下午12:12:05
*/ */
public class ReportComponentComposite extends JComponent { public class ReportComponentComposite extends JComponent {
private static final int MAX = 400;
private static final int HUND = 100;
private static final int MIN = 10;
private JWorkBook parent; private JWorkBook parent;
private UIModeControlContainer parentContainer = null; private UIModeControlContainer parentContainer = null;
@ -36,7 +44,7 @@ public class ReportComponentComposite extends JComponent {
private JPanel hbarContainer; private JPanel hbarContainer;
private JPanel jSliderContainer; private JSliderPane jSliderContainer;
/** /**
@ -52,8 +60,28 @@ public class ReportComponentComposite extends JComponent {
CellElementRegion = FRGUIPaneFactory.createBorderLayout_S_Pane(); CellElementRegion = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.add(CellElementRegion, BorderLayout.NORTH); this.add(CellElementRegion, BorderLayout.NORTH);
this.add(createSouthControlPane(), BorderLayout.SOUTH); this.add(createSouthControlPane(), BorderLayout.SOUTH);
jSliderContainer.getShowVal().getDocument().addDocumentListener(jSliderContainerListener);
} }
DocumentListener jSliderContainerListener = new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
double value = Integer.parseInt(jSliderContainer.getShowVal().getText().substring(0, jSliderContainer.getShowVal().getText().indexOf("%")));
value = value>MAX ? MAX : value;
value = value<MIN ? MIN : value;
int resolution = (int) (ScreenResolution.getScreenResolution()*value/HUND);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution);
}
@Override
public void removeUpdate(DocumentEvent e) {
}
@Override
public void changedUpdate(DocumentEvent e) {
}
};
protected void doBeforeChange(int oldIndex) { protected void doBeforeChange(int oldIndex) {
if (oldIndex >= 0) { if (oldIndex >= 0) {
templateStateList.set(oldIndex, centerCardPane.editingComponet.createEditingState()); templateStateList.set(oldIndex, centerCardPane.editingComponet.createEditingState());
@ -63,7 +91,7 @@ public class ReportComponentComposite extends JComponent {
protected void doAfterChange(int newIndex) { protected void doAfterChange(int newIndex) {
WorkBook workbook = getEditingWorkBook(); WorkBook workbook = getEditingWorkBook();
if (workbook == null) { if (workbook == null) {
FRContext.getLogger().error(Inter.getLocText("Read_failure") + "!"); FRContext.getLogger().error(Inter.getLocText("FR-Designer_Read_failure") + "!");
//AUGUST:加个报错,不然测试总是SB的认为打不开一个坏的excel文件就是BUG,也不知道去检查下源文件。 //AUGUST:加个报错,不然测试总是SB的认为打不开一个坏的excel文件就是BUG,也不知道去检查下源文件。
return; return;
} }
@ -160,7 +188,8 @@ public class ReportComponentComposite extends JComponent {
hbarContainer.add(centerCardPane.editingComponet.getHorizontalScrollBar()); hbarContainer.add(centerCardPane.editingComponet.getHorizontalScrollBar());
// JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, hbarContainer); // JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, hbarContainer);
JPanel southPane = new JPanel(new BorderLayout()); JPanel southPane = new JPanel(new BorderLayout());
JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, JSliderPane.getInstance()); jSliderContainer = JSliderPane.getInstance();
JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, jSliderContainer);
splitpane.setBorder(null); splitpane.setBorder(null);
splitpane.setDividerSize(3); splitpane.setDividerSize(3);
splitpane.setResizeWeight(1); splitpane.setResizeWeight(1);

44
designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java

@ -62,22 +62,22 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
public static void main(String[] args){ public static void main(String[] args){
JFrame jf = new JFrame("test"); // JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane(); // JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout()); // content.setLayout(new BorderLayout());
content.add(new CellExpandAttrPane().layoutPane(), BorderLayout.CENTER); // content.add(new CellExpandAttrPane().layoutPane(), BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf); // GUICoreUtils.centerWindow(jf);
jf.setSize(290, 400); // jf.setSize(290, 400);
jf.setVisible(true); // jf.setVisible(true);
} }
private void initAllNames() { private void initAllNames() {
expandDirectionButton.setGlobalName(Inter.getLocText("ExpandD-Expand_Direction")); expandDirectionButton.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expand_Direction"));
leftFatherPane.setGlobalName(Inter.getLocText("LeftParent")); leftFatherPane.setGlobalName(Inter.getLocText("FR-Designer_LeftParent"));
rightFatherPane.setGlobalName(Inter.getLocText("ExpandD-Up_Father_Cell")); rightFatherPane.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"));
horizontalExpandableCheckBox.setGlobalName(Inter.getLocText("ExpandD-Expandable")); horizontalExpandableCheckBox.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expandable"));
verticalExpandableCheckBox.setGlobalName(Inter.getLocText("ExpandD-Expandable")); verticalExpandableCheckBox.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expandable"));
} }
private JPanel layoutPane() { private JPanel layoutPane() {
@ -111,9 +111,9 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,null}, new Component[]{null,null},
new Component[]{new UILabel(" "+Inter.getLocText("ExpandD-Expand_Direction")+" ", SwingConstants.LEFT), expandDirectionButton}, new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_ExpandD_Expand_Direction")+" ", SwingConstants.LEFT), expandDirectionButton},
new Component[]{new UILabel(" "+Inter.getLocText("LeftParent"), SwingConstants.LEFT), leftFatherPane}, new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_LeftParent"), SwingConstants.LEFT), leftFatherPane},
new Component[]{new UILabel(" "+Inter.getLocText("ExpandD-Up_Father_Cell"), SwingConstants.LEFT), rightFatherPane}, new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"), SwingConstants.LEFT), rightFatherPane},
}; };
double[] rowSize = {p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p};
double[] columnSize = {p, f}; double[] columnSize = {p, f};
@ -128,7 +128,7 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
new Component[]{null,null}, new Component[]{null,null},
new Component[]{horizontalExpandableCheckBox, null}, new Component[]{horizontalExpandableCheckBox, null},
new Component[]{verticalExpandableCheckBox, null}, new Component[]{verticalExpandableCheckBox, null},
new Component[]{new UILabel(" "+Inter.getLocText("ExpandD-Sort_After_Expand") + Inter.getLocText("FR-Action_Sort"), SwingConstants.RIGHT), sortAfterExpand}, new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_ExpendSort"), SwingConstants.RIGHT), sortAfterExpand},
}; };
double[] rowSize = {p, p, p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p, p, p};
double[] columnSize = {p, f}; double[] columnSize = {p, f};
@ -176,7 +176,7 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
@Override @Override
public String getIconPath() { public String getIconPath() {
// return "com/fr/design/images/expand/cellAttr.gif"; // return "com/fr/design/images/expand/cellAttr.gif";
return Inter.getLocText("Expand"); return Inter.getLocText("FR-Designer_Expand");
} }
@ -187,19 +187,19 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
cellExpandAttr = new CellExpandAttr(); cellExpandAttr = new CellExpandAttr();
cellElement.setCellExpandAttr(cellExpandAttr); cellElement.setCellExpandAttr(cellExpandAttr);
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("ExpandD-Expand_Direction"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD_Expand_Direction"))) {
cellExpandAttr.setDirection(expandDirectionButton.getSelectedItem()); cellExpandAttr.setDirection(expandDirectionButton.getSelectedItem());
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("LeftParent"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_LeftParent"))) {
this.leftFatherPane.update(cellExpandAttr); this.leftFatherPane.update(cellExpandAttr);
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("ExpandD-Up_Father_Cell"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"))) {
this.rightFatherPane.update(cellExpandAttr); this.rightFatherPane.update(cellExpandAttr);
} }
// extendable // extendable
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("ExpandD-Expandable"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD-Expandable"))) {
if (horizontalExpandableCheckBox.isSelected()) { if (horizontalExpandableCheckBox.isSelected()) {
if (verticalExpandableCheckBox.isSelected()) { if (verticalExpandableCheckBox.isSelected()) {
cellExpandAttr.setExtendable(CellExpandAttr.Both_EXTENDABLE); cellExpandAttr.setExtendable(CellExpandAttr.Both_EXTENDABLE);

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

@ -215,7 +215,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
@Override @Override
public String getIconPath() { public String getIconPath() {
// return "com/fr/design/images/m_format/cellstyle/otherset.png"; // return "com/fr/design/images/m_format/cellstyle/otherset.png";
return Inter.getLocText("Other"); return Inter.getLocText("FR-Designer_Other");
} }
@Override @Override

2
designer/src/com/fr/design/mainframe/cell/settingpane/CellPresentPane.java

@ -40,7 +40,7 @@ public class CellPresentPane extends AbstractCellAttrPane {
@Override @Override
public String getIconPath() { public String getIconPath() {
// return "com/fr/design/images/data/source/dataDictionary.png"; // return "com/fr/design/images/data/source/dataDictionary.png";
return Inter.getLocText("Present"); return Inter.getLocText("FR-Designer_Present");
} }
@Override @Override

18
designer/src/com/fr/design/mainframe/cell/settingpane/CellStylePane.java

@ -42,14 +42,14 @@ public class CellStylePane extends AbstractCellAttrPane {
} }
public static void main(String[] args){ public static void main(String[] args){
JFrame jf = new JFrame("test"); // JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane(); // JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout()); // content.setLayout(new BorderLayout());
content.add(new CellStylePane().createContentPane(), BorderLayout.CENTER); // content.add(new CellStylePane().createContentPane(), BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf); // GUICoreUtils.centerWindow(jf);
jf.setSize(290, 400); // jf.setSize(290, 400);
jf.setVisible(true); // jf.setVisible(true);
} }
@Override @Override
@ -120,7 +120,7 @@ public class CellStylePane extends AbstractCellAttrPane {
@Override @Override
public String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText("Style"); return Inter.getLocText(Inter.getLocText("FR-Designer_Style"));
} }
public void setSelectedByIds(int level, String... id) { public void setSelectedByIds(int level, String... id) {

3
designer/src/com/fr/grid/GridRow.java

@ -21,6 +21,7 @@ import javax.swing.plaf.ComponentUI;
*/ */
public class GridRow extends GridHeader<Integer> { public class GridRow extends GridHeader<Integer> {
private static final int MAX = 5;
private int resolution = ScreenResolution.getScreenResolution(); private int resolution = ScreenResolution.getScreenResolution();
@Override @Override
@ -65,7 +66,7 @@ public class GridRow extends GridHeader<Integer> {
* Calculates max char number. * Calculates max char number.
*/ */
private int caculateMaxCharNumber(ElementCasePane reportPane) { private int caculateMaxCharNumber(ElementCasePane reportPane) {
int maxCharNumber = 5; int maxCharNumber = MAX;
maxCharNumber = Math.max(maxCharNumber, ("" + (reportPane.getGrid().getVerticalValue() + reportPane.getGrid().getVerticalExtent())).length() + 1); maxCharNumber = Math.max(maxCharNumber, ("" + (reportPane.getGrid().getVerticalValue() + reportPane.getGrid().getVerticalExtent())).length() + 1);
return maxCharNumber; return maxCharNumber;

44
designer_base/src/com/fr/design/gui/style/BorderPane.java

@ -87,10 +87,10 @@ public class BorderPane extends AbstractBasicStylePane {
new Component[]{null,null}, new Component[]{null,null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Color") + " ", SwingConstants.LEFT), currentLineColorPane}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_Color") + " ", SwingConstants.LEFT), currentLineColorPane},
new Component[]{null,null}, new Component[]{null,null},
new Component[]{new UILabel("外边框 ", SwingConstants.LEFT),outerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/out.png"))}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_outBorder") +" ", SwingConstants.LEFT),outerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/out.png"))},
new Component[]{null,externalPane}, new Component[]{null,externalPane},
new Component[]{null,null}, new Component[]{null,null},
new Component[]{new UILabel("内边框 ", SwingConstants.LEFT),innerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/in.png"))}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_inBorder") +" ", SwingConstants.LEFT),innerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/in.png"))},
new Component[]{null,insidePane}, new Component[]{null,insidePane},
new Component[]{null,null} new Component[]{null,null}
}; };
@ -105,26 +105,30 @@ public class BorderPane extends AbstractBasicStylePane {
backgroundPanel = new UIExpandablePane(Inter.getLocText("FR-Designer_Background"),280,20,backgroundPane); backgroundPanel = new UIExpandablePane(Inter.getLocText("FR-Designer_Background"),280,20,backgroundPane);
this.add(backgroundPanel,BorderLayout.CENTER); this.add(backgroundPanel,BorderLayout.CENTER);
outerToggleButton.addChangeListener(new ChangeListener() { outerToggleButton.addChangeListener(outerToggleButtonChangeListener);
@Override innerToggleButton.addChangeListener(innerToggleButtonChangeListener);
public void stateChanged(ChangeEvent e) {
boolean value = outerToggleButton.isSelected();
topToggleButton.setSelected(value);
bottomToggleButton.setSelected(value);
leftToggleButton.setSelected(value);
rightToggleButton.setSelected(value);
}
});
innerToggleButton.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
boolean value = innerToggleButton.isSelected();
horizontalToggleButton.setSelected(value);
verticalToggleButton.setSelected(value);
}
});
} }
ChangeListener outerToggleButtonChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
boolean value = outerToggleButton.isSelected();
topToggleButton.setSelected(value);
bottomToggleButton.setSelected(value);
leftToggleButton.setSelected(value);
rightToggleButton.setSelected(value);
}
};
ChangeListener innerToggleButtonChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
boolean value = innerToggleButton.isSelected();
horizontalToggleButton.setSelected(value);
verticalToggleButton.setSelected(value);
}
};
private void initButtonsWithIcon(){ private void initButtonsWithIcon(){
topToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/top.png")); topToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/top.png"));
leftToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/left.png")); leftToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/left.png"));

64
designer_base/src/com/fr/design/gui/style/FRFontPane.java

@ -42,7 +42,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
public static Integer[] FONT_SIZES = {new Integer(6), new Integer(8), new Integer(9), new Integer(10), new Integer(11), new Integer(12), new Integer(14), new Integer(16), public static Integer[] FONT_SIZES = {new Integer(6), new Integer(8), new Integer(9), new Integer(10), new Integer(11), new Integer(12), new Integer(14), new Integer(16),
new Integer(18), new Integer(20), new Integer(22), new Integer(24), new Integer(26), new Integer(28), new Integer(36), new Integer(48), new Integer(72)}; new Integer(18), new Integer(20), new Integer(22), new Integer(24), new Integer(26), new Integer(28), new Integer(36), new Integer(48), new Integer(72)};
private static final Dimension BUTTON_SIZE = new Dimension(20, 18); private static final Dimension BUTTON_SIZE = new Dimension(20, 18);
private final String[] fontSizeStyles = {Inter.getLocText("FRFont-plain"), Inter.getLocText("FRFont-bold"), Inter.getLocText("FRFont-italic"), Inter.getLocText("FRFont-bolditalic")}; private final String[] fontSizeStyles = {Inter.getLocText("FR-Designer_FRFont_plain"), Inter.getLocText("FR-Designer_FRFont_bold"), Inter.getLocText("FR-Designer_FRFont_italic"), Inter.getLocText("FR-Designer_FRFont_bolditalic")};
private JPanel buttonPane; private JPanel buttonPane;
private JPanel isSuperOrSubPane; private JPanel isSuperOrSubPane;
private UIComboBox fontNameComboBox; private UIComboBox fontNameComboBox;
@ -82,7 +82,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("Sytle-FRFont"); return Inter.getLocText("FR-Designer_Sytle-FRFont");
} }
/** /**
@ -130,34 +130,34 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
*/ */
public FRFont update(FRFont frFont) { public FRFont update(FRFont frFont) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Family"))) { if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_Name"))) {
frFont = frFont.applyName((String) fontNameComboBox.getSelectedItem()); frFont = frFont.applyName((String) fontNameComboBox.getSelectedItem());
} }
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Style"))) { if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Style"))) {
frFont = frFont.applyStyle(fontSizeStyleComboBox.getSelectedIndex()); frFont = frFont.applyStyle(fontSizeStyleComboBox.getSelectedIndex());
} }
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Size"))) { if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer-FRFont_Size"))) {
frFont = frFont.applySize(Float.parseFloat(fontSizeComboBox.getSelectedItem().toString())); frFont = frFont.applySize(Float.parseFloat(fontSizeComboBox.getSelectedItem().toString()));
} }
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Foreground"))) { if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Foreground"))) {
frFont = frFont.applyForeground(this.colorSelectPane.getColor()); frFont = frFont.applyForeground(this.colorSelectPane.getColor());
} }
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Underline"))) { if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Underline"))) {
int line = underline.isSelected() ? this.underlineCombo.getSelectedLineStyle() : Constants.LINE_NONE; int line = underline.isSelected() ? this.underlineCombo.getSelectedLineStyle() : Constants.LINE_NONE;
frFont = frFont.applyUnderline(line); frFont = frFont.applyUnderline(line);
} }
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("Line-Style"))) { if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer-FRFont_Line_Style"))) {
frFont = frFont.applyUnderline(this.underlineCombo.getSelectedLineStyle()); frFont = frFont.applyUnderline(this.underlineCombo.getSelectedLineStyle());
} }
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Strikethrough"))) { if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Strikethrough"))) {
frFont = frFont.applyStrikethrough(isStrikethroughCheckBox.isSelected()); frFont = frFont.applyStrikethrough(isStrikethroughCheckBox.isSelected());
} }
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Shadow"))) { if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Shadow"))) {
frFont = frFont.applyShadow(isShadowCheckBox.isSelected()); frFont = frFont.applyShadow(isShadowCheckBox.isSelected());
} }
@ -175,7 +175,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private FRFont updateSubSuperscript(FRFont frFont) { private FRFont updateSubSuperscript(FRFont frFont) {
boolean isSuper = frFont.isSuperscript(); boolean isSuper = frFont.isSuperscript();
boolean isSub = frFont.isSubscript(); boolean isSub = frFont.isSubscript();
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Superscript"))) { if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Superscript"))) {
//如果上标没有选中,点击则选中上标,并且下标一定是不选中状态 //如果上标没有选中,点击则选中上标,并且下标一定是不选中状态
//如果上标选中,点击则取消选中上标,字体回复正常 //如果上标选中,点击则取消选中上标,字体回复正常
if (superPane.isSelected() && !isSuper) { if (superPane.isSelected() && !isSuper) {
@ -185,7 +185,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
frFont = frFont.applySuperscript(false); frFont = frFont.applySuperscript(false);
} }
} }
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Subscript"))) { if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Subscript"))) {
if (subPane.isSelected() && !isSub) { if (subPane.isSelected() && !isSub) {
frFont = frFont.applySubscript(true); frFont = frFont.applySubscript(true);
frFont = frFont.applySuperscript(false); frFont = frFont.applySuperscript(false);
@ -260,29 +260,29 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
} }
private void initAllNames() { private void initAllNames() {
fontSizeStyleComboBox.setGlobalName(Inter.getLocText("FRFont-Style")); fontSizeStyleComboBox.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Style"));
fontNameComboBox.setGlobalName(Inter.getLocText("FRFont-Family")); fontNameComboBox.setGlobalName(Inter.getLocText("FR-Designer_Name"));
fontSizeComboBox.setGlobalName(Inter.getLocText("FRFont-Size")); fontSizeComboBox.setGlobalName(Inter.getLocText("FR-Designer-FRFont_Size"));
colorSelectPane.setGlobalName(Inter.getLocText("FRFont-Foreground")); colorSelectPane.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Foreground"));
italic.setGlobalName(Inter.getLocText("FRFont-italic")); italic.setGlobalName(Inter.getLocText("FR-Designer_FRFont_italic"));
bold.setGlobalName(Inter.getLocText("FRFont-bold")); bold.setGlobalName(Inter.getLocText("FR-Designer_FRFont_bold"));
underline.setGlobalName(Inter.getLocText("FRFont-Underline")); underline.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Underline"));
underlineCombo.setGlobalName(Inter.getLocText("Line-Style")); underlineCombo.setGlobalName(Inter.getLocText("FR-Designer-FRFont_Line_Style"));
isStrikethroughCheckBox.setGlobalName(Inter.getLocText("FRFont-Strikethrough")); isStrikethroughCheckBox.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Strikethrough"));
isShadowCheckBox.setGlobalName(Inter.getLocText("FRFont-Shadow")); isShadowCheckBox.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Shadow"));
superPane.setGlobalName(Inter.getLocText("FRFont-Superscript")); superPane.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Superscript"));
subPane.setGlobalName(Inter.getLocText("FRFont-Subscript")); subPane.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Subscript"));
} }
private void setToolTips() { private void setToolTips() {
colorSelectPane.setToolTipText(Inter.getLocText("FRFont-Foreground")); colorSelectPane.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Foreground"));
italic.setToolTipText(Inter.getLocText("FRFont-italic")); italic.setToolTipText(Inter.getLocText("FR-Designer_FRFont_italic"));
bold.setToolTipText(Inter.getLocText("FRFont-bold")); bold.setToolTipText(Inter.getLocText("FR-Designer_FRFont_bold"));
underline.setToolTipText(Inter.getLocText("FRFont-Underline")); underline.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Underline"));
isStrikethroughCheckBox.setToolTipText(Inter.getLocText("FRFont-Strikethrough")); isStrikethroughCheckBox.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Strikethrough"));
isShadowCheckBox.setToolTipText(Inter.getLocText("FRFont-Shadow")); isShadowCheckBox.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Shadow"));
superPane.setToolTipText(Inter.getLocText("FRFont-Superscript")); superPane.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Superscript"));
subPane.setToolTipText(Inter.getLocText("FRFont-Subscript")); subPane.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Subscript"));
} }

15
designer_base/src/com/fr/design/gui/style/FormatPane.java

@ -81,9 +81,7 @@ public class FormatPane extends AbstractBasicStylePane{
protected void initComponents(Integer[] types) { protected void initComponents(Integer[] types) {
this.setLayout(new BorderLayout(0, 4)); this.setLayout(new BorderLayout(0, 4));
iniSampleLable(); iniSampleLable();
contentPane = new JPanel(new BorderLayout(0, 4)) { contentPane = new JPanel(new BorderLayout(0, 4)) {
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
@ -91,33 +89,24 @@ public class FormatPane extends AbstractBasicStylePane{
} }
}; };
typeComboBox = new UIComboBox(types); typeComboBox = new UIComboBox(types);
UIComboBoxRenderer render = createComBoxRender(); UIComboBoxRenderer render = createComBoxRender();
typeComboBox.setRenderer(render); typeComboBox.setRenderer(render);
typeComboBox.addItemListener(itemListener); typeComboBox.addItemListener(itemListener);
contentPane.add(sampleLabel, BorderLayout.NORTH); contentPane.add(sampleLabel, BorderLayout.NORTH);
// this.add(typeComboBox, BorderLayout.NORTH);
centerPane = new JPanel(new CardLayout()); centerPane = new JPanel(new CardLayout());
centerPane.add(new JPanel(), "hide"); centerPane.add(new JPanel(), "hide");
centerPane.setPreferredSize(new Dimension(0, 0) ); centerPane.setPreferredSize(new Dimension(0, 0) );
centerPane.add(contentPane, "show"); centerPane.add(contentPane, "show");
formatFontPane = new JPanel(new BorderLayout()); formatFontPane = new JPanel(new BorderLayout());
formatFontPane.add(centerPane, BorderLayout.NORTH); formatFontPane.add(centerPane, BorderLayout.NORTH);
formatFontPane.add(new FRFontPane(), BorderLayout.CENTER); formatFontPane.add(new FRFontPane(), BorderLayout.CENTER);
// this.add(formatFontPane, BorderLayout.CENTER);
// content pane.
txtCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); txtCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
contentPane.add(txtCenterPane, BorderLayout.CENTER); contentPane.add(txtCenterPane, BorderLayout.CENTER);
textField = new UIComboBox(FormatField.getInstance().getFormatArray(getFormatContents())); textField = new UIComboBox(FormatField.getInstance().getFormatArray(getFormatContents()));
textField.addItemListener(textFieldItemListener); textField.addItemListener(textFieldItemListener);
textField.setEditable(true); textField.setEditable(true);
txtCenterPane.add(textField, BorderLayout.NORTH); txtCenterPane.add(textField, BorderLayout.NORTH);
frFontPane = new FRFontPane(); frFontPane = new FRFontPane();
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
@ -132,7 +121,6 @@ public class FormatPane extends AbstractBasicStylePane{
int[][] rowCount = {{1, 1},{1, 1}, {1, 1}, {1, 3}, {1, 1}}; int[][] rowCount = {{1, 1},{1, 1}, {1, 1}, {1, 3}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM);
this.add(panel,BorderLayout.CENTER); this.add(panel,BorderLayout.CENTER);
} }
protected UIComboBoxRenderer createComBoxRender(){ protected UIComboBoxRenderer createComBoxRender(){
@ -323,12 +311,9 @@ public class FormatPane extends AbstractBasicStylePane{
cardLayout.show(centerPane, "hide"); cardLayout.show(centerPane, "hide");
} else { } else {
textField.removeAllItems(); textField.removeAllItems();
long begin = System.currentTimeMillis();
for (int i = 0; i < items.length; i++) { for (int i = 0; i < items.length; i++) {
textField.addItem(items[i]); textField.addItem(items[i]);
} }
long end = System.currentTimeMillis();
System.out.println(end-begin+"ms");
centerPane.setPreferredSize(new Dimension(270, 70) ); centerPane.setPreferredSize(new Dimension(270, 70) );
cardLayout.show(centerPane, "show"); cardLayout.show(centerPane, "show");
} }

22
designer_base/src/com/fr/design/locale/designer.properties

@ -2011,3 +2011,25 @@ FR-Designer_Float_Element=Float Element
FR-Designer_Widget_Library=Widget Library FR-Designer_Widget_Library=Widget Library
FR-Designer_No_Settings_Available=No Settings Available! FR-Designer_No_Settings_Available=No Settings Available!
FR-Designer_Configured_Roles=Configured role FR-Designer_Configured_Roles=Configured role
FR-Designer_Scale_EnlargeOrReduce=Scale
FR-Designer_Scale_selfAdaptButton=Fit the selected area exactly
FR-Designer_Scale_customButton=custom
FR-Designer_FRFont_Subscript=Subscript
FR-Designer_FRFont_Superscript=Superscript
FR-Designer_FRFont_Shadow=Shadow
FR-Designer_FRFont_Strikethrough=Strikethrough
FR-Designer_FRFont_Underline=Underline
FR-Designer_FRFont_bold=bold
FR-Designer_FRFont_italic=italic
FR-Designer_FRFont_Foreground=Foreground
FR-Designer_FRFont_Style=Style
FR-Designer_FRFont_plain=plain
FR-Designer_FRFont_bolditalic=bolditalic
FR-Designer_outBorder=outBorder
FR-Designer_inBorder=inBorder
FR-Designer_ExpandD_Up_Father_Cell=Up_Father_Cell
FR-Designer_ExpandD_Expand_Direction=Expand_Direction
FR-Designer_Expand=Expand
FR-Designer_ExpendSort=ExpendSort
FR-Designer_ExpandD_Expandable=Expandable
FR-Designer_Read_failure=Read_failure

22
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -2011,3 +2011,25 @@ FR-Designer_Float_Element=Float Element
FR-Designer_Widget_Library=Widget Library FR-Designer_Widget_Library=Widget Library
FR-Designer_No_Settings_Available=No Settings Available! FR-Designer_No_Settings_Available=No Settings Available!
FR-Designer_Configured_Roles=Configured role FR-Designer_Configured_Roles=Configured role
FR-Designer_Scale_EnlargeOrReduce=Scale
FR-Designer_Scale_selfAdaptButton=Fit the selected area exactly
FR-Designer_Scale_customButton=custom
FR-Designer_FRFont_Subscript=Subscript
FR-Designer_FRFont_Superscript=\
FR-Designer_FRFont_Shadow=Shadow
FR-Designer_FRFont_Strikethrough=Strikethrough
FR-Designer_FRFont_Underline=Underline
FR-Designer_FRFont_bold=bold
FR-Designer_FRFont_italic=italic
FR-Designer_FRFont_Foreground=Foreground
FR-Designer_FRFont_Style=Style
FR-Designer_FRFont_plain=plain
FR-Designer_FRFont_bolditalic=bolditalic
FR-Designer_outBorder=outBorder
FR-Designer_inBorder=inBorder
FR-Designer_ExpandD_Up_Father_Cell=Up_Father_Cell
FR-Designer_ExpandD_Expand_Direction=Expand_Direction
FR-Designer_Expand=Expand
FR-Designer_ExpendSort=ExpendSort
FR-Designer_ExpandD_Expandable=Expandable
FR-Designer_Read_failure=Read_failure

24
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -1987,4 +1987,26 @@ FR-Designer_Cell_Attributes=\u30BB\u30EB\u5C5E\u6027
FR-Designer_Float_Element=\u30D5\u30ED\u30FC\u30C8\u8981\u7D20 FR-Designer_Float_Element=\u30D5\u30ED\u30FC\u30C8\u8981\u7D20
FR-Designer_Widget_Library= FR-Designer_Widget_Library=
FR-Designer_No_Settings_Available= FR-Designer_No_Settings_Available=
FR-Designer_Configured_Roles=\u69CB\u6210\u3055\u308C\u305F\u5F79\u5272 FR-Designer_Configured_Roles=\u69CB\u6210\u3055\u308C\u305F\u5F79\u5272
FR-Designer_Scale_EnlargeOrReduce=
FR-Designer_Scale_selfAdaptButton=\
FR-Designer_Scale_customButton=\
FR-Designer_FRFont_Subscript=\
FR-Designer_FRFont_Superscript=\
FR-Designer_FRFont_Shadow=\
FR-Designer_FRFont_Strikethrough=\
FR-Designer_FRFont_Underline=\
FR-Designer_FRFont_bold=\
FR-Designer_FRFont_italic=\
FR-Designer_FRFont_Foreground=\
FR-Designer_FRFont_Style=\
FR-Designer_FRFont_plain=\
FR-Designer_FRFont_bolditalic=\
FR-Designer_outBorder=\
FR-Designer_inBorder=\
FR-Designer_ExpandD_Up_Father_Cell=\
FR-Designer_ExpandD_Expand_Direction=\
FR-Designer_Expand=\
FR-Designer_ExpendSort=\
FR-Designer_ExpandD_Expandable=\
FR-Designer_Read_failure=\

23
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -1987,4 +1987,25 @@ FR-Designer_Cell_Attributes=\uC140\uC18D\uC131
FR-Designer_Float_Element=\uD638\uBC84\uC694\uC18C FR-Designer_Float_Element=\uD638\uBC84\uC694\uC18C
FR-Designer_Widget_Library= FR-Designer_Widget_Library=
FR-Designer_No_Settings_Available= FR-Designer_No_Settings_Available=
FR-Designer_Configured_Roles=\uC5ED\uD560\uC774\uAD6C\uC131\uB418\uC5C8\uC2B5\uB2C8\uB2E4. FR-Designer_Configured_Roles=\uC5ED\uD560\uC774\uAD6C\uC131\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
FR-Designer_Scale_EnlargeOrReduce=
FR-Designer_Scale_selfAdaptButton=\
FR-Designer_FRFont_Subscript=\
FR-Designer_FRFont_Superscript=\
FR-Designer_FRFont_Shadow=\
FR-Designer_FRFont_Strikethrough=\
FR-Designer_FRFont_Underline=\
FR-Designer_FRFont_bold=\
FR-Designer_FRFont_italic=\
FR-Designer_FRFont_Foreground=\
FR-Designer_FRFont_Style=\
FR-Designer_FRFont_plain=\
FR-Designer_FRFont_bolditalic=\
FR-Designer_outBorder=\
FR-Designer_inBorder=\
FR-Designer_ExpandD_Up_Father_Cell=\
FR-Designer_ExpandD_Expand_Direction=\
FR-Designer_Expand=\
FR-Designer_ExpendSort=\
FR-Designer_ExpandD_Expandable=\
FR-Designer_Read_failure=\

22
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -2009,3 +2009,25 @@ FR-Designer_Float_Element=\u60AC\u6D6E\u5143\u7D20
FR-Designer_Widget_Library=\u7EC4\u4EF6\u5E93 FR-Designer_Widget_Library=\u7EC4\u4EF6\u5E93
FR-Designer_No_Settings_Available=\u65E0\u53EF\u7528\u914D\u7F6E\u9879\uFF01 FR-Designer_No_Settings_Available=\u65E0\u53EF\u7528\u914D\u7F6E\u9879\uFF01
FR-Designer_Configured_Roles=\u5DF2\u914D\u7F6E\u89D2\u8272 FR-Designer_Configured_Roles=\u5DF2\u914D\u7F6E\u89D2\u8272
FR-Designer_Scale_EnlargeOrReduce=\u7F29\u653E
FR-Designer_Scale_selfAdaptButton=\u6070\u597D\u5BB9\u7EB3\u9009\u5B9A\u533A\u57DF
FR-Designer_Scale_customButton=\u81EA\u5B9A\u4E49
FR-Designer_FRFont_Subscript=\u4E0B\u6807
FR-Designer_FRFont_Superscript=\u4E0A\u6807
FR-Designer_FRFont_Shadow=\u9634\u5F71
FR-Designer_FRFont_Strikethrough=\u5220\u9664\u7EBF
FR-Designer_FRFont_Underline=\u4E0B\u5212\u7EBF
FR-Designer_FRFont_bold=\u52A0\u7C97
FR-Designer_FRFont_italic=\u659C\u4F53
FR-Designer_FRFont_Foreground=\u989C\u8272
FR-Designer_FRFont_Style=\u5B57\u5F62
FR-Designer_FRFont_plain=\u5E38\u89C4
FR-Designer_FRFont_bolditalic=\u52A0\u7C97\u503E\u659C
FR-Designer_outBorder=\u5916\u8FB9\u6846
FR-Designer_inBorder=\u5185\u8FB9\u6846
FR-Designer_ExpandD_Up_Father_Cell=\u4E0A\u7236\u683C
FR-Designer_ExpandD_Expand_Direction=\u6269\u5C55\u65B9\u5411
FR-Designer_Expand=\u6269\u5C55
FR-Designer_ExpendSort=\u6269\u5C55\u540E\u6392\u5E8F
FR-Designer_ExpandD_Expandable=\u53EF\u4F38\u5C55\u6027
FR-Designer_Read_failure=\u8BFB\u53D6\u5931\u8D25\uFF0C\u53EF\u80FD\u6E90\u6587\u4EF6\u5DF2\u635F\u574F

21
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -2010,3 +2010,24 @@ FR-Designer_Float_Element=\u61F8\u6D6E\u5143\u7D20
FR-Designer_Widget_Library=\u7D44\u4EF6\u5EAB FR-Designer_Widget_Library=\u7D44\u4EF6\u5EAB
FR-Designer_No_Settings_Available=\u7121\u53EF\u7528\u914D\u5BD8\u9805\uFF01 FR-Designer_No_Settings_Available=\u7121\u53EF\u7528\u914D\u5BD8\u9805\uFF01
FR-Designer_Configured_Roles=\u5DF2\u914D\u7F6E\u89D2\u8272 FR-Designer_Configured_Roles=\u5DF2\u914D\u7F6E\u89D2\u8272
FR-Designer_Scale_selfAdaptButton=\
FR-Designer_Scale_customButton=\
FR-Designer_FRFont_Subscript=\
FR-Designer_FRFont_Superscript=\
FR-Designer_FRFont_Shadow=\
FR-Designer_FRFont_Strikethrough=\
FR-Designer_FRFont_Underline=\
FR-Designer_FRFont_bold=\
FR-Designer_FRFont_italic=\
FR-Designer_FRFont_Foreground=\
FR-Designer_FRFont_Style=\
FR-Designer_FRFont_plain=\
FR-Designer_FRFont_bolditalic=\
FR-Designer_outBorder=\
FR-Designer_inBorder=\
FR-Designer_ExpandD_Up_Father_Cell=\
FR-Designer_ExpandD_Expand_Direction=\
FR-Designer_Expand=\
FR-Designer_ExpendSort=\
FR-Designer_ExpandD_Expandable=\
FR-Designer_Read_failure=\

280
designer_base/src/com/fr/design/mainframe/JSliderPane.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe;
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.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.islider.UISlider; import com.fr.design.gui.islider.UISlider;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
@ -9,6 +10,7 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.MatteBorder;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
@ -17,14 +19,24 @@ import javax.swing.plaf.basic.BasicSliderUI;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Observable;
/** /**
* Created by MoMeak on 2017/7/13. * Created by MoMeak on 2017/7/13.
*/ */
public class JSliderPane extends JPanel { public class JSliderPane extends JPanel {
private final int KERNING = 2; private static final double ONEPOINTEIGHT = 1.8;
private static final int SIX = 6;
private static final int TEN = 10;
private static final int ONEEIGHT = 18;
private static final int FOURTEN = 40;
private static final int HALFHUNDRED = 50;
private static final int HUNDRED = 100;
private static final int TWOHUNDRED = 200;
private static final int THREEHUNDRED = 300;
private static final int FOURHUNDRED = 400;
private static final int DIALOGWIDTH = 150;
private static final int DIALOGHEIGHT = 200;
public int showValue = 100; public int showValue = 100;
public double resolutionTimes = 1.0; public double resolutionTimes = 1.0;
private static JSliderPane THIS; private static JSliderPane THIS;
@ -34,23 +46,30 @@ public class JSliderPane extends JPanel {
private int sliderValue; private int sliderValue;
private UIButton downButton; private UIButton downButton;
private UIButton upButton; private UIButton upButton;
private UIButton showValButton;
private UIRadioButton twoHundredButton;
private UIRadioButton oneHundredButton;
private UIRadioButton SevenFiveButton;
private UIRadioButton fiveTenButton;
private UIRadioButton twoFiveButton;
private UIRadioButton selfAdaptButton;
private UIRadioButton customButton;
//拖动条处理和button、直接输入不一样 //拖动条处理和button、直接输入不一样
private boolean isButtonOrIsTxt = true; private boolean isButtonOrIsTxt = true;
private boolean isDialogOut = false; // 是否弹出 private PopupPane dialog;
private Dialog dialog; private int upButtonX;
public JSliderPane() { public JSliderPane() {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
slider = new UISlider(0,100,50); slider = new UISlider(0,HUNDRED,HALFHUNDRED);
slider.setUI(new JSliderPaneUI(slider)); slider.setUI(new JSliderPaneUI(slider));
slider.addChangeListener(listener); slider.addChangeListener(listener);
showVal = new UITextField(); showVal = new UITextField();
showVal.setText("100%"); showVal.setText("100%");
showVal.setPreferredSize(new Dimension(40,18)); showVal.setPreferredSize(new Dimension(FOURTEN,ONEEIGHT));
showVal.getDocument().addDocumentListener(showValDocumentListener); showVal.getDocument().addDocumentListener(showValDocumentListener);
// showVal.addMouseListener(showValMouseListener);
downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveDown.png")); downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveDown.png"));
upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveUp.png")); upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveUp.png"));
@ -61,21 +80,23 @@ public class JSliderPane extends JPanel {
JPanel panel = new JPanel(new FlowLayout(1,1,0)); JPanel panel = new JPanel(new FlowLayout(1,1,0));
showValButton = new UIButton(showVal.getText());
showValButton.setBorderPainted(false);
showValButton.setPreferredSize(new Dimension(HALFHUNDRED,ONEEIGHT));
showValButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
popupDialog();
}
});
panel.add(downButton); panel.add(downButton);
panel.add(slider); panel.add(slider);
panel.add(upButton); panel.add(upButton);
panel.add(showVal); panel.add(showValButton);
// JPanel panel = new JPanel(null);
// panel.add(downButton);
// panel.add(slider);
// panel.add(upButton);
// panel.add(showVal);
// downButton.setBounds(0,0,16,16);
// slider.setBounds(16+KERNING,0,160,16);
// upButton.setBounds(176+KERNING*2,0,16,16);
// showVal.setBounds(192+KERNING*3,0,40,16);
this.add(panel,BorderLayout.NORTH); this.add(panel,BorderLayout.NORTH);
this.setBounds(0,0,300,16); this.setBounds(0,0,THREEHUNDRED,ONEEIGHT);
} }
public static final JSliderPane getInstance() { public static final JSliderPane getInstance() {
@ -86,6 +107,24 @@ public class JSliderPane extends JPanel {
return THIS; return THIS;
} }
private void initUIRadioButton(){
twoHundredButton = new UIRadioButton("200%");
oneHundredButton = new UIRadioButton("100%");
SevenFiveButton = new UIRadioButton("75%");
fiveTenButton = new UIRadioButton("50%");
twoFiveButton = new UIRadioButton("25%");
selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton"));
customButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_customButton"));
ButtonGroup bg=new ButtonGroup();// 初始化按钮组
bg.add(twoHundredButton);// 加入按钮组
bg.add(oneHundredButton);
bg.add(SevenFiveButton);
bg.add(fiveTenButton);
bg.add(twoFiveButton);
bg.add(selfAdaptButton);
bg.add(customButton);
}
//定义一个监听器,用于监听所有滑动条 //定义一个监听器,用于监听所有滑动条
@ -115,7 +154,7 @@ public class JSliderPane extends JPanel {
isButtonOrIsTxt = true; isButtonOrIsTxt = true;
resolutionTimes = divide(showValue,100,2); resolutionTimes = divide(showValue,100,2);
refreshSlider(); refreshSlider();
refreshBody(); refreshBottun();
} }
@Override @Override
@ -129,49 +168,20 @@ public class JSliderPane extends JPanel {
} }
}; };
MouseListener showValMouseListener = new MouseListener() {
@Override
public void mouseClicked(MouseEvent e) {
popupDialog();
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
};
private void refreshSlider(){ private void refreshSlider(){
showValue = Integer.parseInt(showVal.getText().substring(0, showVal.getText().indexOf("%"))); showValue = Integer.parseInt(showVal.getText().substring(0, showVal.getText().indexOf("%")));
if (showValue >100){ if (showValue >HUNDRED){
slider.setValue((int)(showValue+200)/6); slider.setValue((int)(showValue+TWOHUNDRED)/SIX);
}else if (showValue <100){ }else if (showValue <HUNDRED){
slider.setValue((int)((showValue-10)/1.8)); slider.setValue((int)((showValue-TEN)/ONEPOINTEIGHT));
}else if (showValue == 100){ }else if (showValue == HUNDRED){
slider.setValue(50); slider.setValue(HALFHUNDRED);
} }
} }
private void refreshBody(){
// int resolution = (int) (ScreenResolution.getScreenResolution()*resolutionTimes);
// HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution);
private void refreshBottun(){
showValButton.setText(showVal.getText());
} }
public double getResolutionTimes(){ public double getResolutionTimes(){
@ -188,42 +198,44 @@ public class JSliderPane extends JPanel {
return b1.divide(b2,scale).doubleValue(); return b1.divide(b2,scale).doubleValue();
} }
ActionListener buttonActionListener = new ActionListener() { ActionListener buttonActionListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
showValue = Integer.parseInt(showVal.getText().substring(0, showVal.getText().indexOf("%"))); showValue = Integer.parseInt(showVal.getText().substring(0, showVal.getText().indexOf("%")));
isButtonOrIsTxt = true; isButtonOrIsTxt = true;
if(e.getActionCommand().equals("less")){ if(e.getActionCommand().equals("less")){
int newDownVal = showValue - 10; int newDownVal = showValue - TEN;
if (newDownVal >= 10 ){ if (newDownVal >= TEN ){
showValue = newDownVal; showValue = newDownVal;
showVal.setText(newDownVal + "%"); showVal.setText(newDownVal + "%");
}else { }else {
showValue = newDownVal; showValue = newDownVal;
showVal.setText(10 + "%"); showVal.setText(TEN + "%");
} }
} }
if(e.getActionCommand().equals("more")){ if(e.getActionCommand().equals("more")){
int newUpVal = showValue + 10; int newUpVal = showValue + TEN;
if (newUpVal <= 400 ){ if (newUpVal <= FOURHUNDRED ){
showValue = newUpVal; showValue = newUpVal;
showVal.setText(newUpVal + "%"); showVal.setText(newUpVal + "%");
}else { }else {
showValue = newUpVal; showValue = newUpVal;
showVal.setText(400 + "%"); showVal.setText(FOURHUNDRED + "%");
} }
} }
isButtonOrIsTxt = true; isButtonOrIsTxt = true;
} }
}; };
private void getTimes(int value){ private void getTimes(int value){
if (value == 50){ if (value == HALFHUNDRED){
times=100; times=HUNDRED;
}else if (value < 50){ }else if (value < HALFHUNDRED){
times = (int) Math.round(1.8*value + 10); times = (int) Math.round(ONEPOINTEIGHT*value + TEN);
}else { }else {
times = (int) (6*value - 200); times = (int) (SIX*value - TWOHUNDRED);
} }
} }
@ -233,17 +245,20 @@ public class JSliderPane extends JPanel {
} }
private void popupDialog(){ private void popupDialog(){
if (isDialogOut) { Point btnCoords = upButton.getLocationOnScreen();
dialog.setVisible(false); if (dialog == null){
isDialogOut = false; dialog = new PopupPane(upButton,showVal);
return; if (upButtonX == 0) {
} upButtonX = btnCoords.x;
if (dialog == null) { GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +HALFHUNDRED, -DIALOGHEIGHT);
dialog = new Dialog(showVal); }
isDialogOut = true; }else {
} else { if (upButtonX == 0) {
dialog.setVisible(true); upButtonX = btnCoords.x;
isDialogOut = true; GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +HALFHUNDRED, -DIALOGHEIGHT);
} else {
GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +HALFHUNDRED, -DIALOGHEIGHT);
}
} }
} }
@ -263,6 +278,12 @@ public class JSliderPane extends JPanel {
class JSliderPaneUI extends BasicSliderUI { class JSliderPaneUI extends BasicSliderUI {
private static final int VERTICAL_WIDTH = 11;
private static final int VERTICAL_HEIGHT = 16;
private static final int FOUR = 4;
private static final int FIVE = 5;
private static final int SIX = 6;
public JSliderPaneUI(UISlider b) { public JSliderPaneUI(UISlider b) {
super(b); super(b);
} }
@ -276,12 +297,12 @@ class JSliderPaneUI extends BasicSliderUI {
Dimension size = new Dimension(); Dimension size = new Dimension();
if ( slider.getOrientation() == JSlider.VERTICAL ) { if ( slider.getOrientation() == JSlider.VERTICAL ) {
size.width = 11; size.width = VERTICAL_WIDTH;
size.height = 16; size.height = VERTICAL_HEIGHT;
} }
else { else {
size.width = 11; size.width = VERTICAL_WIDTH;
size.height = 16; size.height = VERTICAL_HEIGHT;
} }
return size; return size;
@ -300,7 +321,7 @@ class JSliderPaneUI extends BasicSliderUI {
g.setColor(slider.getBackground().darker()); g.setColor(slider.getBackground().darker());
} }
g.setColor(Color.darkGray); g.setColor(Color.darkGray);
g.fillRect(0, 1, w-6, h+1); g.fillRect(0, 1, w-SIX, h+1);
} }
/** */ /** */
@ -315,43 +336,82 @@ class JSliderPaneUI extends BasicSliderUI {
cy = (trackBounds.height / 2); cy = (trackBounds.height / 2);
cw = trackBounds.width; cw = trackBounds.width;
g.setColor(Color.lightGray); g.setColor(Color.lightGray);
g.drawLine(0, cy, cw+5, cy); g.drawLine(0, cy, cw+FIVE, cy);
g.drawLine(5+cw/2, cy-4, 5+cw/2, cy+4); g.drawLine(FIVE+cw/2, cy-FOUR, FIVE+cw/2, cy+FOUR);
} else { } else {
super.paintTrack(g); super.paintTrack(g);
} }
} }
} }
class Dialog extends JDialog { class Dialog extends JDialog {
private Container container; // private Container container;
private static final int RESIZE_RANGE = 4; // private static final int UPLABELHEIGHT = 25;
private Cursor originCursor; // private static final int HALFHUNDRED = 50;
private Cursor southResizeCursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR); // private static final int DIALOGWIDTH = 150;
private Point mouseDownCompCoords; // private static final int DIALOGHEIGHT = 200;
private int minHeight; // 对话框最小高度 // private static final int UPLABELWIDTH = 300;
// private int minHeight; // 对话框最小高度
// private JComponent contentPane;
// private JComponent centerPane;
// private UILabel upLabel;
// public Dialog(UIButton b,UITextField j) {
// super(DesignerContext.getDesignerFrame());
// container = getContentPane();
// setUndecorated(true);
// contentPane = new JPanel(new BorderLayout());
// centerPane = new JPanel(new BorderLayout());
// upLabel = new UILabel(Inter.getLocText("FR-Designer_Scale_EnlargeOrReduce"));
// upLabel.setOpaque(true);
// upLabel.setPreferredSize(new Dimension(UPLABELWIDTH,UPLABELHEIGHT));
// upLabel.setBackground(Color.LIGHT_GRAY);
// upLabel.setBorder(BorderFactory.createLineBorder(Color.gray,1));
// upLabel.setBorder(new MatteBorder(0,0,1,0,Color.gray));
// centerPane.add(j,BorderLayout.NORTH);
// contentPane.add(upLabel,BorderLayout.NORTH);
// contentPane.add(centerPane,BorderLayout.CENTER);
//// contentPane.setBorder(BorderFactory.createLineBorder(Color.gray,1));
// contentPane.setBorder(new MatteBorder(1,1,1,1,Color.darkGray));
//// contentPane.add(new JPanel())
// container.add(contentPane, BorderLayout.CENTER);
// minHeight = container.getPreferredSize().height;
// setSize(DIALOGWIDTH, DIALOGHEIGHT);
//// validate();
// Point btnCoords = b.getLocationOnScreen();
//
// this.setLocation(btnCoords.x - DIALOGWIDTH + b.getWidth() +HALFHUNDRED, btnCoords.y -DIALOGHEIGHT);
//// initListener();
//
// this.setVisible(true);
// }
}
class PopupPane extends JPopupMenu {
private JComponent contentPane; private JComponent contentPane;
private static final int UPLABELHEIGHT = 25;
private static final int HALFHUNDRED = 50;
private static final int DIALOGWIDTH = 150;
private static final int DIALOGHEIGHT = 200;
private static final int UPLABELWIDTH = 300;
private JComponent centerPane;
private UILabel upLabel; private UILabel upLabel;
PopupPane(UIButton b,UITextField j) {
public Dialog(UITextField j) {
super(DesignerContext.getDesignerFrame());
container = getContentPane();
setUndecorated(true);
contentPane = new JPanel(new BorderLayout()); contentPane = new JPanel(new BorderLayout());
upLabel = new UILabel(Inter.getLocText("Enlarge_Or_Reduce")); centerPane = new JPanel(new BorderLayout());
upLabel = new UILabel(Inter.getLocText("FR-Designer_Scale_EnlargeOrReduce"));
upLabel.setOpaque(true); upLabel.setOpaque(true);
upLabel.setPreferredSize(new Dimension(300,25)); upLabel.setPreferredSize(new Dimension(UPLABELWIDTH,UPLABELHEIGHT));
upLabel.setBackground(Color.LIGHT_GRAY); upLabel.setBackground(Color.LIGHT_GRAY);
upLabel.setBorder(new MatteBorder(0,0,1,0,Color.gray));
centerPane.add(j,BorderLayout.NORTH);
contentPane.add(upLabel,BorderLayout.NORTH); contentPane.add(upLabel,BorderLayout.NORTH);
// contentPane.add(new JPanel()) contentPane.add(centerPane,BorderLayout.CENTER);
container.add(contentPane, BorderLayout.CENTER); // contentPane.setBorder(new MatteBorder(1,1,1,1,Color.darkGray));
minHeight = container.getPreferredSize().height; this.add(contentPane, BorderLayout.CENTER);
setSize(150, 250); this.setPreferredSize(new Dimension(DIALOGWIDTH, DIALOGHEIGHT));
// validate(); this.setOpaque(false);
Point btnCoords = j.getLocationOnScreen(); }
this.setLocation(btnCoords.x -150+j.getWidth(), btnCoords.y -250);
// initListener();
this.setVisible(true); }
}
}

1122
designer_form/src/com/fr/design/mainframe/FormArea.java

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save