帆软报表设计器源代码。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

219 lines
8.5 KiB

package com.fr.design.webattr;
import com.fine.theme.icon.LazyIcon;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.core.WidgetOption;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.report.web.ToolBarManager;
import com.fr.report.web.WebWrite;
import com.fr.stable.Constants;
import com.fr.web.attr.ReportWebAttr;
import javax.swing.JPanel;
import javax.swing.ButtonGroup;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row;
public class WriteWebSettingPane extends WebSettingPane<WebWrite> {
private UICheckBox colorBox;
private UIColorButton colorButton;
private UIRadioButton topRadioButton;
private UIRadioButton bottomRadioButton;
private UIRadioButton centerRadioButton;
private UIRadioButton leftRadioButton;
private UILabel rptShowLocationLabel;
private UILabel sheetShowLocationLabel;
private UICheckBox unloadCheck;
private UICheckBox showWidgets;
private UICheckBox isAutoStash;//自动暂存
public WriteWebSettingPane() {
super();
}
/**
* 模板-模板Web属性-填报页面设置中其余设置面板,通用部分在父类绘制
* @return
*/
@Override
protected JPanel createOtherSetPane() {
//sheet标签页显示位置
topRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Top"));
bottomRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bottom"));
sheetShowLocationLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sheet_Label_Page_Display_Position"));
ButtonGroup buttonGroup = new ButtonGroup();
bottomRadioButton.setSelected(true);
buttonGroup.add(topRadioButton);
buttonGroup.add(bottomRadioButton);
JPanel sheetPane = row(LayoutConstants.HORIZONTAL_GAP,
cell(sheetShowLocationLabel),
cell(topRadioButton),
cell(bottomRadioButton)).getComponent();
//Sean: 报表显示位置since 706
rptShowLocationLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Show_Location"));
centerRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Center_Display"));
leftRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Left_Display"));
ButtonGroup rptShowButtonGroup = new ButtonGroup();
leftRadioButton.setSelected(true);
rptShowButtonGroup.add(centerRadioButton);
rptShowButtonGroup.add(leftRadioButton);
JPanel showLocPane = row(LayoutConstants.HORIZONTAL_GAP,
cell(rptShowLocationLabel),
cell(centerRadioButton),
cell(leftRadioButton)
).getComponent();
//填报当前编辑行背景设置
colorBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Background_Of_Current_Row"));
colorBox.setSelected(true);
colorButton = new UIColorButton(new LazyIcon("background"));
colorBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
colorButton.setEnabled(colorBox.isSelected());
}
});
JPanel backgroundPane = row(LayoutConstants.HGAP_LARGE, cell(colorBox), cell(colorButton)).getComponent();
//勾选设置
unloadCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unload_Check"));
unloadCheck.setSelected(true);
showWidgets = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event_Show_Widgets"));
showWidgets.setSelected(false);
isAutoStash = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Write_Auto_Stash"));
isAutoStash.setSelected(false);
JPanel unloadCheckPane = row(LayoutConstants.HORIZONTAL_GAP,
cell(unloadCheck),
cell(showWidgets),
cell(isAutoStash)
).getComponent();
JPanel northPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2);
northPane.add(sheetPane);
northPane.add(showLocPane);
northPane.add(backgroundPane);
northPane.add(unloadCheckPane);
return northPane;
}
@Override
protected void checkEnabled(boolean isSelected) {
super.checkEnabled(isSelected);
colorBox.setEnabled(isSelected);
colorButton.setEnabled(isSelected);
topRadioButton.setEnabled(isSelected);
leftRadioButton.setEnabled(isSelected);
centerRadioButton.setEnabled(isSelected);
rptShowLocationLabel.setEnabled(isSelected);
sheetShowLocationLabel.setEnabled(isSelected);
bottomRadioButton.setEnabled(isSelected);
unloadCheck.setEnabled(isSelected);
showWidgets.setEnabled(isSelected);
isAutoStash.setEnabled(isSelected);
}
protected void setDefault() {
super.setDefault();
colorBox.setSelected(false);
colorButton.setEnabled(false);
bottomRadioButton.setSelected(true);
leftRadioButton.setSelected(true);
unloadCheck.setSelected(true);
showWidgets.setSelected(false);
isAutoStash.setSelected(false);
}
@Override
protected void populateSubWebSettingrBean(WebWrite webWrite) {
if (webWrite == null) {
webWrite = new WebWrite();
}
if (webWrite.isEditRowColor()) {
colorBox.setSelected(true);
colorButton.setColor(webWrite.getSelectedColor());
} else {
colorBox.setSelected(false);
colorButton.setEnabled(false);
}
if (webWrite.getSheetPosition() == Constants.TOP) {
topRadioButton.setSelected(true);
} else if (webWrite.getSheetPosition() == Constants.BOTTOM) {
bottomRadioButton.setSelected(true);
}
if (webWrite.isViewAtLeft()) {
leftRadioButton.setSelected(true);
} else {
centerRadioButton.setSelected(true);
}
unloadCheck.setSelected(webWrite.isUnloadCheck());
showWidgets.setSelected(webWrite.isShowWidgets());
isAutoStash.setSelected(webWrite.isAutoStash());
}
@Override
protected WebWrite updateSubWebSettingBean() {
WebWrite webWrite = new WebWrite();
if (colorBox.isSelected()) {
webWrite.setEditRowColor(true);
webWrite.setSelectedColor(colorButton.getColor());
} else {
webWrite.setEditRowColor(false);
}
if (topRadioButton.isSelected()) {
webWrite.setSheetPosition(Constants.TOP);
} else if (bottomRadioButton.isSelected()) {
webWrite.setSheetPosition(Constants.BOTTOM);
}
webWrite.setViewAtLeft(leftRadioButton.isSelected());
webWrite.setUnloadCheck(unloadCheck.isSelected());
webWrite.setShowWidgets(showWidgets.isSelected());
webWrite.setAutoStash(isAutoStash.isSelected());
return webWrite;
}
@Override
protected WidgetOption[] getToolBarInstance() {
List<WidgetOption> defaultOptions = Arrays.asList(ReportWebWidgetConstants.getWriteToolBarInstance());
List<WidgetOption> extraOptions = Arrays.asList(ExtraDesignClassManager.getInstance().getWebWidgetOptions());
List<WidgetOption> options = new ArrayList<WidgetOption>();
options.addAll(defaultOptions);
options.addAll(extraOptions);
return options.toArray(new WidgetOption[options.size()]);
}
@Override
protected ToolBarManager getDefaultToolBarManager() {
return ToolBarManager.createDefaultWriteToolBar();
}
@Override
protected WebWrite getWebContent(ReportWebAttr reportWebAttr) {
return reportWebAttr == null ? null : reportWebAttr.getWebWrite();
}
@Override
protected String[] getEventNames() {
return new WebWrite().supportedEvents();
}
@Override
protected void setWebContent(ReportWebAttr reportWebAttr, WebWrite webContent) {
reportWebAttr.setWebWrite(webContent);
}
}