ju
7 years ago
81 changed files with 2666 additions and 1169 deletions
@ -0,0 +1,13 @@
|
||||
package com.fr.design.event; |
||||
|
||||
import java.util.EventListener; |
||||
|
||||
/** |
||||
* Created by plough on 2018/1/19. |
||||
*/ |
||||
public interface DesignerOpenedListener extends EventListener { |
||||
/** |
||||
* Invoked when the target of the listener has changed the rpt content. |
||||
*/ |
||||
public void designerOpened(); |
||||
} |
@ -0,0 +1,20 @@
|
||||
package com.fr.design.designer.beans.actions.behavior; |
||||
|
||||
import com.fr.design.designer.beans.actions.FormWidgetEditAction; |
||||
import com.fr.design.mainframe.FormDesigner; |
||||
|
||||
/** |
||||
* 只对控件有效,对底层布局(form/body)无效 |
||||
* Created by plough on 2018/1/19. |
||||
*/ |
||||
public class ComponentEnable implements UpdateBehavior<FormWidgetEditAction> { |
||||
@Override |
||||
public void doUpdate(FormWidgetEditAction action) { |
||||
FormDesigner designer = action.getEditingComponent(); |
||||
if (designer == null) { |
||||
action.setEnabled(false); |
||||
return; |
||||
} |
||||
action.setEnabled(!designer.isRootSelected()); |
||||
} |
||||
} |
@ -0,0 +1,19 @@
|
||||
package com.fr.design.designer.beans.actions.behavior; |
||||
|
||||
import com.fr.design.designer.beans.actions.FormWidgetEditAction; |
||||
import com.fr.design.mainframe.FormDesigner; |
||||
|
||||
/** |
||||
* Created by plough on 2018/1/19. |
||||
*/ |
||||
public class MovableDownEnable implements UpdateBehavior<FormWidgetEditAction> { |
||||
@Override |
||||
public void doUpdate(FormWidgetEditAction action) { |
||||
FormDesigner designer = action.getEditingComponent(); |
||||
if (designer == null) { |
||||
action.setEnabled(false); |
||||
return; |
||||
} |
||||
action.setEnabled(designer.isCurrentComponentMovableDown()); |
||||
} |
||||
} |
@ -0,0 +1,19 @@
|
||||
package com.fr.design.designer.beans.actions.behavior; |
||||
|
||||
import com.fr.design.designer.beans.actions.FormWidgetEditAction; |
||||
import com.fr.design.mainframe.FormDesigner; |
||||
|
||||
/** |
||||
* Created by plough on 2018/1/19. |
||||
*/ |
||||
public class MovableUpEnable implements UpdateBehavior<FormWidgetEditAction> { |
||||
@Override |
||||
public void doUpdate(FormWidgetEditAction action) { |
||||
FormDesigner designer = action.getEditingComponent(); |
||||
if (designer == null) { |
||||
action.setEnabled(false); |
||||
return; |
||||
} |
||||
action.setEnabled(designer.isCurrentComponentMovableUp()); |
||||
} |
||||
} |
@ -0,0 +1,8 @@
|
||||
package com.fr.design.designer.beans.actions.behavior; |
||||
|
||||
/** |
||||
* Created by plough on 2018/1/19. |
||||
*/ |
||||
public interface UpdateBehavior<T> { |
||||
public void doUpdate(T t); |
||||
} |
After Width: | Height: | Size: 900 B |
After Width: | Height: | Size: 891 B |
@ -0,0 +1,93 @@
|
||||
package com.fr.design.mainframe; |
||||
|
||||
import com.fr.design.dialog.UIDialog; |
||||
import com.fr.design.gui.icontainer.UIScrollPane; |
||||
import com.fr.design.gui.itextarea.UITextArea; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.JFrame; |
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Dimension; |
||||
import java.awt.Frame; |
||||
import java.awt.Point; |
||||
import java.awt.event.MouseEvent; |
||||
|
||||
/** |
||||
* @author zack |
||||
* @date 2016-10-14 |
||||
* @since 8.0 |
||||
*/ |
||||
public class WidgetHelpDialog extends UIDialog { |
||||
|
||||
private static final int OUTER_WIDTH = 190; |
||||
private static final int OUTER_HEIGHT = 280; |
||||
private static final int DIALOG_X = 227; |
||||
private static final int DIALOG_Y = 165; |
||||
|
||||
|
||||
private String helpMsg; |
||||
private UIScrollPane helpArea; |
||||
|
||||
|
||||
public WidgetHelpDialog(Frame parent, String helpMsg) { |
||||
super(parent); |
||||
this.helpMsg = helpMsg; |
||||
initHelpArea(); |
||||
JPanel panel = (JPanel) getContentPane(); |
||||
initComponents(panel); |
||||
setSize(new Dimension(OUTER_WIDTH, OUTER_HEIGHT)); |
||||
} |
||||
|
||||
private void initHelpArea() { |
||||
UITextArea textArea = new UITextArea(helpMsg); |
||||
textArea.setEditable(false); |
||||
textArea.setBorder(null); |
||||
helpArea = new UIScrollPane(textArea); |
||||
helpArea.setBounds(0, 0, OUTER_WIDTH, OUTER_HEIGHT); |
||||
helpArea.setBorder(null); |
||||
} |
||||
|
||||
private void initComponents(JPanel contentPane) { |
||||
contentPane.setLayout(new BorderLayout()); |
||||
add(helpArea, BorderLayout.CENTER); |
||||
this.applyClosingAction(); |
||||
this.setTitle(Inter.getLocText("FR-Designer_Help")); |
||||
} |
||||
|
||||
/** |
||||
* 打开帮助框 |
||||
*/ |
||||
public void showWindow() { |
||||
this.setResizable(false); |
||||
setVisible(true); |
||||
} |
||||
|
||||
/** |
||||
* 打开帮助框-e |
||||
*/ |
||||
public void showWindow(MouseEvent e) { |
||||
int rX = WestRegionContainerPane.getInstance().getWidth() + e.getX() - DIALOG_X;//弹出框宽度190加上图标的宽度27加上10的偏移
|
||||
int rY = DIALOG_Y + e.getY();//165是设计器最上面几个面板的高度
|
||||
this.setLocationRelativeTo(DesignerContext.getDesignerFrame(), rX, rY); |
||||
this.setResizable(false); |
||||
setVisible(true); |
||||
} |
||||
|
||||
/** |
||||
* 略 |
||||
*/ |
||||
@Override |
||||
public void checkValid() throws Exception { |
||||
|
||||
} |
||||
|
||||
public void setLocationRelativeTo(JFrame c, int x, int y) { |
||||
int dx = 0, dy = 0; |
||||
Point compLocation = c.getLocationOnScreen();//获取设计器Jframe坐标作为相对位置原点
|
||||
setLocation(dx + x, dy + y); |
||||
dx = compLocation.x; |
||||
dy = compLocation.y + c.getRootPane().getY();//加上底层容器的y坐标(其实就是设计器最上方图标栏的高度)
|
||||
setLocation(dx + x, dy + y); |
||||
} |
||||
} |
@ -0,0 +1,75 @@
|
||||
package com.fr.design.actions.report; |
||||
|
||||
import com.fr.base.IconManager; |
||||
import com.fr.base.print.PrintSettingsAttrMark; |
||||
import com.fr.design.actions.JWorkBookAction; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.design.webattr.printsettings.ReportPrintSettingPane; |
||||
import com.fr.general.IOUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.main.TemplateWorkBook; |
||||
import com.fr.main.impl.WorkBook; |
||||
import com.fr.report.core.ReportUtils; |
||||
|
||||
import javax.swing.KeyStroke; |
||||
import java.awt.event.ActionEvent; |
||||
|
||||
/** |
||||
* Created by plough on 2018/3/5. |
||||
*/ |
||||
public class ReportPrintSettingAction extends JWorkBookAction { |
||||
|
||||
public ReportPrintSettingAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
this.setMenuKeySet(REPORT_APP_ATTR); |
||||
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(IOUtils.readIcon(IconManager.PRINT.getPath())); |
||||
this.setSearchText(new ReportPrintSettingPane()); |
||||
} |
||||
|
||||
/** |
||||
* 执行动作 |
||||
* |
||||
* @return 是否执行成功 |
||||
*/ |
||||
public void actionPerformed(ActionEvent evt) { |
||||
final JWorkBook jwb = getEditingComponent(); |
||||
if (jwb == null) { |
||||
return; |
||||
} |
||||
final WorkBook wbTpl = jwb.getTarget(); |
||||
PrintSettingsAttrMark printSettings = ReportUtils.getPrintSettingsFromWorkbook(wbTpl); |
||||
|
||||
final ReportPrintSettingPane reportPrintSettingPane = new ReportPrintSettingPane(); |
||||
reportPrintSettingPane.populate(printSettings); |
||||
BasicDialog dialog = reportPrintSettingPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { |
||||
@Override |
||||
public void doOk() { |
||||
PrintSettingsAttrMark newPrintSettings = reportPrintSettingPane.updateBean(); |
||||
wbTpl.addAttrMark(newPrintSettings); |
||||
jwb.fireTargetModified(); |
||||
} |
||||
}); |
||||
dialog.setVisible(true); |
||||
} |
||||
|
||||
private static final MenuKeySet REPORT_APP_ATTR = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { return 'P'; } |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("FR-Designer_Print_Setting"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,365 @@
|
||||
package com.fr.design.webattr.printsettings; |
||||
|
||||
import com.fr.base.PaperSize; |
||||
import com.fr.base.Utils; |
||||
import com.fr.base.print.NativePrintAttr; |
||||
import com.fr.design.gui.ibutton.UIRadioButton; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.icombobox.UIComboBoxRenderer; |
||||
import com.fr.design.gui.icontainer.UIScrollPane; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ispinner.UIBasicSpinner; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.report.stable.ReportConstants; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.print.DocFlavor; |
||||
import javax.print.PrintService; |
||||
import javax.print.PrintServiceLookup; |
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.ButtonGroup; |
||||
import javax.swing.JList; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.SpinnerNumberModel; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Component; |
||||
import java.awt.Dimension; |
||||
import java.awt.FlowLayout; |
||||
import java.awt.event.FocusAdapter; |
||||
import java.awt.event.FocusEvent; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
import java.util.HashSet; |
||||
import java.util.Set; |
||||
import java.util.regex.Matcher; |
||||
import java.util.regex.Pattern; |
||||
|
||||
/** |
||||
* Created by plough on 2018/3/5. |
||||
*/ |
||||
public class NativePrintSettingPane extends JPanel { |
||||
private UICheckBox isShowDialogCheck; |
||||
private UIComboBox printerComboBox; |
||||
private UIBasicSpinner copySpinner; // 份数
|
||||
private UIRadioButton allPageRadioButton; |
||||
private UIRadioButton currentPageRadioButton; |
||||
private UIRadioButton customPageRadioButton; |
||||
private UITextField specifiedAreaField; |
||||
private UIComboBox predefinedPaperSizeComboBox; |
||||
private UICheckBox inheritPagePaperSettingCheck; |
||||
private UICheckBox inheritPageLayoutSettingCheck; |
||||
private UICheckBox inheritPageMarginSettingCheck; |
||||
private UICheckBox fitPaperSizeCheck; // 缩放
|
||||
private UIRadioButton portraitRadioButton; |
||||
private UIRadioButton landscapeRadioButton; |
||||
private PageMarginSettingPane pageMarginSettingPane; |
||||
private JPanel centerPane; |
||||
|
||||
public NativePrintSettingPane() { |
||||
initComponents(); |
||||
initListeners(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
JPanel printPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
|
||||
JPanel northPane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(1, 0, 15); |
||||
UILabel tipDownload = GUICoreUtils.createTipLabel(Inter.getLocText("FR-Designer_Tip_Native_Print_Need_Client")); |
||||
northPane.add(tipDownload); |
||||
isShowDialogCheck = new UICheckBox(Inter.getLocText("FR-Engine_Show_Print_Setting_Window_When_Printing")); |
||||
isShowDialogCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); |
||||
UILabel tipCheck = GUICoreUtils.createTipLabel(Inter.getLocText("FR-Designer_Tip_Use_Default_Settings")); |
||||
JPanel checkPane = GUICoreUtils.createFlowPane(new Component[] { |
||||
isShowDialogCheck, tipCheck}, FlowLayout.LEFT); |
||||
northPane.add(checkPane); |
||||
northPane.setBorder(BorderFactory.createEmptyBorder(3, 10, 10, 0)); |
||||
|
||||
printPane.add(northPane, BorderLayout.NORTH); |
||||
|
||||
centerPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Default_Settings")); |
||||
|
||||
UIScrollPane scrollPane = new UIScrollPane(getNativePrintMainSettingPane()); |
||||
scrollPane.setBorder(null); |
||||
scrollPane.setPreferredSize(new Dimension(600, 340)); |
||||
centerPane.add(scrollPane); |
||||
|
||||
printPane.add(centerPane, BorderLayout.CENTER); |
||||
|
||||
this.setLayout(new BorderLayout()); |
||||
this.add(printPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
private void initListeners() { |
||||
allPageRadioButton.addItemListener(getPageRaidoListener()); |
||||
currentPageRadioButton.addItemListener(getPageRaidoListener()); |
||||
customPageRadioButton.addItemListener(getPageRaidoListener()); |
||||
isShowDialogCheck.addItemListener(new ItemListener() { |
||||
@Override |
||||
public void itemStateChanged(ItemEvent e) { |
||||
checkEnabled(); |
||||
} |
||||
}); |
||||
specifiedAreaField.addFocusListener(new FocusAdapter() { |
||||
String lastValidText = StringUtils.EMPTY; |
||||
|
||||
@Override |
||||
public void focusGained(FocusEvent e) { |
||||
lastValidText = specifiedAreaField.getText(); |
||||
} |
||||
|
||||
@Override |
||||
public void focusLost(FocusEvent e) { |
||||
String text = specifiedAreaField.getText(); |
||||
Pattern r = Pattern.compile("^(\\d+-)?\\d+$"); |
||||
Matcher m = r.matcher(text); |
||||
if (!m.matches()) { |
||||
specifiedAreaField.setText(lastValidText); |
||||
} |
||||
super.focusLost(e); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private ItemListener getPageRaidoListener() { |
||||
return new ItemListener() { |
||||
@Override |
||||
public void itemStateChanged(ItemEvent e) { |
||||
specifiedAreaField.setEnabled(customPageRadioButton.isSelected()); |
||||
} |
||||
}; |
||||
} |
||||
|
||||
private JPanel getNativePrintMainSettingPane() { |
||||
// 打印机
|
||||
String[] printerArray = getAllPrinterNames(); |
||||
printerComboBox = new UIComboBox(printerArray); |
||||
printerComboBox.setPreferredSize(new Dimension(200, printerComboBox.getPreferredSize().height)); |
||||
JPanel printerPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); |
||||
printerPane.add(printerComboBox); |
||||
|
||||
// 份数
|
||||
copySpinner = new UIBasicSpinner(new SpinnerNumberModel(1, 0, Integer.MAX_VALUE, 1)); |
||||
GUICoreUtils.setColumnForSpinner(copySpinner, 5); |
||||
JPanel copyPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); |
||||
copyPane.add(copySpinner); |
||||
|
||||
// 继承页面纸张设置
|
||||
inheritPagePaperSettingCheck = GUICoreUtils.createNoBorderCheckBox(Inter.getLocText("FR-Designer_Inherit_Page_Paper_Setting")); |
||||
JPanel paperSettingPane = getPaperSettingPane(); |
||||
JPanel paperSettingCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(inheritPagePaperSettingCheck, paperSettingPane, true); |
||||
|
||||
// 继承页面布局设置
|
||||
inheritPageLayoutSettingCheck = GUICoreUtils.createNoBorderCheckBox(Inter.getLocText("FR-Designer_Inherit_Page_Layout_Setting")); |
||||
JPanel layoutSettingPane = getLayoutSettingPane(); |
||||
JPanel layoutSettingCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(inheritPageLayoutSettingCheck, layoutSettingPane, true); |
||||
|
||||
// 页码标签
|
||||
UILabel printAreaLabel = new UILabel(Inter.getLocText("FR-Engine-Page_Number") + ":"); |
||||
JPanel printAreaLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
printAreaLabelPane.add(printAreaLabel, BorderLayout.NORTH); |
||||
printAreaLabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); |
||||
|
||||
// 边距
|
||||
inheritPageMarginSettingCheck = GUICoreUtils.createNoBorderCheckBox(Inter.getLocText("FR-Designer_Inherit_Page_Margin_Setting")); |
||||
pageMarginSettingPane = new PageMarginSettingPane(); |
||||
pageMarginSettingPane.setBorder(BorderFactory.createEmptyBorder(10, -10, 0, 0)); |
||||
JPanel pageMarginCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(inheritPageMarginSettingCheck, pageMarginSettingPane, true); |
||||
|
||||
// 缩放
|
||||
fitPaperSizeCheck = GUICoreUtils.createNoBorderCheckBox(Inter.getLocText("FR-Designer_Print_To_Fit_Paper_Size")); |
||||
|
||||
// TableLayout
|
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {p, p, p, p, p, p}; |
||||
double[] columnSize = {60, p}; |
||||
Component[][] components = { |
||||
{new UILabel(Inter.getLocText("FR-Designer_Printer") + ":"), printerPane}, |
||||
{new UILabel(Inter.getLocText("FR-Designer_Copy_Number") + ":"), copyPane}, |
||||
{printAreaLabelPane, getPrintAreaPane()}, |
||||
{getTopAlignLabelPane(Inter.getLocText("FR-Designer_Paper") + ":"), paperSettingCheckPane}, |
||||
{getTopAlignLabelPane(Inter.getLocText("FR-Designer_Layout") + ":"), layoutSettingCheckPane}, |
||||
{getTopAlignLabelPane(Inter.getLocText("FR-Designer_Margin") + ":"), pageMarginCheckPane} |
||||
// 此功能暂时不做,在界面上隐藏缩放选项
|
||||
// {new UILabel(Inter.getLocText("FR-Designer_Scale_EnlargeOrReduce") + ":"), fitPaperSizeCheck},
|
||||
}; |
||||
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 15); |
||||
} |
||||
|
||||
private String[] getAllPrinterNames() { |
||||
PrintService[] printServices = PrintServiceLookup.lookupPrintServices( |
||||
DocFlavor.INPUT_STREAM.AUTOSENSE, null); |
||||
Set<String> allPrinterName = new HashSet<String>(); |
||||
|
||||
for (int i = 0, len = printServices.length; i < len; i++) { |
||||
allPrinterName.add(printServices[i].getName()); |
||||
} |
||||
|
||||
return allPrinterName.toArray(new String[allPrinterName.size()]); |
||||
} |
||||
|
||||
private JPanel getPaperSettingPane() { |
||||
predefinedPaperSizeComboBox = new UIComboBox(); |
||||
for (int i = 0; i < ReportConstants.PaperSizeNameSizeArray.length; i++) { |
||||
Object[] tmpPaperSizeNameArray = ReportConstants.PaperSizeNameSizeArray[i]; |
||||
predefinedPaperSizeComboBox.addItem(tmpPaperSizeNameArray[1]); |
||||
} |
||||
predefinedPaperSizeComboBox.setRenderer(new UIComboBoxRenderer() { |
||||
@Override |
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
||||
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
||||
|
||||
if (value instanceof PaperSize) { |
||||
PaperSize paperSize = (PaperSize) value; |
||||
for (int i = 0; i < ReportConstants.PaperSizeNameSizeArray.length; i++) { |
||||
Object[] tmpPaperSizeNameArray = ReportConstants.PaperSizeNameSizeArray[i]; |
||||
|
||||
if (ComparatorUtils.equals(paperSize, tmpPaperSizeNameArray[1])) { |
||||
String sbuf = tmpPaperSizeNameArray[0].toString() + " [" + |
||||
Utils.convertNumberStringToString(paperSize.getWidth().toMMValue4Scale2()) + |
||||
'x' + |
||||
Utils.convertNumberStringToString(paperSize.getHeight().toMMValue4Scale2()) + |
||||
' ' + |
||||
Inter.getLocText("PageSetup-mm") + |
||||
']'; |
||||
this.setText(sbuf); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
return this; |
||||
} |
||||
}); |
||||
|
||||
JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); |
||||
panel.add(predefinedPaperSizeComboBox); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(8, 0, 0, 0)); |
||||
return panel; |
||||
} |
||||
|
||||
private JPanel getLayoutSettingPane() { |
||||
JPanel layoutSettingPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); |
||||
layoutSettingPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); |
||||
portraitRadioButton = new UIRadioButton(Inter.getLocText("PageSetup-Portrait")); |
||||
portraitRadioButton.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); |
||||
landscapeRadioButton = new UIRadioButton(Inter.getLocText("PageSetup-Landscape")); |
||||
layoutSettingPane.add(portraitRadioButton); |
||||
layoutSettingPane.add(landscapeRadioButton); |
||||
|
||||
ButtonGroup layoutButtonGroup = new ButtonGroup(); |
||||
layoutButtonGroup.add(portraitRadioButton); |
||||
layoutButtonGroup.add(landscapeRadioButton); |
||||
|
||||
portraitRadioButton.setSelected(true); |
||||
return layoutSettingPane; |
||||
} |
||||
|
||||
// 页码范围
|
||||
private JPanel getPrintAreaPane() { |
||||
allPageRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_All_Pages")); |
||||
currentPageRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_Current_Page")); |
||||
customPageRadioButton = new UIRadioButton(Inter.getLocText("FR-Engine_HJS-Specified_Pages")); |
||||
ButtonGroup group = new ButtonGroup(); |
||||
group.add(allPageRadioButton); |
||||
group.add(currentPageRadioButton); |
||||
group.add(customPageRadioButton); |
||||
allPageRadioButton.setSelected(true); |
||||
|
||||
specifiedAreaField = new UITextField(20) { |
||||
@Override |
||||
public void setEnabled(boolean enabled) { |
||||
// 如果未选中"指定页",此输入框始终不可用
|
||||
if (enabled && !customPageRadioButton.isSelected()) { |
||||
return; |
||||
} |
||||
super.setEnabled(enabled); |
||||
} |
||||
}; |
||||
UILabel areaFieldTip = GUICoreUtils.createTipLabel(Inter.getLocText("FR-Designer_Print_Area_Tip")); |
||||
|
||||
// TableLayout
|
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {p, p, p}; |
||||
double[] columnSize = {p, p, p}; |
||||
Component[][] components = { |
||||
{allPageRadioButton, null, null}, |
||||
{currentPageRadioButton, null, null}, |
||||
{customPageRadioButton, specifiedAreaField, areaFieldTip} |
||||
}; |
||||
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0); |
||||
} |
||||
|
||||
// 返回包含一个标签的 panel,标签始终位于 panel 顶部
|
||||
private JPanel getTopAlignLabelPane(String labelText) { |
||||
JPanel labelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
labelPane.add(new UILabel(labelText), BorderLayout.NORTH); |
||||
return labelPane; |
||||
} |
||||
|
||||
public void populate(NativePrintAttr nativePrintAttr) { |
||||
isShowDialogCheck.setSelected(nativePrintAttr.isShowDialog()); |
||||
printerComboBox.setSelectedItem(nativePrintAttr.getPrinterName()); |
||||
copySpinner.setValue(nativePrintAttr.getCopy()); |
||||
|
||||
if (nativePrintAttr.getPageType().equals(NativePrintAttr.PageType.ALL_PAGES)) { |
||||
allPageRadioButton.setSelected(true); |
||||
} else if (nativePrintAttr.getPageType().equals(NativePrintAttr.PageType.CURRENT_PAGE)) { |
||||
currentPageRadioButton.setSelected(true); |
||||
} else { |
||||
customPageRadioButton.setSelected(true); |
||||
specifiedAreaField.setText(nativePrintAttr.getArea()); |
||||
} |
||||
specifiedAreaField.setEnabled(customPageRadioButton.isSelected()); |
||||
|
||||
inheritPagePaperSettingCheck.setSelected(nativePrintAttr.isInheritPagePaperSetting()); |
||||
predefinedPaperSizeComboBox.setSelectedItem(nativePrintAttr.getPaperSize()); |
||||
inheritPageLayoutSettingCheck.setSelected(nativePrintAttr.isInheritPageLayoutSetting()); |
||||
if (nativePrintAttr.getOrientation() == ReportConstants.PORTRAIT) { |
||||
portraitRadioButton.setSelected(true); |
||||
} else { |
||||
landscapeRadioButton.setSelected(true); |
||||
} |
||||
inheritPageMarginSettingCheck.setSelected(nativePrintAttr.isInheritPageMarginSetting()); |
||||
pageMarginSettingPane.populate(nativePrintAttr.getMargin()); |
||||
fitPaperSizeCheck.setSelected(nativePrintAttr.isFitPaperSize()); |
||||
} |
||||
|
||||
public void update(NativePrintAttr nativePrintAttr) { |
||||
nativePrintAttr.setShowDialog(isShowDialogCheck.isSelected()); |
||||
if (printerComboBox.getSelectedItem() != null) { |
||||
nativePrintAttr.setPrinterName(printerComboBox.getSelectedItem().toString()); |
||||
} |
||||
nativePrintAttr.setCopy((int)copySpinner.getValue()); |
||||
|
||||
// 页码
|
||||
if (allPageRadioButton.isSelected()) { |
||||
nativePrintAttr.setPageType(NativePrintAttr.PageType.ALL_PAGES); |
||||
} else if (currentPageRadioButton.isSelected()) { |
||||
nativePrintAttr.setPageType(NativePrintAttr.PageType.CURRENT_PAGE); |
||||
} else { |
||||
nativePrintAttr.setPageType(NativePrintAttr.PageType.SPECIFIED_PAGES); |
||||
nativePrintAttr.setArea(specifiedAreaField.getText()); |
||||
} |
||||
|
||||
nativePrintAttr.setInheritPagePaperSetting(inheritPagePaperSettingCheck.isSelected()); |
||||
nativePrintAttr.setPaperSize((PaperSize) predefinedPaperSizeComboBox.getSelectedItem()); |
||||
nativePrintAttr.setInheritPageLayoutSetting(inheritPageLayoutSettingCheck.isSelected()); |
||||
nativePrintAttr.setOrientation(portraitRadioButton.isSelected() ? |
||||
ReportConstants.PORTRAIT : ReportConstants.LANDSCAPE); |
||||
nativePrintAttr.setInheritPageMarginSetting(inheritPageMarginSettingCheck.isSelected()); |
||||
nativePrintAttr.setMargin(pageMarginSettingPane.updateBean()); |
||||
nativePrintAttr.setFitPaperSize(fitPaperSizeCheck.isSelected()); |
||||
} |
||||
|
||||
// 刷新面板可用状态
|
||||
public void checkEnabled() { |
||||
GUICoreUtils.setEnabled(centerPane, !isShowDialogCheck.isSelected()); |
||||
} |
||||
} |
@ -0,0 +1,103 @@
|
||||
package com.fr.design.webattr.printsettings; |
||||
|
||||
import com.fr.base.print.NoClientPrintAttr; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Component; |
||||
import java.awt.FlowLayout; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
|
||||
/** |
||||
* 零客户端打印设置面板 |
||||
* Created by plough on 2018/3/5. |
||||
*/ |
||||
public class NoClientPrintSettingPane extends JPanel { |
||||
private UICheckBox setMarginWhenPrintCheck; |
||||
private UICheckBox inheritPageMarginSettingCheck; // 继承页面边距设置
|
||||
private PageMarginSettingPane pageMarginSettingPane; |
||||
private JPanel centerPane; |
||||
|
||||
public NoClientPrintSettingPane() { |
||||
initComponents(); |
||||
initListeners(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
JPanel printPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
|
||||
setMarginWhenPrintCheck = new UICheckBox(Inter.getLocText("FR-Engine_Set_Margin_When_Printing")); |
||||
setMarginWhenPrintCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); |
||||
UILabel tipLabel = GUICoreUtils.createTipLabel(Inter.getLocText("FR-Designer_Tip_Use_Default_Print_Margin")); |
||||
JPanel northPane = GUICoreUtils.createFlowPane(new Component[] { |
||||
setMarginWhenPrintCheck, tipLabel}, FlowLayout.LEFT); |
||||
northPane.setBorder(BorderFactory.createEmptyBorder(8, 10, 10, 0)); |
||||
|
||||
printPane.add(northPane, BorderLayout.NORTH); |
||||
|
||||
centerPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Default_Settings")); |
||||
|
||||
inheritPageMarginSettingCheck = GUICoreUtils.createNoBorderCheckBox(Inter.getLocText("FR-Designer_Inherit_Page_Margin_Setting")); |
||||
pageMarginSettingPane = new PageMarginSettingPane(); |
||||
pageMarginSettingPane.setBorder(BorderFactory.createEmptyBorder(10, -10, 0, 0)); |
||||
JPanel pageMarginCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(inheritPageMarginSettingCheck, pageMarginSettingPane, true); |
||||
|
||||
// TableLayout
|
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {p}; |
||||
double[] columnSize = {60, p}; |
||||
Component[][] components = { |
||||
{getTopAlignLabelPane(Inter.getLocText("FR-Designer_Margin") + ":"), pageMarginCheckPane} |
||||
}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 15); |
||||
|
||||
centerPane.add(panel); |
||||
|
||||
printPane.add(centerPane, BorderLayout.CENTER); |
||||
|
||||
this.setLayout(new BorderLayout()); |
||||
this.add(printPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
private void initListeners() { |
||||
setMarginWhenPrintCheck.addItemListener(new ItemListener() { |
||||
@Override |
||||
public void itemStateChanged(ItemEvent e) { |
||||
checkEnabled(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// 返回包含一个标签的 panel,标签始终位于 panel 顶部
|
||||
private JPanel getTopAlignLabelPane(String labelText) { |
||||
JPanel labelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
labelPane.add(new UILabel(labelText), BorderLayout.NORTH); |
||||
return labelPane; |
||||
} |
||||
|
||||
public void populate(NoClientPrintAttr noClientPrintAttr) { |
||||
setMarginWhenPrintCheck.setSelected(noClientPrintAttr.isSetMarginOnPrint()); |
||||
inheritPageMarginSettingCheck.setSelected(noClientPrintAttr.isInheritPageMarginSetting()); |
||||
pageMarginSettingPane.populate(noClientPrintAttr.getMargin()); |
||||
} |
||||
|
||||
public void update(NoClientPrintAttr noClientPrintAttr) { |
||||
noClientPrintAttr.setSetMarginOnPrint(setMarginWhenPrintCheck.isSelected()); |
||||
noClientPrintAttr.setInheritPageMarginSetting(inheritPageMarginSettingCheck.isSelected()); |
||||
noClientPrintAttr.setMargin(pageMarginSettingPane.updateBean()); |
||||
} |
||||
|
||||
// 刷新面板可用状态
|
||||
public void checkEnabled() { |
||||
GUICoreUtils.setEnabled(centerPane, !setMarginWhenPrintCheck.isSelected()); |
||||
} |
||||
} |
@ -0,0 +1,79 @@
|
||||
package com.fr.design.webattr.printsettings; |
||||
|
||||
import com.fr.base.Margin; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.report.UnitFieldPane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.stable.Constants; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
|
||||
/** |
||||
* Created by plough on 2018/3/5. |
||||
*/ |
||||
public class PageMarginSettingPane extends JPanel { |
||||
private UnitFieldPane marginTopUnitFieldPane; |
||||
private UnitFieldPane marginBottomUnitFieldPane; |
||||
private UnitFieldPane marginLeftUnitFieldPane; |
||||
private UnitFieldPane marginRightUnitFieldPane; |
||||
|
||||
public PageMarginSettingPane() { |
||||
initComponents(); |
||||
} |
||||
private void initComponents() { |
||||
// 页边距设置面板
|
||||
JPanel marginPane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_M_Pane(); |
||||
// left
|
||||
JPanel marginLeftPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); |
||||
marginPane.add(marginLeftPane); |
||||
|
||||
JPanel marginLeftTextPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
||||
marginLeftPane.add(marginLeftTextPane); |
||||
marginLeftTextPane.add(new UILabel(Inter.getLocText("Top") + ":")); |
||||
marginTopUnitFieldPane = new UnitFieldPane(Constants.UNIT_MM); |
||||
marginLeftTextPane.add(marginTopUnitFieldPane); |
||||
JPanel marginLeftUnitPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
||||
marginLeftPane.add(marginLeftUnitPane); |
||||
marginLeftUnitPane.add(new UILabel(Inter.getLocText("Bottom") + ":")); |
||||
marginBottomUnitFieldPane = new UnitFieldPane(Constants.UNIT_MM); |
||||
marginLeftUnitPane.add(marginBottomUnitFieldPane); |
||||
|
||||
// right
|
||||
JPanel marginRightPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); |
||||
marginPane.add(marginRightPane); |
||||
|
||||
// peter:这个一个垂直的上下的字符panel.
|
||||
JPanel marginRightTextPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
||||
marginRightPane.add(marginRightTextPane); |
||||
marginRightTextPane.add(new UILabel(Inter.getLocText("Left") + ":")); |
||||
marginLeftUnitFieldPane = new UnitFieldPane(Constants.UNIT_MM); |
||||
marginRightTextPane.add(marginLeftUnitFieldPane); |
||||
|
||||
JPanel marginRightUnitPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
||||
marginRightPane.add(marginRightUnitPane); |
||||
marginRightUnitPane.add(new UILabel(Inter.getLocText("Right") + ":")); |
||||
marginRightUnitFieldPane = new UnitFieldPane(Constants.UNIT_MM); |
||||
marginRightUnitPane.add(marginRightUnitFieldPane); |
||||
|
||||
this.setLayout(new BorderLayout()); |
||||
this.add(marginPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
public void populate(Margin margin) { |
||||
marginTopUnitFieldPane.setUnitValue(margin.getTop()); |
||||
marginLeftUnitFieldPane.setUnitValue(margin.getLeft()); |
||||
marginBottomUnitFieldPane.setUnitValue(margin.getBottom()); |
||||
marginRightUnitFieldPane.setUnitValue(margin.getRight()); |
||||
} |
||||
|
||||
public Margin updateBean() { |
||||
Margin margin = new Margin(); |
||||
margin.setTop(marginTopUnitFieldPane.getUnitValue()); |
||||
margin.setLeft(marginLeftUnitFieldPane.getUnitValue()); |
||||
margin.setBottom(marginBottomUnitFieldPane.getUnitValue()); |
||||
margin.setRight(marginRightUnitFieldPane.getUnitValue()); |
||||
return margin; |
||||
} |
||||
} |
@ -0,0 +1,112 @@
|
||||
package com.fr.design.webattr.printsettings; |
||||
|
||||
import com.fr.base.print.PrintSettingsAttrMark; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.ibutton.UIRadioButton; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.ButtonGroup; |
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.CardLayout; |
||||
import java.awt.Component; |
||||
import java.awt.FlowLayout; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
|
||||
/** |
||||
* Created by plough on 2018/3/1. |
||||
*/ |
||||
public class PrintSettingPane extends BasicPane { |
||||
private UIRadioButton noClientPrintRadioButton = new UIRadioButton(Inter.getLocText("FR-Engine_No_Client_Print")); |
||||
private UIRadioButton nativePrintRadioButton = new UIRadioButton(Inter.getLocText("FR-Engine_Native_Print")); |
||||
|
||||
private NoClientPrintSettingPane noClientPrintSettingPane; |
||||
private NativePrintSettingPane nativePrintSettingPane; |
||||
private CardLayout printCard; |
||||
private JPanel printPane; |
||||
|
||||
public PrintSettingPane() { |
||||
initComponents(); |
||||
initListener(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
JPanel allPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
this.add(allPanel, BorderLayout.CENTER); |
||||
JPanel north = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); |
||||
allPanel.add(north, BorderLayout.NORTH); |
||||
ButtonGroup buttonGroup = new ButtonGroup(); |
||||
noClientPrintRadioButton.setSelected(true); |
||||
buttonGroup.add(noClientPrintRadioButton); |
||||
buttonGroup.add(nativePrintRadioButton); |
||||
noClientPrintRadioButton.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 50)); |
||||
JPanel radioGroupPane = GUICoreUtils.createFlowPane(new Component[] { |
||||
noClientPrintRadioButton, nativePrintRadioButton}, FlowLayout.LEFT, 0, 0); |
||||
north.add(radioGroupPane); |
||||
|
||||
noClientPrintSettingPane = new NoClientPrintSettingPane(); |
||||
nativePrintSettingPane = new NativePrintSettingPane(); |
||||
printCard = new CardLayout(); |
||||
printPane = new JPanel(); |
||||
printPane.setLayout(printCard); |
||||
printPane.add(noClientPrintRadioButton.getText(), noClientPrintSettingPane); |
||||
printPane.add(nativePrintRadioButton.getText(), nativePrintSettingPane); |
||||
|
||||
north.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
||||
allPanel.add(printPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
private void initListener() { |
||||
noClientPrintRadioButton.addItemListener(new ItemListener() { |
||||
@Override |
||||
public void itemStateChanged(ItemEvent e) { |
||||
if (e.getStateChange() == ItemEvent.SELECTED) { |
||||
printCard.show(printPane, noClientPrintRadioButton.getText()); |
||||
} |
||||
} |
||||
}); |
||||
nativePrintRadioButton.addItemListener(new ItemListener() { |
||||
@Override |
||||
public void itemStateChanged(ItemEvent e) { |
||||
if (e.getStateChange() == ItemEvent.SELECTED) { |
||||
printCard.show(printPane, nativePrintRadioButton.getText()); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// 刷新面板可用状态
|
||||
public void checkEnabled() { |
||||
noClientPrintSettingPane.checkEnabled(); |
||||
nativePrintSettingPane.checkEnabled(); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText("FR-Designer_Print_Setting"); |
||||
} |
||||
|
||||
public void populate(PrintSettingsAttrMark printSettings) { |
||||
if (printSettings.getPrintType() == PrintSettingsAttrMark.NO_CLIENT_PRINT) { |
||||
noClientPrintRadioButton.setSelected(true); |
||||
} else { |
||||
nativePrintRadioButton.setSelected(true); |
||||
} |
||||
noClientPrintSettingPane.populate(printSettings.getNoClientPrintAttr()); |
||||
nativePrintSettingPane.populate(printSettings.getNativePrintAttr()); |
||||
} |
||||
|
||||
public PrintSettingsAttrMark updateBean() { |
||||
PrintSettingsAttrMark printSettings = new PrintSettingsAttrMark(); |
||||
printSettings.setPrintType(noClientPrintRadioButton.isSelected() ? |
||||
PrintSettingsAttrMark.NO_CLIENT_PRINT : PrintSettingsAttrMark.NATIVE_PRINT); |
||||
noClientPrintSettingPane.update(printSettings.getNoClientPrintAttr()); |
||||
nativePrintSettingPane.update(printSettings.getNativePrintAttr()); |
||||
return printSettings; |
||||
} |
||||
} |
@ -0,0 +1,101 @@
|
||||
package com.fr.design.webattr.printsettings; |
||||
|
||||
import com.fr.base.print.PrintSettingsAttrMark; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.report.core.ReportUtils; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Component; |
||||
import java.awt.FlowLayout; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
|
||||
/** |
||||
* 模版->打印设置 |
||||
* Created by plough on 2018/3/6. |
||||
*/ |
||||
public class ReportPrintSettingPane extends BasicPane { |
||||
private static final String[] CHOOSEITEM = new String[] { |
||||
Inter.getLocText("FR-Designer_I_Want_To_Set_Single"), |
||||
Inter.getLocText("FR-Designer_Using_Server_Report_View_Settings") |
||||
}; |
||||
private static final int SINGLE_SET = 0; |
||||
private static final int SERVER_SET = 1; |
||||
|
||||
private UIComboBox chooseComboBox; |
||||
private PrintSettingPane printSettingPane; |
||||
|
||||
public ReportPrintSettingPane() { |
||||
initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
chooseComboBox = new UIComboBox(CHOOSEITEM); |
||||
chooseComboBox.addItemListener(itemListener); |
||||
UILabel belowSetLabel = new UILabel(Inter.getLocText("FR-Designer_Blow_set") + ":"); |
||||
JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[] { |
||||
belowSetLabel, chooseComboBox}, FlowLayout.LEFT, 0, 0); |
||||
buttonPane.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 0)); |
||||
|
||||
printSettingPane = new PrintSettingPane(); |
||||
this.setLayout(new BorderLayout()); |
||||
this.add(buttonPane, BorderLayout.NORTH); |
||||
this.add(printSettingPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
private ItemListener itemListener = new ItemListener() { |
||||
@Override |
||||
public void itemStateChanged(ItemEvent e) { |
||||
if (e.getStateChange() == ItemEvent.SELECTED) { |
||||
if (chooseComboBox.getSelectedIndex() == 0) { |
||||
setSettingPaneEnabled(true); |
||||
} else { |
||||
populateServerSettings(); |
||||
setSettingPaneEnabled(false); |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
|
||||
private void setSettingPaneEnabled(boolean enabled) { |
||||
// GUICoreUtils.setEnabled 会遍历所有 Component。所以要先设置外层,如果是生效的,再设置内层
|
||||
GUICoreUtils.setEnabled(printSettingPane, enabled); |
||||
if (enabled) { |
||||
printSettingPane.checkEnabled(); |
||||
} |
||||
} |
||||
|
||||
private void populateServerSettings() { |
||||
PrintSettingsAttrMark printSettings = ReportUtils.getPrintSettingsFromServerConfig(); |
||||
printSettingPane.populate(printSettings); |
||||
} |
||||
|
||||
public void populate(PrintSettingsAttrMark printSettings) { |
||||
if (!printSettings.isValid()) { // 采用服务器配置
|
||||
chooseComboBox.setSelectedIndex(SERVER_SET); |
||||
populateServerSettings(); |
||||
return; |
||||
} |
||||
chooseComboBox.setSelectedIndex(SINGLE_SET); |
||||
printSettingPane.populate(printSettings); |
||||
} |
||||
|
||||
public PrintSettingsAttrMark updateBean() { |
||||
PrintSettingsAttrMark printSettings = printSettingPane.updateBean(); |
||||
if (chooseComboBox.getSelectedIndex() == SERVER_SET) { |
||||
printSettings.setValid(false); |
||||
} |
||||
return printSettings; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText("FR-Designer_Print_Setting"); |
||||
} |
||||
} |
Loading…
Reference in new issue