|
|
@ -7,8 +7,10 @@ package com.fr.design.gui.style; |
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
import com.fr.base.Style; |
|
|
|
import com.fr.base.Style; |
|
|
|
import com.fr.design.ExtraDesignClassManager; |
|
|
|
import com.fr.design.ExtraDesignClassManager; |
|
|
|
|
|
|
|
import com.fr.design.constants.LayoutConstants; |
|
|
|
import com.fr.design.event.GlobalNameListener; |
|
|
|
import com.fr.design.event.GlobalNameListener; |
|
|
|
import com.fr.design.event.GlobalNameObserver; |
|
|
|
import com.fr.design.event.GlobalNameObserver; |
|
|
|
|
|
|
|
import com.fr.design.foldablepane.UIExpandablePane; |
|
|
|
import com.fr.design.fun.IndentationUnitProcessor; |
|
|
|
import com.fr.design.fun.IndentationUnitProcessor; |
|
|
|
import com.fr.design.gui.frpane.UINumberDragPane; |
|
|
|
import com.fr.design.gui.frpane.UINumberDragPane; |
|
|
|
import com.fr.design.gui.ibutton.UIButtonGroup; |
|
|
|
import com.fr.design.gui.ibutton.UIButtonGroup; |
|
|
@ -36,354 +38,378 @@ import java.util.Arrays; |
|
|
|
* Pane to edit cell alignment. |
|
|
|
* Pane to edit cell alignment. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameObserver { |
|
|
|
public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameObserver { |
|
|
|
private static final int ANGEL = 90; |
|
|
|
private static final int ANGEL = 90; |
|
|
|
|
|
|
|
private static final Dimension SPINNER_DIMENSION = new Dimension(60, 20); |
|
|
|
|
|
|
|
private static final String[] TEXT = {Inter.getLocText("FR-Designer_StyleAlignment_Wrap_Text"), Inter.getLocText("FR-Designer_StyleAlignment_Single_Line"), |
|
|
|
|
|
|
|
Inter.getLocText("FR-Designer_StyleAlignment_Single_Line(Adjust_Font)"), Inter.getLocText("FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)")}; |
|
|
|
|
|
|
|
|
|
|
|
private static final String[] TEXT = {Inter.getLocText("StyleAlignment-Wrap_Text"), Inter.getLocText("StyleAlignment-Single_Line"), |
|
|
|
private static final String[] LAYOUT = {Inter.getLocText("FR-Designer-StyleAlignment_Layout_Default"), Inter.getLocText("FR-Designer-StyleAlignment_Layout_Image_Titled"), |
|
|
|
Inter.getLocText("StyleAlignment-Single_Line(Adjust_Font)"), Inter.getLocText("StyleAlignment-Multi_Line(Adjust_Font)")}; |
|
|
|
Inter.getLocText("FR-Designer-StyleAlignment_Layout_Image_Extend"), Inter.getLocText("FR-Designer-StyleAlignment_Layout_Image_Adjust")}; |
|
|
|
|
|
|
|
|
|
|
|
private static final String[] LAYOUT = {Inter.getLocText("FR-Designer-StyleAlignment_Layout_Default"), Inter.getLocText("FR-Designer-StyleAlignment_Layout_Image_Titled"), |
|
|
|
private JPanel hPaneContainer; |
|
|
|
Inter.getLocText("FR-Designer-StyleAlignment_Layout_Image_Extend"), Inter.getLocText("FR-Designer-StyleAlignment_Layout_Image_Adjust")}; |
|
|
|
private JPanel vPaneContainer; |
|
|
|
|
|
|
|
private JPanel rotationBarCC; |
|
|
|
|
|
|
|
private JPanel basicPane; |
|
|
|
|
|
|
|
private JPanel seniorPane; |
|
|
|
|
|
|
|
|
|
|
|
private JPanel hPaneContainer; |
|
|
|
private UIComboBox textComboBox; |
|
|
|
private JPanel vPaneContainer; |
|
|
|
private UIComboBox textRotationComboBox; |
|
|
|
private JPanel rotationBarCC; |
|
|
|
private UIComboBox imageLayoutComboBox; |
|
|
|
|
|
|
|
|
|
|
|
private UIComboBox textComboBox; |
|
|
|
private UIButtonGroup<Integer> hAlignmentPane;// 左对齐 水平居中 右对齐 水平分散
|
|
|
|
private UIComboBox textRotationComboBox; |
|
|
|
private UIButtonGroup<Integer> vAlignmentPane;// 居上 垂直居中 居下
|
|
|
|
private UIComboBox imageLayoutComboBox; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private UIButtonGroup<Integer> hAlignmentPane;// 左对齐 水平居中 右对齐 水平分散
|
|
|
|
private UINumberDragPane rotationPane; |
|
|
|
private UIButtonGroup<Integer> vAlignmentPane;// 居上 垂直居中 居下
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private UINumberDragPane rotationPane; |
|
|
|
private UISpinner leftIndentSpinner; |
|
|
|
|
|
|
|
private UISpinner rightIndentSpinner; |
|
|
|
|
|
|
|
|
|
|
|
private UISpinner leftIndentSpinner; |
|
|
|
private UISpinner spaceBeforeSpinner; |
|
|
|
private UISpinner rightIndentSpinner; |
|
|
|
private UISpinner spaceAfterSpinner; |
|
|
|
|
|
|
|
private UISpinner lineSpaceSpinner; |
|
|
|
|
|
|
|
private GlobalNameListener globalNameListener = null; |
|
|
|
|
|
|
|
private IndentationUnitProcessor indentationUnitProcessor = null; |
|
|
|
|
|
|
|
|
|
|
|
private UISpinner spaceBeforeSpinner; |
|
|
|
public AlignmentPane() { |
|
|
|
private UISpinner spaceAfterSpinner; |
|
|
|
this.initComponents(); |
|
|
|
private UISpinner lineSpaceSpinner; |
|
|
|
} |
|
|
|
private GlobalNameListener globalNameListener = null; |
|
|
|
|
|
|
|
private IndentationUnitProcessor indentationUnitProcessor = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AlignmentPane() { |
|
|
|
|
|
|
|
this.initComponents(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void initComponents() { |
|
|
|
protected void initComponents() { |
|
|
|
textComboBox = new UIComboBox(TEXT); |
|
|
|
textComboBox = new UIComboBox(TEXT); |
|
|
|
imageLayoutComboBox = new UIComboBox(LAYOUT); |
|
|
|
imageLayoutComboBox = new UIComboBox(LAYOUT); |
|
|
|
initTextRotationCombox(); |
|
|
|
initTextRotationCombox(); |
|
|
|
|
|
|
|
|
|
|
|
Icon[] hAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), |
|
|
|
Icon[] hAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), |
|
|
|
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), |
|
|
|
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), |
|
|
|
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"), |
|
|
|
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"), |
|
|
|
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal.png"), |
|
|
|
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal.png"), |
|
|
|
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment.png")}; |
|
|
|
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment.png")}; |
|
|
|
Integer[] hAlignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT, Integer.valueOf(Constants.DISTRIBUTED), Constants.NULL}; |
|
|
|
Integer[] hAlignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT, Integer.valueOf(Constants.DISTRIBUTED), Constants.NULL}; |
|
|
|
hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment); |
|
|
|
hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment); |
|
|
|
hAlignmentPane.setAllToolTips(new String[]{Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Left"), Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Center"), Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Right"), |
|
|
|
hAlignmentPane.setAllToolTips(new String[]{Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Left"), Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Center"), Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Right"), |
|
|
|
Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Distributed"),Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_DEFAULT")}); |
|
|
|
Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Distributed"), Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_DEFAULT")}); |
|
|
|
hPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
|
|
|
hPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
|
|
|
vPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
|
|
|
vPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
|
|
|
|
|
|
|
|
|
|
|
Icon[] vAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_top_normal.png"), |
|
|
|
Icon[] vAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_top_normal.png"), |
|
|
|
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal.png"), |
|
|
|
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal.png"), |
|
|
|
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal.png")}; |
|
|
|
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal.png")}; |
|
|
|
Integer[] vAlignment = new Integer[]{Constants.TOP, Constants.CENTER, Constants.BOTTOM}; |
|
|
|
Integer[] vAlignment = new Integer[]{Constants.TOP, Constants.CENTER, Constants.BOTTOM}; |
|
|
|
vAlignmentPane = new UIButtonGroup<Integer>(vAlignmentIconArray, vAlignment); |
|
|
|
vAlignmentPane = new UIButtonGroup<Integer>(vAlignmentIconArray, vAlignment); |
|
|
|
vAlignmentPane.setAllToolTips(new String[]{Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Top"), Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Center"), Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Bottom")}); |
|
|
|
vAlignmentPane.setAllToolTips(new String[]{Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Top"), Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Center"), Inter.getLocText("FR-Designer-StyleAlignment_Tooltips_Bottom")}); |
|
|
|
initOtherComponent(); |
|
|
|
initOtherComponent(); |
|
|
|
initAllNames(); |
|
|
|
initAllNames(); |
|
|
|
|
|
|
|
|
|
|
|
indentationUnitProcessor = ExtraDesignClassManager.getInstance().getSingle(IndentationUnitProcessor.MARK_STRING); |
|
|
|
indentationUnitProcessor = ExtraDesignClassManager.getInstance().getSingle(IndentationUnitProcessor.MARK_STRING); |
|
|
|
if (null == indentationUnitProcessor){ |
|
|
|
if (null == indentationUnitProcessor) { |
|
|
|
indentationUnitProcessor = new DefaultIndentationUnitProcessor(); |
|
|
|
indentationUnitProcessor = new DefaultIndentationUnitProcessor(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void initOtherComponent() { |
|
|
|
private void initOtherComponent() { |
|
|
|
hPaneContainer.add(hAlignmentPane); |
|
|
|
hPaneContainer.add(hAlignmentPane); |
|
|
|
vPaneContainer.add(vAlignmentPane); |
|
|
|
vPaneContainer.add(vAlignmentPane); |
|
|
|
rotationPane = new UINumberDragPane(-ANGEL, ANGEL); |
|
|
|
rotationPane = new UINumberDragPane(-ANGEL, ANGEL); |
|
|
|
|
|
|
|
|
|
|
|
leftIndentSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); |
|
|
|
leftIndentSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); |
|
|
|
rightIndentSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); |
|
|
|
rightIndentSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); |
|
|
|
|
|
|
|
|
|
|
|
spaceBeforeSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); |
|
|
|
spaceBeforeSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); |
|
|
|
spaceAfterSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); |
|
|
|
spaceAfterSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); |
|
|
|
lineSpaceSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); |
|
|
|
lineSpaceSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); |
|
|
|
|
|
|
|
|
|
|
|
rotationBarCC = new JPanel(new CardLayout()); |
|
|
|
rotationBarCC = new JPanel(new CardLayout()); |
|
|
|
rotationBarCC.add(rotationPane, "show"); |
|
|
|
rotationBarCC.add(rotationPane, "show"); |
|
|
|
rotationBarCC.add(new JPanel(), "hide"); |
|
|
|
rotationBarCC.add(new JPanel(), "hide"); |
|
|
|
|
|
|
|
|
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
this.add(createPane(), BorderLayout.CENTER); |
|
|
|
this.add(createPane(), BorderLayout.CENTER); |
|
|
|
|
|
|
|
|
|
|
|
textRotationComboBox.addItemListener(new ItemListener() { |
|
|
|
textRotationComboBox.addItemListener(new ItemListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
CardLayout cc = (CardLayout) rotationBarCC.getLayout(); |
|
|
|
CardLayout cc = (CardLayout) rotationBarCC.getLayout(); |
|
|
|
cc.show(rotationBarCC, textRotationComboBox.getSelectedIndex() == 0 ? "show" : "hide"); |
|
|
|
cc.show(rotationBarCC, textRotationComboBox.getSelectedIndex() == 0 ? "show" : "hide"); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initTextRotationCombox(){ |
|
|
|
private void initTextRotationCombox() { |
|
|
|
ArrayList<String> selectOption = new ArrayList<String>(); |
|
|
|
ArrayList<String> selectOption = new ArrayList<String>(); |
|
|
|
selectOption.add(Inter.getLocText("FR-Designer_Custom-Angle")); |
|
|
|
selectOption.add(Inter.getLocText("FR-Designer_Custom-Angle")); |
|
|
|
VerticalTextProcessor processor = ExtraClassManager.getInstance().getSingle(VerticalTextProcessor.XML_TAG, DefaultVerticalTextProcessor.class); |
|
|
|
VerticalTextProcessor processor = ExtraClassManager.getInstance().getSingle(VerticalTextProcessor.XML_TAG, DefaultVerticalTextProcessor.class); |
|
|
|
selectOption.addAll(Arrays.asList(processor.getComboxOption())); |
|
|
|
selectOption.addAll(Arrays.asList(processor.getComboxOption())); |
|
|
|
|
|
|
|
|
|
|
|
textRotationComboBox = new UIComboBox(selectOption.toArray(new String[selectOption.size()])); |
|
|
|
textRotationComboBox = new UIComboBox(selectOption.toArray(new String[selectOption.size()])); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initAllNames() { |
|
|
|
private void initAllNames() { |
|
|
|
hAlignmentPane.setGlobalName(Inter.getLocText("FR-Designer-StyleAlignment_Pane_Horizontal")); |
|
|
|
hAlignmentPane.setGlobalName(Inter.getLocText("FR-Designer-StyleAlignment_Pane_Horizontal")); |
|
|
|
vAlignmentPane.setGlobalName(Inter.getLocText("FR-Designer-StyleAlignment_Pane_Vertical")); |
|
|
|
vAlignmentPane.setGlobalName(Inter.getLocText("FR-Designer-StyleAlignment_Pane_Vertical")); |
|
|
|
imageLayoutComboBox.setGlobalName(Inter.getLocText("Image-Image_Layout")); |
|
|
|
imageLayoutComboBox.setGlobalName(Inter.getLocText("FR-Designer_Image_Layout")); |
|
|
|
textComboBox.setGlobalName(Inter.getLocText("StyleAlignment-Text_Style")); |
|
|
|
textComboBox.setGlobalName(Inter.getLocText("FR-Designer_StyleAlignment_Text_Style")); |
|
|
|
textRotationComboBox.setGlobalName(Inter.getLocText("StyleAlignment-Text_Rotation")); |
|
|
|
textRotationComboBox.setGlobalName(Inter.getLocText("FR-Designer_StyleAlignment_Text_Rotation")); |
|
|
|
rotationPane.setGlobalName(Inter.getLocText("StyleAlignment-Text_Rotation")); |
|
|
|
rotationPane.setGlobalName(Inter.getLocText("FR-Designer_StyleAlignment_Text_Rotation")); |
|
|
|
leftIndentSpinner.setGlobalName(Inter.getLocText("Style-Left_Indent")); |
|
|
|
leftIndentSpinner.setGlobalName(Inter.getLocText("FR-Designer_Style_Left_Indent")); |
|
|
|
rightIndentSpinner.setGlobalName(Inter.getLocText("Style-Right_Indent")); |
|
|
|
rightIndentSpinner.setGlobalName(Inter.getLocText("FR-Designer_Style_Right_Indent")); |
|
|
|
spaceBeforeSpinner.setGlobalName(Inter.getLocText("Style-Spacing_Before")); |
|
|
|
spaceBeforeSpinner.setGlobalName(Inter.getLocText("FR-Designer_Style_Spacing_Before")); |
|
|
|
spaceAfterSpinner.setGlobalName(Inter.getLocText("Style-Spacing_After")); |
|
|
|
spaceAfterSpinner.setGlobalName(Inter.getLocText("FR-Designer_Style_Spacing_After")); |
|
|
|
lineSpaceSpinner.setGlobalName(Inter.getLocText("Style-Line_Spacing")); |
|
|
|
lineSpaceSpinner.setGlobalName(Inter.getLocText("FR-Designer_Style_Line_Spacing")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JPanel createPane() { |
|
|
|
private JPanel createPane() { |
|
|
|
JPanel jp1 = new JPanel(new BorderLayout()); |
|
|
|
JPanel jp1 = new JPanel(new BorderLayout(0, 10)); |
|
|
|
basicPane = new JPanel(); |
|
|
|
JPanel jp2 = new JPanel(new BorderLayout(0, 10)); |
|
|
|
seniorPane = new JPanel(); |
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
basicPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), 290, 20, basicPane()); |
|
|
|
double f = TableLayout.FILL; |
|
|
|
seniorPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 290, 20, seniorPane()); |
|
|
|
double[] columnSize1 = {p, f}; |
|
|
|
|
|
|
|
double[] rowSize1 = {p, p, p, p, p, p, p, p, p, p, p, p, p, p}; |
|
|
|
jp1.add(basicPane, BorderLayout.NORTH); |
|
|
|
Component[][] components1 = new Component[][]{ |
|
|
|
jp1.add(seniorPane, BorderLayout.CENTER); |
|
|
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer-StyleAlignment_Pane_Style")), null}, |
|
|
|
|
|
|
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer-StyleAlignment_Pane_Horizontal") + ":", UILabel.RIGHT), hPaneContainer}, |
|
|
|
return jp1; |
|
|
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer-StyleAlignment_Pane_Vertical") + ":", UILabel.RIGHT), vPaneContainer}, |
|
|
|
} |
|
|
|
new Component[]{new JSeparator(JSeparator.HORIZONTAL), null}, |
|
|
|
|
|
|
|
new Component[]{new UILabel(Inter.getLocText("Image-Image_Layout")), null}, |
|
|
|
private JPanel basicPane() { |
|
|
|
new Component[]{imageLayoutComboBox, null}, |
|
|
|
double f = TableLayout.FILL; |
|
|
|
new Component[]{new JSeparator(JSeparator.HORIZONTAL), null}, |
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
new Component[]{new UILabel(Inter.getLocText("StyleAlignment-Text_Style")), null}, |
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
new Component[]{textComboBox, null}, |
|
|
|
new Component[]{null, null}, |
|
|
|
new Component[]{new JSeparator(JSeparator.HORIZONTAL), null}, |
|
|
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer-StyleAlignment_Pane_Horizontal") + " ", SwingConstants.LEFT), hPaneContainer}, |
|
|
|
new Component[]{new UILabel(Inter.getLocText("StyleAlignment-Text_Rotation")), null}, |
|
|
|
new Component[]{null, null}, |
|
|
|
new Component[]{textRotationComboBox, null}, |
|
|
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer-StyleAlignment_Pane_Vertical") + " ", SwingConstants.RIGHT), vPaneContainer}, |
|
|
|
new Component[]{rotationBarCC, null}, |
|
|
|
new Component[]{null, null} |
|
|
|
new Component[]{new JSeparator(JSeparator.HORIZONTAL), null}, |
|
|
|
}; |
|
|
|
}; |
|
|
|
double[] rowSize = {p, p, p, p, p, p}; |
|
|
|
|
|
|
|
double[] columnSize = {p, f}; |
|
|
|
double[] columnSize2 = {p, f}; |
|
|
|
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; |
|
|
|
double[] rowSize2 = {p, p, p, p}; |
|
|
|
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); |
|
|
|
Component[][] components2 = new Component[][]{ |
|
|
|
} |
|
|
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer-StyleAlignment_Style_Indentation")), null}, |
|
|
|
|
|
|
|
new Component[]{new UILabel(Inter.getLocText("Style-Left_Indent") + ":", SwingConstants.RIGHT), creatSpinnerPane(leftIndentSpinner)}, |
|
|
|
private JPanel seniorPane() { |
|
|
|
new Component[]{new UILabel(Inter.getLocText("Style-Right_Indent") + ":", SwingConstants.RIGHT), creatSpinnerPane(rightIndentSpinner)}, |
|
|
|
JPanel senPane = new JPanel(new BorderLayout()); |
|
|
|
new Component[]{new JSeparator(JSeparator.HORIZONTAL), null}, |
|
|
|
double f = TableLayout.FILL; |
|
|
|
}; |
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
double[] columnSize3 = {p, f}; |
|
|
|
new Component[]{null, null}, |
|
|
|
double[] rowSize3 = {p, p, p, p}; |
|
|
|
new Component[]{new UILabel((Inter.getLocText("FR-Designer_Image_Layout")) + " ", SwingConstants.LEFT), imageLayoutComboBox}, |
|
|
|
Component[][] components3 = new Component[][]{ |
|
|
|
new Component[]{null, null}, |
|
|
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer-StyleAlignment_Style_Spacing")), null}, |
|
|
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer_StyleAlignment_Text_Style") + " ", SwingConstants.LEFT), textComboBox}, |
|
|
|
new Component[]{new UILabel(Inter.getLocText("Style-Spacing_Before") + ":", SwingConstants.RIGHT), creatSpinnerPane(spaceBeforeSpinner)}, |
|
|
|
new Component[]{null, null}, |
|
|
|
new Component[]{new UILabel(Inter.getLocText("Style-Spacing_After") + ":", SwingConstants.RIGHT), creatSpinnerPane(spaceAfterSpinner)}, |
|
|
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer_StyleAlignment_Text_Rotation") + " ", SwingConstants.LEFT), textRotationComboBox}, |
|
|
|
new Component[]{new UILabel(Inter.getLocText("Style-Line_Spacing") + ":", SwingConstants.RIGHT), creatSpinnerPane(lineSpaceSpinner)}, |
|
|
|
new Component[]{null, rotationBarCC}, |
|
|
|
}; |
|
|
|
new Component[]{null, null}, |
|
|
|
JPanel northPane = TableLayoutHelper.createTableLayoutPane(components1, rowSize1, columnSize1); |
|
|
|
}; |
|
|
|
JPanel centerPane = TableLayoutHelper.createTableLayoutPane(components2, rowSize2, columnSize2); |
|
|
|
double[] rowSize = {p, p, p, p, p, p, p, p}; |
|
|
|
JPanel southPane = TableLayoutHelper.createTableLayoutPane(components3, rowSize3, columnSize3); |
|
|
|
double[] columnSize = {p, f}; |
|
|
|
|
|
|
|
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; |
|
|
|
jp2.add(centerPane, BorderLayout.NORTH); |
|
|
|
JPanel tempPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); |
|
|
|
jp2.add(southPane, BorderLayout.CENTER); |
|
|
|
senPane.add(tempPane, BorderLayout.NORTH); |
|
|
|
jp1.add(northPane, BorderLayout.NORTH); |
|
|
|
senPane.add(seniorDownPane(), BorderLayout.CENTER); |
|
|
|
jp1.add(jp2, BorderLayout.CENTER); |
|
|
|
return senPane; |
|
|
|
return jp1; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private JPanel creatSpinnerPane(Component comp) { |
|
|
|
private JPanel seniorDownPane() { |
|
|
|
JPanel jp = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); |
|
|
|
double f = TableLayout.FILL; |
|
|
|
jp.add(comp); |
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
return jp; |
|
|
|
leftIndentSpinner.setPreferredSize(SPINNER_DIMENSION); |
|
|
|
} |
|
|
|
rightIndentSpinner.setPreferredSize(SPINNER_DIMENSION); |
|
|
|
|
|
|
|
spaceBeforeSpinner.setPreferredSize(SPINNER_DIMENSION); |
|
|
|
/** |
|
|
|
spaceAfterSpinner.setPreferredSize(SPINNER_DIMENSION); |
|
|
|
* 标题 |
|
|
|
lineSpaceSpinner.setPreferredSize(SPINNER_DIMENSION); |
|
|
|
* @return 标题 |
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
*/ |
|
|
|
new Component[]{null, null, null}, |
|
|
|
public String title4PopupWindow() { |
|
|
|
new Component[]{new UILabel((Inter.getLocText("FR-Designer-StyleAlignment_Style_Indentation")) + " ", SwingConstants.LEFT), creatSpinnerPane(leftIndentSpinner), creatSpinnerPane(rightIndentSpinner)}, |
|
|
|
return Inter.getLocText("FR-Designer-StyleAlignment_Style_Alignment"); |
|
|
|
new Component[]{null, new UILabel((Inter.getLocText("FR-Designer_Left")), SwingConstants.CENTER), new UILabel((Inter.getLocText("FR-Designer_Right")), SwingConstants.CENTER)}, |
|
|
|
} |
|
|
|
new Component[]{new UILabel((Inter.getLocText("FR-Designer-StyleAlignment_Style_PartSpacing")) + " ", SwingConstants.LEFT), creatSpinnerPane(spaceBeforeSpinner), creatSpinnerPane(spaceAfterSpinner)}, |
|
|
|
|
|
|
|
new Component[]{null, new UILabel((Inter.getLocText("FR-Designer_Front")), SwingConstants.CENTER), new UILabel((Inter.getLocText("FR-Designer_Behind")), SwingConstants.CENTER)}, |
|
|
|
/** |
|
|
|
new Component[]{new UILabel((Inter.getLocText("FR-Designer_Style_Line_Spacing")) + " ", SwingConstants.LEFT), creatSpinnerPane(lineSpaceSpinner), null}, |
|
|
|
* Populate cellstyle border. |
|
|
|
}; |
|
|
|
* |
|
|
|
double[] rowSize = {p, p, p, p, p, p}; |
|
|
|
* @param style the new style. |
|
|
|
double[] columnSize = {p, f, f}; |
|
|
|
*/ |
|
|
|
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
|
|
|
public void populateBean(Style style) { |
|
|
|
} |
|
|
|
hAlignmentPane.setSelectedItem(BaseUtils.getAlignment4Horizontal(style)); |
|
|
|
|
|
|
|
vAlignmentPane.setSelectedItem(style.getVerticalAlignment()); |
|
|
|
private JPanel creatSpinnerPane(Component comp) { |
|
|
|
|
|
|
|
JPanel jp = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); |
|
|
|
if (style.getTextStyle() == Style.TEXTSTYLE_SINGLELINE) { |
|
|
|
jp.add(comp); |
|
|
|
this.textComboBox.setSelectedIndex(1); |
|
|
|
return jp; |
|
|
|
} else if (style.getTextStyle() == Style.TEXTSTYLE_SINGLELINEADJUSTFONT) { |
|
|
|
} |
|
|
|
this.textComboBox.setSelectedIndex(2); |
|
|
|
|
|
|
|
} else if (style.getTextStyle() == Style.TEXTSTYLE_MULTILINEADJUSTFONT) { |
|
|
|
/** |
|
|
|
this.textComboBox.setSelectedIndex(3); |
|
|
|
* 标题 |
|
|
|
} else { |
|
|
|
* |
|
|
|
this.textComboBox.setSelectedIndex(0); |
|
|
|
* @return 标题 |
|
|
|
} |
|
|
|
*/ |
|
|
|
if (style.getVerticalText() == Style.VERTICALTEXT) { |
|
|
|
public String title4PopupWindow() { |
|
|
|
textRotationComboBox.setSelectedIndex(style.getTextDirection() == Style.LEFT_TO_RIGHT ? 1 : 2); |
|
|
|
return Inter.getLocText("FR-Designer-StyleAlignment_Style_Alignment"); |
|
|
|
} else { |
|
|
|
} |
|
|
|
textRotationComboBox.setSelectedIndex(0); |
|
|
|
|
|
|
|
rotationPane.populateBean((double) style.getRotation()); |
|
|
|
/** |
|
|
|
} |
|
|
|
* Populate cellstyle border. |
|
|
|
|
|
|
|
|
|
|
|
if (style.getImageLayout() == Constants.IMAGE_TILED) { |
|
|
|
|
|
|
|
imageLayoutComboBox.setSelectedIndex(1); |
|
|
|
|
|
|
|
} else if (style.getImageLayout() == Constants.IMAGE_EXTEND) { |
|
|
|
|
|
|
|
imageLayoutComboBox.setSelectedIndex(2); |
|
|
|
|
|
|
|
} else if (style.getImageLayout() == Constants.IMAGE_ADJUST) { |
|
|
|
|
|
|
|
imageLayoutComboBox.setSelectedIndex(3); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
imageLayoutComboBox.setSelectedIndex(0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int leftPadding = indentationUnitProcessor.paddingUnitProcessor(style.getPaddingLeft()); |
|
|
|
|
|
|
|
int rightPadding = indentationUnitProcessor.paddingUnitProcessor(style.getPaddingRight()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// alex:indent
|
|
|
|
|
|
|
|
this.leftIndentSpinner.setValue(new Integer(leftPadding)); |
|
|
|
|
|
|
|
this.rightIndentSpinner.setValue(new Integer(rightPadding)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.spaceBeforeSpinner.setValue(style.getSpacingBefore()); |
|
|
|
|
|
|
|
this.spaceAfterSpinner.setValue(style.getSpacingAfter()); |
|
|
|
|
|
|
|
this.lineSpaceSpinner.setValue(style.getLineSpacing()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Update cellstyle border |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param style the new style. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public Style update(Style style) { |
|
|
|
|
|
|
|
// peter:需要判断传递进来的值是否为null.
|
|
|
|
|
|
|
|
if (style == null) { |
|
|
|
|
|
|
|
return style; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer-StyleAlignment_Pane_Horizontal"))) { |
|
|
|
|
|
|
|
Integer h = this.hAlignmentPane.getSelectedItem(); |
|
|
|
|
|
|
|
style = style.deriveHorizontalAlignment(h == null ? -1 : h); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer-StyleAlignment_Pane_Vertical"))) { |
|
|
|
|
|
|
|
Integer vAlign = this.vAlignmentPane.getSelectedItem(); |
|
|
|
|
|
|
|
if (vAlign != null) { |
|
|
|
|
|
|
|
style = style.deriveVerticalAlignment(vAlign); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("StyleAlignment-Text_Style"))) { |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(this.textComboBox.getSelectedItem(), TEXT[0])) { |
|
|
|
|
|
|
|
style = style.deriveTextStyle(Style.TEXTSTYLE_WRAPTEXT); |
|
|
|
|
|
|
|
} else if (ComparatorUtils.equals(this.textComboBox.getSelectedItem(), TEXT[1])) { |
|
|
|
|
|
|
|
style = style.deriveTextStyle(Style.TEXTSTYLE_SINGLELINE); |
|
|
|
|
|
|
|
} else if (ComparatorUtils.equals(this.textComboBox.getSelectedItem(), TEXT[2])) { |
|
|
|
|
|
|
|
style = style.deriveTextStyle(Style.TEXTSTYLE_SINGLELINEADJUSTFONT); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
style = style.deriveTextStyle(Style.TEXTSTYLE_MULTILINEADJUSTFONT); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
style = updateImageLayout(style); |
|
|
|
|
|
|
|
style = updateTextRotation(style); |
|
|
|
|
|
|
|
style = updateOther(style); |
|
|
|
|
|
|
|
return style; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Style updateImageLayout(Style style) { |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("Image-Image_Layout"))) { |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(this.imageLayoutComboBox.getSelectedItem(), LAYOUT[1])) { |
|
|
|
|
|
|
|
style = style.deriveImageLayout(Constants.IMAGE_TILED); |
|
|
|
|
|
|
|
} else if (ComparatorUtils.equals(this.imageLayoutComboBox.getSelectedItem(), LAYOUT[2])) { |
|
|
|
|
|
|
|
style = style.deriveImageLayout(Constants.IMAGE_EXTEND); |
|
|
|
|
|
|
|
} else if (ComparatorUtils.equals(this.imageLayoutComboBox.getSelectedItem(), LAYOUT[3])) { |
|
|
|
|
|
|
|
style = style.deriveImageLayout(Constants.IMAGE_ADJUST); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
style = style.deriveImageLayout(Constants.IMAGE_CENTER); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return style; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Style updateTextRotation(Style style) { |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("StyleAlignment-Text_Rotation"))) { |
|
|
|
|
|
|
|
if (this.textRotationComboBox.getSelectedIndex() != 0) { |
|
|
|
|
|
|
|
style = style.deriveVerticalText(Style.VERTICALTEXT); |
|
|
|
|
|
|
|
style = style.deriveRotation(0); |
|
|
|
|
|
|
|
style = style.deriveTextDirection(this.textRotationComboBox.getSelectedIndex() == 1 ? Style.LEFT_TO_RIGHT : Style.RIGHT_TO_LEFT); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
style = style.deriveVerticalText(Style.HORIZONTALTEXT); |
|
|
|
|
|
|
|
style = style.deriveRotation(rotationPane.updateBean().intValue()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return style; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Style updateOther(Style style) { |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("Style-Left_Indent"))) { |
|
|
|
|
|
|
|
style = style.derivePaddingLeft(indentationUnitProcessor.paddingUnitGainFromSpinner((int)(this.leftIndentSpinner.getValue()))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("Style-Right_Indent"))) { |
|
|
|
|
|
|
|
style = style.derivePaddingRight(indentationUnitProcessor.paddingUnitGainFromSpinner((int)(this.rightIndentSpinner.getValue()))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//间距
|
|
|
|
|
|
|
|
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("Style-Spacing_Before"))) { |
|
|
|
|
|
|
|
style = style.deriveSpacingBefore((int) (this.spaceBeforeSpinner.getValue())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("Style-Spacing_After"))) { |
|
|
|
|
|
|
|
style = style.deriveSpacingAfter((int) (this.spaceAfterSpinner.getValue())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("Style-Line_Spacing"))) { |
|
|
|
|
|
|
|
style = style.deriveLineSpacing((int) (this.lineSpaceSpinner.getValue())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return style; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 注册监听事件 |
|
|
|
|
|
|
|
* |
|
|
|
* |
|
|
|
* @param listener 观察者监听事件 |
|
|
|
* @param style the new style. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void registerNameListener(GlobalNameListener listener) { |
|
|
|
public void populateBean(Style style) { |
|
|
|
globalNameListener = listener; |
|
|
|
hAlignmentPane.setSelectedItem(BaseUtils.getAlignment4Horizontal(style)); |
|
|
|
} |
|
|
|
vAlignmentPane.setSelectedItem(style.getVerticalAlignment()); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
if (style.getTextStyle() == Style.TEXTSTYLE_SINGLELINE) { |
|
|
|
* 是否响应监听 |
|
|
|
this.textComboBox.setSelectedIndex(1); |
|
|
|
* |
|
|
|
} else if (style.getTextStyle() == Style.TEXTSTYLE_SINGLELINEADJUSTFONT) { |
|
|
|
* @return 否 |
|
|
|
this.textComboBox.setSelectedIndex(2); |
|
|
|
*/ |
|
|
|
} else if (style.getTextStyle() == Style.TEXTSTYLE_MULTILINEADJUSTFONT) { |
|
|
|
public boolean shouldResponseNameListener() { |
|
|
|
this.textComboBox.setSelectedIndex(3); |
|
|
|
return false; |
|
|
|
} else { |
|
|
|
} |
|
|
|
this.textComboBox.setSelectedIndex(0); |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
if (style.getVerticalText() == Style.VERTICALTEXT) { |
|
|
|
* |
|
|
|
textRotationComboBox.setSelectedIndex(style.getTextDirection() == Style.LEFT_TO_RIGHT ? 1 : 2); |
|
|
|
* @param name |
|
|
|
} else { |
|
|
|
*/ |
|
|
|
textRotationComboBox.setSelectedIndex(0); |
|
|
|
public void setGlobalName(String name) { |
|
|
|
rotationPane.populateBean((double) style.getRotation()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (style.getImageLayout() == Constants.IMAGE_TILED) { |
|
|
|
|
|
|
|
imageLayoutComboBox.setSelectedIndex(1); |
|
|
|
|
|
|
|
} else if (style.getImageLayout() == Constants.IMAGE_EXTEND) { |
|
|
|
|
|
|
|
imageLayoutComboBox.setSelectedIndex(2); |
|
|
|
|
|
|
|
} else if (style.getImageLayout() == Constants.IMAGE_ADJUST) { |
|
|
|
|
|
|
|
imageLayoutComboBox.setSelectedIndex(3); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
imageLayoutComboBox.setSelectedIndex(0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int leftPadding = indentationUnitProcessor.paddingUnitProcessor(style.getPaddingLeft()); |
|
|
|
|
|
|
|
int rightPadding = indentationUnitProcessor.paddingUnitProcessor(style.getPaddingRight()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// alex:indent
|
|
|
|
|
|
|
|
this.leftIndentSpinner.setValue(new Integer(leftPadding)); |
|
|
|
|
|
|
|
this.rightIndentSpinner.setValue(new Integer(rightPadding)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.spaceBeforeSpinner.setValue(style.getSpacingBefore()); |
|
|
|
|
|
|
|
this.spaceAfterSpinner.setValue(style.getSpacingAfter()); |
|
|
|
|
|
|
|
this.lineSpaceSpinner.setValue(style.getLineSpacing()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Update cellstyle border |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param style the new style. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public Style update(Style style) { |
|
|
|
|
|
|
|
// peter:需要判断传递进来的值是否为null.
|
|
|
|
|
|
|
|
if (style == null) { |
|
|
|
|
|
|
|
return style; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer-StyleAlignment_Pane_Horizontal"))) { |
|
|
|
|
|
|
|
Integer h = this.hAlignmentPane.getSelectedItem(); |
|
|
|
|
|
|
|
style = style.deriveHorizontalAlignment(h == null ? -1 : h); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer-StyleAlignment_Pane_Vertical"))) { |
|
|
|
|
|
|
|
Integer vAlign = this.vAlignmentPane.getSelectedItem(); |
|
|
|
|
|
|
|
if (vAlign != null) { |
|
|
|
|
|
|
|
style = style.deriveVerticalAlignment(vAlign); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_StyleAlignment_Text_Style"))) { |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(this.textComboBox.getSelectedItem(), TEXT[0])) { |
|
|
|
|
|
|
|
style = style.deriveTextStyle(Style.TEXTSTYLE_WRAPTEXT); |
|
|
|
|
|
|
|
} else if (ComparatorUtils.equals(this.textComboBox.getSelectedItem(), TEXT[1])) { |
|
|
|
|
|
|
|
style = style.deriveTextStyle(Style.TEXTSTYLE_SINGLELINE); |
|
|
|
|
|
|
|
} else if (ComparatorUtils.equals(this.textComboBox.getSelectedItem(), TEXT[2])) { |
|
|
|
|
|
|
|
style = style.deriveTextStyle(Style.TEXTSTYLE_SINGLELINEADJUSTFONT); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
style = style.deriveTextStyle(Style.TEXTSTYLE_MULTILINEADJUSTFONT); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
style = updateImageLayout(style); |
|
|
|
|
|
|
|
style = updateTextRotation(style); |
|
|
|
|
|
|
|
style = updateOther(style); |
|
|
|
|
|
|
|
return style; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Style updateImageLayout(Style style) { |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_Image_Layout"))) { |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(this.imageLayoutComboBox.getSelectedItem(), LAYOUT[1])) { |
|
|
|
|
|
|
|
style = style.deriveImageLayout(Constants.IMAGE_TILED); |
|
|
|
|
|
|
|
} else if (ComparatorUtils.equals(this.imageLayoutComboBox.getSelectedItem(), LAYOUT[2])) { |
|
|
|
|
|
|
|
style = style.deriveImageLayout(Constants.IMAGE_EXTEND); |
|
|
|
|
|
|
|
} else if (ComparatorUtils.equals(this.imageLayoutComboBox.getSelectedItem(), LAYOUT[3])) { |
|
|
|
|
|
|
|
style = style.deriveImageLayout(Constants.IMAGE_ADJUST); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
style = style.deriveImageLayout(Constants.IMAGE_CENTER); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return style; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Style updateTextRotation(Style style) { |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_StyleAlignment_Text_Rotation"))) { |
|
|
|
|
|
|
|
if (this.textRotationComboBox.getSelectedIndex() != 0) { |
|
|
|
|
|
|
|
style = style.deriveVerticalText(Style.VERTICALTEXT); |
|
|
|
|
|
|
|
style = style.deriveRotation(0); |
|
|
|
|
|
|
|
style = style.deriveTextDirection(this.textRotationComboBox.getSelectedIndex() == 1 ? Style.LEFT_TO_RIGHT : Style.RIGHT_TO_LEFT); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
style = style.deriveVerticalText(Style.HORIZONTALTEXT); |
|
|
|
|
|
|
|
style = style.deriveRotation(rotationPane.updateBean().intValue()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return style; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Style updateOther(Style style) { |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_Style_Left_Indent"))) { |
|
|
|
|
|
|
|
style = style.derivePaddingLeft(indentationUnitProcessor.paddingUnitGainFromSpinner((int) (this.leftIndentSpinner.getValue()))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_Style_Right_Indent"))) { |
|
|
|
|
|
|
|
style = style.derivePaddingRight(indentationUnitProcessor.paddingUnitGainFromSpinner((int) (this.rightIndentSpinner.getValue()))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//间距
|
|
|
|
|
|
|
|
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_Style_Spacing_Before"))) { |
|
|
|
|
|
|
|
style = style.deriveSpacingBefore((int) (this.spaceBeforeSpinner.getValue())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_Style_Spacing_After"))) { |
|
|
|
|
|
|
|
style = style.deriveSpacingAfter((int) (this.spaceAfterSpinner.getValue())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_Style_Line_Spacing"))) { |
|
|
|
|
|
|
|
style = style.deriveLineSpacing((int) (this.lineSpaceSpinner.getValue())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return style; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 注册监听事件 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param listener 观察者监听事件 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void registerNameListener(GlobalNameListener listener) { |
|
|
|
|
|
|
|
globalNameListener = listener; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 是否响应监听 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return 否 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public boolean shouldResponseNameListener() { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @param name |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void setGlobalName(String name) { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |