|
|
@ -4,7 +4,6 @@ package com.fr.design.gui.style; |
|
|
|
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
|
|
|
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
|
|
|
|
import com.fr.base.CellBorderStyle; |
|
|
|
import com.fr.base.CellBorderStyle; |
|
|
|
import com.fr.base.Style; |
|
|
|
import com.fr.base.Style; |
|
|
|
import com.fr.design.constants.LayoutConstants; |
|
|
|
import com.fr.design.constants.LayoutConstants; |
|
|
@ -17,14 +16,20 @@ import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
import com.fr.design.style.color.NewColorSelectBox; |
|
|
|
import com.fr.design.style.color.NewColorSelectBox; |
|
|
|
|
|
|
|
import com.fr.general.IOUtils; |
|
|
|
import com.fr.stable.Constants; |
|
|
|
import com.fr.stable.Constants; |
|
|
|
import com.fr.stable.CoreConstants; |
|
|
|
import com.fr.stable.CoreConstants; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.Icon; |
|
|
|
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
|
|
|
import javax.swing.SwingConstants; |
|
|
|
import javax.swing.event.ChangeEvent; |
|
|
|
import javax.swing.event.ChangeEvent; |
|
|
|
import javax.swing.event.ChangeListener; |
|
|
|
import javax.swing.event.ChangeListener; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
|
|
|
import java.awt.Color; |
|
|
|
|
|
|
|
import java.awt.Component; |
|
|
|
|
|
|
|
import java.awt.Dimension; |
|
|
|
|
|
|
|
import java.awt.GridLayout; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.HashSet; |
|
|
|
import java.util.HashSet; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.Set; |
|
|
@ -38,7 +43,6 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse |
|
|
|
private static final String[] BORDERARRAY = {"currentLineCombo", "currentLineColorPane", "outerToggleButton", "topToggleButton", |
|
|
|
private static final String[] BORDERARRAY = {"currentLineCombo", "currentLineColorPane", "outerToggleButton", "topToggleButton", |
|
|
|
"leftToggleButton", "bottomToggleButton", "rightToggleButton", "innerToggleButton", "horizontalToggleButton", "verticalToggleButton"}; |
|
|
|
"leftToggleButton", "bottomToggleButton", "rightToggleButton", "innerToggleButton", "horizontalToggleButton", "verticalToggleButton"}; |
|
|
|
private static final Set<String> BORDER_SET = new HashSet<>(Arrays.asList(BORDERARRAY)); |
|
|
|
private static final Set<String> BORDER_SET = new HashSet<>(Arrays.asList(BORDERARRAY)); |
|
|
|
private boolean insideMode = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private UIToggleButton topToggleButton; |
|
|
|
private UIToggleButton topToggleButton; |
|
|
|
private UIToggleButton horizontalToggleButton; |
|
|
|
private UIToggleButton horizontalToggleButton; |
|
|
@ -50,11 +54,8 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse |
|
|
|
private UIToggleButton innerToggleButton; |
|
|
|
private UIToggleButton innerToggleButton; |
|
|
|
private UIToggleButton outerToggleButton; |
|
|
|
private UIToggleButton outerToggleButton; |
|
|
|
|
|
|
|
|
|
|
|
private LineComboBox currentLineCombo; |
|
|
|
protected LineComboBox currentLineCombo; |
|
|
|
private NewColorSelectBox currentLineColorPane; |
|
|
|
protected NewColorSelectBox currentLineColorPane; |
|
|
|
private JPanel panel; |
|
|
|
|
|
|
|
private JPanel borderPanel; |
|
|
|
|
|
|
|
private JPanel backgroundPanel; |
|
|
|
|
|
|
|
private BackgroundPane backgroundPane; |
|
|
|
private BackgroundPane backgroundPane; |
|
|
|
private GlobalNameListener globalNameListener = null; |
|
|
|
private GlobalNameListener globalNameListener = null; |
|
|
|
|
|
|
|
|
|
|
@ -81,18 +82,18 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse |
|
|
|
new Component[]{null, null}, |
|
|
|
new Component[]{null, null}, |
|
|
|
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Color") + " ", SwingConstants.LEFT), currentLineColorPane}, |
|
|
|
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Color") + " ", SwingConstants.LEFT), currentLineColorPane}, |
|
|
|
new Component[]{null, null}, |
|
|
|
new Component[]{null, null}, |
|
|
|
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Out_Border") + " ", SwingConstants.LEFT), outerToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("com/fr/design/images/m_format/out.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/out_white.png")}, false)}, |
|
|
|
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Out_Border") + " ", SwingConstants.LEFT), outerToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("com/fr/design/images/m_format/out.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/out_white.png")}, false)}, |
|
|
|
new Component[]{null, externalPane}, |
|
|
|
new Component[]{null, externalPane}, |
|
|
|
new Component[]{null, null}, |
|
|
|
new Component[]{null, null}, |
|
|
|
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_In_Border") + " ", SwingConstants.LEFT), innerToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("com/fr/design/images/m_format/in.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/in_white.png")}, false)}, |
|
|
|
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_In_Border") + " ", SwingConstants.LEFT), innerToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("com/fr/design/images/m_format/in.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/in_white.png")}, false)}, |
|
|
|
new Component[]{null, insidePane}, |
|
|
|
new Component[]{null, insidePane}, |
|
|
|
new Component[]{null, null} |
|
|
|
new Component[]{null, null} |
|
|
|
}; |
|
|
|
}; |
|
|
|
double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p}; |
|
|
|
double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p}; |
|
|
|
double[] columnSize = {p, f}; |
|
|
|
double[] columnSize = {p, f}; |
|
|
|
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; |
|
|
|
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; |
|
|
|
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); |
|
|
|
borderPanel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Border"), 280, 24, panel); |
|
|
|
JPanel borderPanel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Border"), 280, 24, panel); |
|
|
|
this.add(borderPanel, BorderLayout.NORTH); |
|
|
|
this.add(borderPanel, BorderLayout.NORTH); |
|
|
|
|
|
|
|
|
|
|
|
UILabel backgroundFillLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Background_Fill")); |
|
|
|
UILabel backgroundFillLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Background_Fill")); |
|
|
@ -102,7 +103,7 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse |
|
|
|
JPanel backgroundContainPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{backgroundFillLabel, backgroundPane}}, |
|
|
|
JPanel backgroundContainPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{backgroundFillLabel, backgroundPane}}, |
|
|
|
TableLayoutHelper.FILL_LASTCOLUMN, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM); |
|
|
|
TableLayoutHelper.FILL_LASTCOLUMN, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM); |
|
|
|
|
|
|
|
|
|
|
|
backgroundPanel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"), 280, 24, backgroundContainPane); |
|
|
|
JPanel backgroundPanel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"), 280, 24, backgroundContainPane); |
|
|
|
this.add(backgroundPanel, BorderLayout.CENTER); |
|
|
|
this.add(backgroundPanel, BorderLayout.CENTER); |
|
|
|
initAllNames(); |
|
|
|
initAllNames(); |
|
|
|
outerToggleButton.addChangeListener(outerToggleButtonChangeListener); |
|
|
|
outerToggleButton.addChangeListener(outerToggleButtonChangeListener); |
|
|
@ -130,12 +131,12 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
private void initButtonsWithIcon() { |
|
|
|
private void initButtonsWithIcon() { |
|
|
|
topToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/top.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/top_white.png")}, false); |
|
|
|
topToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/top.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/top_white.png")}, false); |
|
|
|
leftToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/left.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/left_white.png")}, false); |
|
|
|
leftToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/left.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/left_white.png")}, false); |
|
|
|
bottomToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/bottom.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bottom_white.png")}, false); |
|
|
|
bottomToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/bottom.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bottom_white.png")}, false); |
|
|
|
rightToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/right.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/right_white.png")}, false); |
|
|
|
rightToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/right.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/right_white.png")}, false); |
|
|
|
horizontalToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/horizontal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/horizontal_white.png")}, false); |
|
|
|
horizontalToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/horizontal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/horizontal_white.png")}, false); |
|
|
|
verticalToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/vertical.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/vertical_white.png")}, false); |
|
|
|
verticalToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/vertical.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/vertical_white.png")}, false); |
|
|
|
this.currentLineCombo = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY); |
|
|
|
this.currentLineCombo = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY); |
|
|
|
this.currentLineColorPane = new NewColorSelectBox(100); |
|
|
|
this.currentLineColorPane = new NewColorSelectBox(100); |
|
|
|
} |
|
|
|
} |
|
|
@ -174,15 +175,15 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse |
|
|
|
cellBorderStyle.setRightStyle(style.getBorderRight()); |
|
|
|
cellBorderStyle.setRightStyle(style.getBorderRight()); |
|
|
|
cellBorderStyle.setRightColor(style.getBorderRightColor()); |
|
|
|
cellBorderStyle.setRightColor(style.getBorderRightColor()); |
|
|
|
this.backgroundPane.populateBean(style.getBackground()); |
|
|
|
this.backgroundPane.populateBean(style.getBackground()); |
|
|
|
this.populateBean(cellBorderStyle, false, style.getBorderTop(), style.getBorderTopColor()); |
|
|
|
this.populateBean(cellBorderStyle, false); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void populateBean(CellBorderStyle cellBorderStyle, boolean insideMode, int currentStyle, Color currentColor) { |
|
|
|
public void populateBean(CellBorderStyle cellBorderStyle, boolean insideMode) { |
|
|
|
this.insideMode = insideMode; |
|
|
|
populateBean(cellBorderStyle, insideMode, true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getTopStyle() == Constants.LINE_NONE ? Constants.LINE_THIN : cellBorderStyle.getTopStyle()); |
|
|
|
public void populateBean(CellBorderStyle cellBorderStyle, boolean insideMode, boolean onlyInspectTop) { |
|
|
|
this.currentLineColorPane.setSelectObject(cellBorderStyle.getTopColor()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.topToggleButton.setSelected(cellBorderStyle.getTopStyle() != Constants.LINE_NONE); |
|
|
|
this.topToggleButton.setSelected(cellBorderStyle.getTopStyle() != Constants.LINE_NONE); |
|
|
|
this.bottomToggleButton.setSelected(cellBorderStyle.getBottomStyle() != Constants.LINE_NONE); |
|
|
|
this.bottomToggleButton.setSelected(cellBorderStyle.getBottomStyle() != Constants.LINE_NONE); |
|
|
@ -195,9 +196,39 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse |
|
|
|
this.innerToggleButton.setSelected(cellBorderStyle.getInnerBorder() != Constants.LINE_NONE); |
|
|
|
this.innerToggleButton.setSelected(cellBorderStyle.getInnerBorder() != Constants.LINE_NONE); |
|
|
|
this.outerToggleButton.setSelected(cellBorderStyle.getOuterBorderStyle() != Constants.LINE_NONE); |
|
|
|
this.outerToggleButton.setSelected(cellBorderStyle.getOuterBorderStyle() != Constants.LINE_NONE); |
|
|
|
|
|
|
|
|
|
|
|
this.innerToggleButton.setEnabled(this.insideMode); |
|
|
|
this.innerToggleButton.setEnabled(insideMode); |
|
|
|
this.horizontalToggleButton.setEnabled(this.insideMode); |
|
|
|
this.horizontalToggleButton.setEnabled(insideMode); |
|
|
|
this.verticalToggleButton.setEnabled(this.insideMode); |
|
|
|
this.verticalToggleButton.setEnabled(insideMode); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
populateLineStyleAndColor(cellBorderStyle, onlyInspectTop); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void populateLineStyleAndColor(CellBorderStyle cellBorderStyle, boolean onlyInspectTop) { |
|
|
|
|
|
|
|
if (cellBorderStyle.getTopStyle() != Constants.LINE_NONE) { |
|
|
|
|
|
|
|
this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getTopStyle()); |
|
|
|
|
|
|
|
this.currentLineColorPane.setSelectObject(cellBorderStyle.getTopColor()); |
|
|
|
|
|
|
|
} else if (!onlyInspectTop) { |
|
|
|
|
|
|
|
if (cellBorderStyle.getBottomStyle() != Constants.LINE_NONE) { |
|
|
|
|
|
|
|
this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getBottomStyle()); |
|
|
|
|
|
|
|
this.currentLineColorPane.setSelectObject(cellBorderStyle.getBottomColor()); |
|
|
|
|
|
|
|
} else if (cellBorderStyle.getLeftStyle() != Constants.LINE_NONE) { |
|
|
|
|
|
|
|
this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getLeftStyle()); |
|
|
|
|
|
|
|
this.currentLineColorPane.setSelectObject(cellBorderStyle.getLeftColor()); |
|
|
|
|
|
|
|
} else if (cellBorderStyle.getRightStyle() != Constants.LINE_NONE) { |
|
|
|
|
|
|
|
this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getRightStyle()); |
|
|
|
|
|
|
|
this.currentLineColorPane.setSelectObject(cellBorderStyle.getRightColor()); |
|
|
|
|
|
|
|
} else if (cellBorderStyle.getVerticalStyle() != Constants.LINE_NONE) { |
|
|
|
|
|
|
|
this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getVerticalStyle()); |
|
|
|
|
|
|
|
this.currentLineColorPane.setSelectObject(cellBorderStyle.getVerticalColor()); |
|
|
|
|
|
|
|
} else if (cellBorderStyle.getHorizontalStyle() != Constants.LINE_NONE) { |
|
|
|
|
|
|
|
this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getHorizontalStyle()); |
|
|
|
|
|
|
|
this.currentLineColorPane.setSelectObject(cellBorderStyle.getHorizontalColor()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.currentLineCombo.getSelectedLineStyle() == Constants.LINE_NONE) { |
|
|
|
|
|
|
|
this.currentLineCombo.setSelectedLineStyle(Constants.LINE_THIN); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -253,16 +284,8 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse |
|
|
|
} |
|
|
|
} |
|
|
|
cellBorderStyle.setHorizontalStyle(horizontalToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); |
|
|
|
cellBorderStyle.setHorizontalStyle(horizontalToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); |
|
|
|
|
|
|
|
|
|
|
|
if (leftToggleButton.isSelected() && bottomToggleButton.isSelected() && rightToggleButton.isSelected() && topToggleButton.isSelected()) { |
|
|
|
outerToggleButton.setSelected(leftToggleButton.isSelected() && bottomToggleButton.isSelected() && rightToggleButton.isSelected() && topToggleButton.isSelected()); |
|
|
|
outerToggleButton.setSelected(true); |
|
|
|
innerToggleButton.setSelected(verticalToggleButton.isSelected() && horizontalToggleButton.isSelected()); |
|
|
|
} else { |
|
|
|
|
|
|
|
outerToggleButton.setSelected(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (verticalToggleButton.isSelected() && horizontalToggleButton.isSelected()) { |
|
|
|
|
|
|
|
innerToggleButton.setSelected(true); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
innerToggleButton.setSelected(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return cellBorderStyle; |
|
|
|
return cellBorderStyle; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|