|
|
|
@ -73,14 +73,6 @@ public class PageSetupPane extends BasicPane {
|
|
|
|
|
private OtherPane otherPane; |
|
|
|
|
private UILabel zeroMarginWarn; |
|
|
|
|
|
|
|
|
|
public final static PaperSize MOBILE_SMAIL_SIZE = new PaperSize(new MM(142.8f), new MM(254)); |
|
|
|
|
public final static PaperSize MOBILE_LARGE_SIZE = new PaperSize(new MM(190.5f), new MM(338.7f)); |
|
|
|
|
|
|
|
|
|
public static final Object[][] MOBILE_NAME_SIZE_ARRAY = { |
|
|
|
|
{Inter.getLocText("FR-Designer_PaperSize-Mobile-Large"),MOBILE_LARGE_SIZE}, |
|
|
|
|
{Inter.getLocText("FR-Designer_PaperSize-Mobile-Small"),MOBILE_SMAIL_SIZE} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
public PageSetupPane() { |
|
|
|
|
this.initComponents(); |
|
|
|
|
} |
|
|
|
@ -135,11 +127,9 @@ public class PageSetupPane extends BasicPane {
|
|
|
|
|
private UIRadioButton landscapeRadioButton; |
|
|
|
|
|
|
|
|
|
private UIRadioButton predefinedRadioButton; |
|
|
|
|
private UIRadioButton mobileRadioButton; |
|
|
|
|
private UIRadioButton customRadioButton; |
|
|
|
|
|
|
|
|
|
private UIComboBox predefinedComboBox; |
|
|
|
|
private UIComboBox mobileComboBox; |
|
|
|
|
|
|
|
|
|
private UIBasicSpinner paperWidthSpinner; |
|
|
|
|
private UIBasicSpinner paperHeightSpinner; |
|
|
|
@ -211,18 +201,12 @@ public class PageSetupPane extends BasicPane {
|
|
|
|
|
predefinedRadioButton.setMnemonic('P'); |
|
|
|
|
predefinedRadioButton.addActionListener(previewListener); |
|
|
|
|
|
|
|
|
|
mobileRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_MobilePhone") + " :"); |
|
|
|
|
mobileRadioButton.setMnemonic('M'); |
|
|
|
|
mobileRadioButton.addActionListener(previewListener); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
customRadioButton = new UIRadioButton(Inter.getLocText("Custom") + ":"); |
|
|
|
|
customRadioButton.setMnemonic('C'); |
|
|
|
|
customRadioButton.addActionListener(previewListener); |
|
|
|
|
|
|
|
|
|
predefinedComboBox = new UIComboBox(); |
|
|
|
|
mobileComboBox = new UIComboBox(); |
|
|
|
|
|
|
|
|
|
paperWidthSpinner = new UIBasicSpinner(new SpinnerNumberModel(0.0, 0.0, Double.MAX_VALUE, 1.0)); |
|
|
|
|
((JSpinner.DefaultEditor) paperWidthSpinner.getEditor()).getTextField().setColumns(7); |
|
|
|
@ -240,8 +224,6 @@ public class PageSetupPane extends BasicPane {
|
|
|
|
|
predefinedComboBox.setRenderer(paperSizeCellRenderere); |
|
|
|
|
predefinedComboBox.addItemListener(paperSizeItemListener); |
|
|
|
|
|
|
|
|
|
mobileComboBox.setRenderer(paperSizeMobileCellRenderere); |
|
|
|
|
mobileComboBox.addItemListener(paperSizeItemMobileListener); |
|
|
|
|
|
|
|
|
|
((JSpinner.DefaultEditor) paperWidthSpinner.getEditor()).getTextField().getDocument().addDocumentListener(customTextListener); |
|
|
|
|
((JSpinner.DefaultEditor) paperHeightSpinner.getEditor()).getTextField().getDocument().addDocumentListener(customTextListener); |
|
|
|
@ -254,12 +236,6 @@ public class PageSetupPane extends BasicPane {
|
|
|
|
|
predefinedComboBox.addItem(tmpPaperSizeNameArray[1]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for(int i=0; i<MOBILE_NAME_SIZE_ARRAY.length;i++){ |
|
|
|
|
Object[] tmpPaperSizeNameArray = MOBILE_NAME_SIZE_ARRAY[i]; |
|
|
|
|
mobileComboBox.addItem(tmpPaperSizeNameArray[1]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// tow radio buttons.
|
|
|
|
|
JPanel radioButtonPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
|
|
|
|
innerpaperSizePane.add(radioButtonPane); |
|
|
|
@ -267,16 +243,8 @@ public class PageSetupPane extends BasicPane {
|
|
|
|
|
radioButtonPane.add(predefinedRadioButton); |
|
|
|
|
radioButtonPane.add(predefinedComboBox); |
|
|
|
|
|
|
|
|
|
// tow radio buttons.
|
|
|
|
|
JPanel mobileButtonPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
|
|
|
|
innerpaperSizePane.add(mobileButtonPane); |
|
|
|
|
|
|
|
|
|
mobileButtonPane.add(mobileRadioButton); |
|
|
|
|
mobileButtonPane.add(mobileComboBox); |
|
|
|
|
|
|
|
|
|
ButtonGroup paperSizeRadioButtonGroup = new ButtonGroup(); |
|
|
|
|
paperSizeRadioButtonGroup.add(predefinedRadioButton); |
|
|
|
|
paperSizeRadioButtonGroup.add(mobileRadioButton); |
|
|
|
|
paperSizeRadioButtonGroup.add(customRadioButton); |
|
|
|
|
|
|
|
|
|
// size and textfields.
|
|
|
|
@ -457,15 +425,7 @@ public class PageSetupPane extends BasicPane {
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for(int i=0; i<MOBILE_NAME_SIZE_ARRAY.length; i++){ |
|
|
|
|
Object[] mobileNameSizeArray = MOBILE_NAME_SIZE_ARRAY[i]; |
|
|
|
|
if(ComparatorUtils.equals(paperSize, mobileNameSizeArray[1])){ |
|
|
|
|
this.mobileComboBox.setSelectedIndex(i); |
|
|
|
|
this.mobileRadioButton.setSelected(true); |
|
|
|
|
isCustomed = false; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
setAndPopulate(isCustomed, unitType); |
|
|
|
|
populateMargin(); |
|
|
|
|
} |
|
|
|
@ -539,13 +499,6 @@ public class PageSetupPane extends BasicPane {
|
|
|
|
|
} catch (CloneNotSupportedException cloneNotSupportedException) { |
|
|
|
|
// do nothing
|
|
|
|
|
} |
|
|
|
|
}else if(this.mobileRadioButton.isSelected()){ |
|
|
|
|
try { |
|
|
|
|
psetting.setPaperSize((PaperSize) ((PaperSize) mobileComboBox.getSelectedItem()).clone()); |
|
|
|
|
} catch (CloneNotSupportedException cloneNotSupportedException) { |
|
|
|
|
// do nothing
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else if (this.customRadioButton.isSelected()) { |
|
|
|
|
if (unitType == Constants.UNIT_CM) { |
|
|
|
|
psetting.setPaperSize(new PaperSize(new CM(((Number) this.paperWidthSpinner.getValue()).floatValue()), new CM( |
|
|
|
@ -616,10 +569,7 @@ public class PageSetupPane extends BasicPane {
|
|
|
|
|
if (this.predefinedRadioButton.isSelected()) { |
|
|
|
|
ps = (PaperSize) predefinedComboBox.getSelectedItem(); |
|
|
|
|
showPagePaneByType(ps,ori); |
|
|
|
|
} else if(this.mobileRadioButton.isSelected()){ |
|
|
|
|
ps = (PaperSize) mobileComboBox.getSelectedItem(); |
|
|
|
|
showPagePaneByType(ps, ori); |
|
|
|
|
}else if (this.customRadioButton.isSelected()) { |
|
|
|
|
} else if (this.customRadioButton.isSelected()) { |
|
|
|
|
showPagePane.populate(((Number) this.paperWidthSpinner.getValue()).doubleValue(), |
|
|
|
|
((Number) this.paperHeightSpinner.getValue()).doubleValue(), ori, unitType == Constants.UNIT_MM); |
|
|
|
|
} |
|
|
|
@ -692,34 +642,6 @@ public class PageSetupPane extends BasicPane {
|
|
|
|
|
sbuf.append(']'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Paper size cell renderer. |
|
|
|
|
*/ |
|
|
|
|
private UIComboBoxRenderer paperSizeMobileCellRenderere = new UIComboBoxRenderer() { |
|
|
|
|
@Override |
|
|
|
|
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
|
|
|
|
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
|
|
|
|
|
|
|
|
|
if (value instanceof PaperSize) { |
|
|
|
|
PaperSize paperSize = (PaperSize) value; |
|
|
|
|
for (int i = 0; i < MOBILE_NAME_SIZE_ARRAY.length; i++) { |
|
|
|
|
Object[] tmpPaperSizeNameArray = MOBILE_NAME_SIZE_ARRAY[i]; |
|
|
|
|
|
|
|
|
|
if (ComparatorUtils.equals(paperSize, tmpPaperSizeNameArray[1])) { |
|
|
|
|
StringBuffer sbuf = new StringBuffer(tmpPaperSizeNameArray[0].toString()); |
|
|
|
|
adjustCellRenderByType(sbuf,paperSize); |
|
|
|
|
this.setText(sbuf.toString()); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return this; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Paper size item listener. |
|
|
|
|
*/ |
|
|
|
@ -745,18 +667,6 @@ public class PageSetupPane extends BasicPane {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Paper size item listener. |
|
|
|
|
*/ |
|
|
|
|
private ItemListener paperSizeItemMobileListener = new ItemListener() { |
|
|
|
|
public void itemStateChanged(ItemEvent evt) { |
|
|
|
|
PaperSize paperSize = (PaperSize) mobileComboBox.getSelectedItem(); |
|
|
|
|
adjustSpinnerValueByType(paperSize); |
|
|
|
|
mobileRadioButton.setSelected(true); |
|
|
|
|
previewShowPagePane(); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// text listener.
|
|
|
|
|
DocumentListener customTextListener = new DocumentListener() { |
|
|
|
|
public void insertUpdate(DocumentEvent e) { |
|
|
|
|