|
|
@ -21,14 +21,13 @@ import javax.swing.*; |
|
|
|
public class ReportFontBoldAction extends AbstractStyleAction implements ToggleButtonUpdateAction { |
|
|
|
public class ReportFontBoldAction extends AbstractStyleAction implements ToggleButtonUpdateAction { |
|
|
|
private UIToggleButton button; |
|
|
|
private UIToggleButton button; |
|
|
|
protected Style style; |
|
|
|
protected Style style; |
|
|
|
private final static Icon blackIcon = BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"); |
|
|
|
private final static Icon[] icons = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold_white.png")}; |
|
|
|
private final static Icon whiteIcon = BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold_white.png"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ReportFontBoldAction(ElementCasePane t) { |
|
|
|
public ReportFontBoldAction(ElementCasePane t) { |
|
|
|
super(t); |
|
|
|
super(t); |
|
|
|
|
|
|
|
|
|
|
|
this.setName(Inter.getLocText("FRFont-bold")); |
|
|
|
this.setName(Inter.getLocText("FRFont-bold")); |
|
|
|
this.setSmallIcon(blackIcon); |
|
|
|
this.setSmallIcon(icons, true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -40,23 +39,18 @@ public class ReportFontBoldAction extends AbstractStyleAction implements ToggleB |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Style executeStyle(Style style, Style defStyle) { |
|
|
|
public Style executeStyle(Style style, Style defStyle) { |
|
|
|
button = createToolBarComponent(); |
|
|
|
createToolBarComponent().setSelected(!createToolBarComponent().isSelected()); |
|
|
|
button.setIcon(getToggleButtonIcon(button.isSelected())); |
|
|
|
if (createToolBarComponent().isSelected()) { |
|
|
|
button.setSelected(!button.isSelected()); |
|
|
|
|
|
|
|
if (button.isSelected()) { |
|
|
|
|
|
|
|
setSelectedFont(style); |
|
|
|
setSelectedFont(style); |
|
|
|
button.setSelected(false); |
|
|
|
createToolBarComponent().setSelected(false); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
setUnselectedFont(style); |
|
|
|
setUnselectedFont(style); |
|
|
|
button.setSelected(true); |
|
|
|
createToolBarComponent().setSelected(true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return this.style; |
|
|
|
return this.style; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected Icon getToggleButtonIcon(boolean isSelected) { |
|
|
|
|
|
|
|
return isSelected ? blackIcon : whiteIcon; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void setSelectedFont(Style style) { |
|
|
|
protected void setSelectedFont(Style style) { |
|
|
|
this.style = StyleUtils.boldReportFont(style); |
|
|
|
this.style = StyleUtils.boldReportFont(style); |
|
|
@ -78,9 +72,7 @@ public class ReportFontBoldAction extends AbstractStyleAction implements ToggleB |
|
|
|
if (frFont == null) { |
|
|
|
if (frFont == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
button = createToolBarComponent(); |
|
|
|
createToolBarComponent().setSelected(isStyle(frFont)); |
|
|
|
button.setSelected(isStyle(frFont)); |
|
|
|
|
|
|
|
button.setIcon(getToggleButtonIcon(!button.isSelected())); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected boolean isStyle(FRFont frFont) { |
|
|
|
protected boolean isStyle(FRFont frFont) { |
|
|
@ -95,7 +87,7 @@ public class ReportFontBoldAction extends AbstractStyleAction implements ToggleB |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public UIToggleButton createToolBarComponent() { |
|
|
|
public UIToggleButton createToolBarComponent() { |
|
|
|
if (button == null) { |
|
|
|
if (button == null) { |
|
|
|
button = GUICoreUtils.createToolBarComponent(this); |
|
|
|
button = GUICoreUtils.createToolBarComponentWhiteIcon(this); |
|
|
|
button.setEventBannded(true); |
|
|
|
button.setEventBannded(true); |
|
|
|
} |
|
|
|
} |
|
|
|
return button; |
|
|
|
return button; |
|
|
|