* commit '66cebb04cb0161bf388be0c61aa0d9ae38bfb9bb': tmp 图标白色 图标白色 箭头图标 & tab颜色间距 预览按钮回退 & 下拉框回退master
@ -1,111 +1,134 @@ |
|||||||
package com.fr.design.actions.cell.style; |
package com.fr.design.actions.cell.style; |
||||||
|
|
||||||
import javax.swing.Icon; |
|
||||||
|
|
||||||
import com.fr.base.BaseUtils; |
import com.fr.base.BaseUtils; |
||||||
import com.fr.base.Style; |
import com.fr.base.Style; |
||||||
import com.fr.base.chart.BaseChartCollection; |
import com.fr.base.chart.BaseChartCollection; |
||||||
import com.fr.design.constants.UIConstants; |
|
||||||
import com.fr.design.actions.ButtonGroupAction; |
import com.fr.design.actions.ButtonGroupAction; |
||||||
import com.fr.design.actions.utils.ReportActionUtils; |
import com.fr.design.actions.utils.ReportActionUtils; |
||||||
|
import com.fr.design.constants.UIConstants; |
||||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||||
import com.fr.general.Inter; |
import com.fr.design.gui.ibutton.UIToggleButton; |
||||||
import com.fr.design.mainframe.ElementCasePane; |
import com.fr.design.mainframe.ElementCasePane; |
||||||
|
import com.fr.general.Inter; |
||||||
import com.fr.grid.selection.FloatSelection; |
import com.fr.grid.selection.FloatSelection; |
||||||
import com.fr.grid.selection.Selection; |
import com.fr.grid.selection.Selection; |
||||||
import com.fr.report.cell.FloatElement; |
import com.fr.report.cell.FloatElement; |
||||||
import com.fr.report.elementcase.TemplateElementCase; |
import com.fr.report.elementcase.TemplateElementCase; |
||||||
|
import com.fr.stable.Constants; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
|
||||||
|
|
||||||
public class AlignmentAction extends ButtonGroupAction implements StyleActionInterface { |
public class AlignmentAction extends ButtonGroupAction implements StyleActionInterface { |
||||||
|
|
||||||
public AlignmentAction(ElementCasePane t, Icon[] iconArray, |
private static final Icon[] normalBlackIcon = new Icon[]{ |
||||||
Integer[] valueArray) { |
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), |
||||||
super(t, iconArray, valueArray); |
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")}; |
||||||
|
|
||||||
|
private static final Icon[] toggleWhiteIcon = new Icon[]{ |
||||||
/** |
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal_white.png"), |
||||||
* executeStyle |
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal_white.png"), |
||||||
* |
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal_white.png")}; |
||||||
* @param style |
|
||||||
* @param selectedStyle |
private static final Integer[] valueArray = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}; |
||||||
* @return style |
|
||||||
*/ |
public AlignmentAction(ElementCasePane t) { |
||||||
public Style executeStyle(Style style, Style selectedStyle) { |
super(t, normalBlackIcon, valueArray); |
||||||
return style.deriveHorizontalAlignment(getSelectedValue()); |
} |
||||||
} |
|
||||||
|
|
||||||
/** |
/** |
||||||
* 更新Style |
* executeStyle |
||||||
* |
* |
||||||
* @param style style |
* @param style |
||||||
*/ |
* @param selectedStyle |
||||||
public void updateStyle(Style style) { |
* @return style |
||||||
setSelectedIndex(BaseUtils.getAlignment4Horizontal(style)); |
*/ |
||||||
} |
public Style executeStyle(Style style, Style selectedStyle) { |
||||||
|
return style.deriveHorizontalAlignment(getSelectedValue()); |
||||||
/** |
} |
||||||
* executeActionReturnUndoRecordNeeded |
|
||||||
* |
/** |
||||||
* @return |
* 更新Style |
||||||
*/ |
* |
||||||
public boolean executeActionReturnUndoRecordNeeded() { |
* @param style style |
||||||
ElementCasePane reportPane = this.getEditingComponent(); |
*/ |
||||||
if (reportPane == null) { |
public void updateStyle(Style style) { |
||||||
return false; |
UIButtonGroup<Integer> buttonGroup = createToolBarComponent(); |
||||||
} |
int selected = BaseUtils.getAlignment4Horizontal(style); |
||||||
|
for (int i = 0; i < normalBlackIcon.length; i++) { |
||||||
return ReportActionUtils.executeAction(this, reportPane); |
UIToggleButton button = buttonGroup.getButton(i); |
||||||
} |
Icon currentIcon = button.getIcon(); |
||||||
|
Icon newIcon = selected == valueArray[i] ? toggleWhiteIcon[i] : normalBlackIcon[i]; |
||||||
/** |
if (newIcon != currentIcon) { |
||||||
* update |
button.setIcon(newIcon); |
||||||
*/ |
} |
||||||
public void update() { |
} |
||||||
super.update(); |
setSelectedIndex(selected); |
||||||
|
} |
||||||
//peter:如果当前没有ReportFrame,不需要继续.
|
|
||||||
if (!this.isEnabled()) { |
/** |
||||||
return; |
* executeActionReturnUndoRecordNeeded |
||||||
} |
* |
||||||
|
* @return |
||||||
//got simple cell element from row and column
|
*/ |
||||||
ElementCasePane reportPane = this.getEditingComponent(); |
public boolean executeActionReturnUndoRecordNeeded() { |
||||||
if (reportPane == null) { |
ElementCasePane reportPane = this.getEditingComponent(); |
||||||
this.setEnabled(false); |
if (reportPane == null) { |
||||||
return; |
return false; |
||||||
} |
} |
||||||
Selection cs = reportPane.getSelection(); |
|
||||||
TemplateElementCase tplEC = reportPane.getEditingElementCase(); |
return ReportActionUtils.executeAction(this, reportPane); |
||||||
|
} |
||||||
if (tplEC != null && cs instanceof FloatSelection) { |
|
||||||
FloatElement selectedFloat = tplEC.getFloatElement(((FloatSelection) cs).getSelectedFloatName()); |
/** |
||||||
Object value = selectedFloat.getValue(); |
* update |
||||||
if (value instanceof BaseChartCollection) { |
*/ |
||||||
this.setEnabled(false); |
public void update() { |
||||||
return; |
super.update(); |
||||||
} |
|
||||||
} |
//peter:如果当前没有ReportFrame,不需要继续.
|
||||||
this.updateStyle(ReportActionUtils.getCurrentStyle(reportPane)); |
if (!this.isEnabled()) { |
||||||
} |
return; |
||||||
|
} |
||||||
/** |
|
||||||
* 创建工具条,且有提示 |
//got simple cell element from row and column
|
||||||
* |
ElementCasePane reportPane = this.getEditingComponent(); |
||||||
* @return |
if (reportPane == null) { |
||||||
*/ |
this.setEnabled(false); |
||||||
public UIButtonGroup<Integer> createToolBarComponent() { |
return; |
||||||
UIButtonGroup<Integer> group = super.createToolBarComponent(); |
} |
||||||
if (group != null) { |
Selection cs = reportPane.getSelection(); |
||||||
group.setForToolBarButtonGroup(true); |
TemplateElementCase tplEC = reportPane.getEditingElementCase(); |
||||||
group.setAllToolTips(new String[]{Inter.getLocText("StyleAlignment-Left"), Inter.getLocText("Center"), Inter.getLocText("StyleAlignment-Right")}); |
|
||||||
} |
if (tplEC != null && cs instanceof FloatSelection) { |
||||||
for (int i = 0; i < 3; i++) { |
FloatElement selectedFloat = tplEC.getFloatElement(((FloatSelection) cs).getSelectedFloatName()); |
||||||
group.getButton(i).setRoundBorder(true, UIConstants.ARC); |
Object value = selectedFloat.getValue(); |
||||||
group.getButton(i).setBorderPainted(true); |
if (value instanceof BaseChartCollection) { |
||||||
} |
this.setEnabled(false); |
||||||
return group; |
return; |
||||||
} |
} |
||||||
|
} |
||||||
|
this.updateStyle(ReportActionUtils.getCurrentStyle(reportPane)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建工具条,且有提示 |
||||||
|
* |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public UIButtonGroup<Integer> createToolBarComponent() { |
||||||
|
UIButtonGroup<Integer> group = super.createToolBarComponent(); |
||||||
|
if (group != null) { |
||||||
|
group.setForToolBarButtonGroup(true); |
||||||
|
group.setAllToolTips(new String[]{Inter.getLocText("StyleAlignment-Left"), Inter.getLocText("Center"), Inter.getLocText("StyleAlignment-Right")}); |
||||||
|
} |
||||||
|
for (int i = 0; i < 3; i++) { |
||||||
|
group.getButton(i).setRoundBorder(true, UIConstants.ARC); |
||||||
|
group.getButton(i).setBorderPainted(true); |
||||||
|
} |
||||||
|
return group; |
||||||
|
} |
||||||
|
|
||||||
} |
} |
Before Width: | Height: | Size: 165 B After Width: | Height: | Size: 193 B |
After Width: | Height: | Size: 235 B |
After Width: | Height: | Size: 119 B |
After Width: | Height: | Size: 128 B |
After Width: | Height: | Size: 142 B |
After Width: | Height: | Size: 158 B |
After Width: | Height: | Size: 176 B |