43 changed files with 464 additions and 584 deletions
@ -1,55 +1,47 @@ |
|||||||
package com.fr.design.report; |
package com.fr.design.report; |
||||||
|
|
||||||
import java.awt.BorderLayout; |
import java.awt.BorderLayout; |
||||||
|
|
||||||
import javax.swing.JPanel; |
import com.fr.page.ReportSettingsProvider; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
import com.fr.page.ReportSettingsProvider; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
import com.fr.design.gui.icheckbox.UICheckBox; |
import com.fr.design.dialog.BasicPane; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.general.Inter; |
||||||
import com.fr.design.dialog.BasicPane; |
import com.fr.design.style.background.BackgroundPane; |
||||||
import com.fr.general.Inter; |
|
||||||
import com.fr.design.style.background.BackgroundPane; |
public class ReportBackgroundPane extends BasicPane { |
||||||
|
private UICheckBox isPrintBackgroundCheckBox; |
||||||
public class ReportBackgroundPane extends BasicPane { |
private BackgroundPane backgroundPane; |
||||||
private UICheckBox isPrintBackgroundCheckBox; |
|
||||||
private UICheckBox isExportBackgroundCheckBox; |
public ReportBackgroundPane() { |
||||||
private BackgroundPane backgroundPane; |
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
|
||||||
public ReportBackgroundPane() { |
backgroundPane = new BackgroundPane(); |
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
this.add(backgroundPane, BorderLayout.CENTER); |
||||||
|
|
||||||
backgroundPane = new BackgroundPane(); |
isPrintBackgroundCheckBox = new UICheckBox( |
||||||
this.add(backgroundPane, BorderLayout.CENTER); |
Inter.getLocText("ReportGUI-Print_Background")); |
||||||
|
this.add(isPrintBackgroundCheckBox, BorderLayout.SOUTH); |
||||||
isPrintBackgroundCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Print_Background")); |
} |
||||||
isExportBackgroundCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Export_Background")); |
|
||||||
JPanel sourth = new JPanel(); |
@Override |
||||||
sourth.add(isExportBackgroundCheckBox); |
protected String title4PopupWindow() { |
||||||
sourth.add(isPrintBackgroundCheckBox); |
return Inter.getLocText(new String[]{"paper", "Background"}); |
||||||
this.add(sourth, BorderLayout.SOUTH); |
} |
||||||
} |
|
||||||
|
/** |
||||||
@Override |
* Populate |
||||||
protected String title4PopupWindow() { |
*/ |
||||||
return Inter.getLocText(new String[]{"paper", "Background"}); |
public void populate(ReportSettingsProvider reportSettings) { |
||||||
} |
this.backgroundPane.populate(reportSettings.getBackground()); |
||||||
|
this.isPrintBackgroundCheckBox.setSelected(reportSettings.isPrintBackground()); |
||||||
/** |
} |
||||||
* Populate |
|
||||||
*/ |
/** |
||||||
public void populate(ReportSettingsProvider reportSettings) { |
* update |
||||||
this.backgroundPane.populate(reportSettings.getBackground()); |
*/ |
||||||
this.isPrintBackgroundCheckBox.setSelected(reportSettings.isPrintBackground()); |
public void update(ReportSettingsProvider reportSettings) { |
||||||
this.isExportBackgroundCheckBox.setSelected(reportSettings.isExportBackground()); |
reportSettings.setBackground(this.backgroundPane.update()); |
||||||
} |
reportSettings.setPrintBackground(this.isPrintBackgroundCheckBox.isSelected()); |
||||||
|
} |
||||||
/** |
|
||||||
* update |
|
||||||
*/ |
|
||||||
public void update(ReportSettingsProvider reportSettings) { |
|
||||||
reportSettings.setBackground(this.backgroundPane.update()); |
|
||||||
reportSettings.setPrintBackground(this.isPrintBackgroundCheckBox.isSelected()); |
|
||||||
reportSettings.setExportBackground(this.isExportBackgroundCheckBox.isSelected()); |
|
||||||
} |
|
||||||
} |
} |
@ -1,100 +1 @@ |
|||||||
package com.fr.design.report; |
package com.fr.design.report;
import com.fr.data.Verifier;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.VerifyDefineProvider;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.ObjectJControlPane;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.general.Inter;
import com.fr.general.NameObject;
import com.fr.report.write.ReportWriteAttr;
import com.fr.report.write.ValueVerifier;
import com.fr.report.write.WClassVerifier;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable;
import java.util.ArrayList;
import java.util.Set;
/**
* 校验列表
*/
public class VerifierListPane extends ObjectJControlPane {
public VerifierListPane(ElementCasePane ePane) {
super(ePane);
}
/**
* 创建选项
*
* @return 选项
*/
public NameableCreator[] createNameableCreators() {
NameableCreator[] creators = new NameableCreator[]{
new NameObjectCreator(Inter.getLocText(new String[]{"BuildIn", "Verify"}),
"/com/fr/web/images/reportlet.png",
ValueVerifier.class,
BuildInVerifierPane.class)
};
Set<VerifyDefineProvider> set = ExtraDesignClassManager.getInstance().getArray(VerifyDefineProvider.MARK_STRING);
for (VerifyDefineProvider provider : set) {
creators = ArrayUtils.add(creators, new NameObjectCreator(
provider.nameForVerifier(),
provider.iconPath(),
provider.classForVerifier(),
provider.appearanceForVerifier()
) {
});
}
creators = ArrayUtils.add(creators, new NameObjectCreator(
Inter.getLocText(new String[]{"Custom", "Verify"}),
"/com/fr/web/images/reportlet.png",
WClassVerifier.class,
CustomVerifierPane.class));
return creators;
}
@Override
protected String title4PopupWindow() {
return "Verify Collections";
}
public void populate(ReportWriteAttr reportWriteAttr) {
if (reportWriteAttr == null) {
return;
}
java.util.List<NameObject> nameObjectList = new ArrayList<>();
int verifierCount = reportWriteAttr.getVerifierCount();
for (int i = 0; i < verifierCount; i++) {
Verifier verifier = reportWriteAttr.getVerifier(i);
nameObjectList.add(new NameObject(verifier.getName(), verifier));
}
this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()]));
}
public void updateReportWriteAttr(ReportWriteAttr reportWriteAttr) {
// Nameable[]居然不能强转成NameObject[],一定要这么写...
Nameable[] res = this.update();
NameObject[] res_array = new NameObject[res.length];
java.util.Arrays.asList(res).toArray(res_array);
reportWriteAttr.clearVerifiers();
for (int i = 0; i < res_array.length; i++) {
NameObject nameObject = res_array[i];
if (nameObject.getObject() instanceof Verifier) {
Verifier verifier = (Verifier) nameObject.getObject();
verifier.setName(nameObject.getName());
reportWriteAttr.addVerifier(verifier);
}
}
}
} |
||||||
|
|
||||||
import com.fr.data.Verifier; |
|
||||||
import com.fr.design.ExtraDesignClassManager; |
|
||||||
import com.fr.design.fun.VerifyDefineProvider; |
|
||||||
import com.fr.design.gui.controlpane.NameObjectCreator; |
|
||||||
import com.fr.design.gui.controlpane.NameableCreator; |
|
||||||
import com.fr.design.gui.controlpane.ObjectJControlPane; |
|
||||||
import com.fr.design.mainframe.ElementCasePane; |
|
||||||
import com.fr.general.Inter; |
|
||||||
import com.fr.general.NameObject; |
|
||||||
import com.fr.report.write.ReportWriteAttr; |
|
||||||
import com.fr.report.write.ValueVerifier; |
|
||||||
import com.fr.report.write.WClassVerifier; |
|
||||||
import com.fr.stable.ArrayUtils; |
|
||||||
import com.fr.stable.Nameable; |
|
||||||
|
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.Set; |
|
||||||
|
|
||||||
/** |
|
||||||
* 校验列表 |
|
||||||
*/ |
|
||||||
public class VerifierListPane extends ObjectJControlPane { |
|
||||||
|
|
||||||
public VerifierListPane(ElementCasePane ePane) { |
|
||||||
super(ePane); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 创建选项 |
|
||||||
* |
|
||||||
* @return 选项 |
|
||||||
*/ |
|
||||||
public NameableCreator[] createNameableCreators() { |
|
||||||
NameableCreator[] creators = new NameableCreator[]{ |
|
||||||
new NameObjectCreator(Inter.getLocText(new String[]{"BuildIn", "Verify"}), |
|
||||||
"/com/fr/web/images/reportlet.png", |
|
||||||
ValueVerifier.class, |
|
||||||
BuildInVerifierPane.class) |
|
||||||
}; |
|
||||||
Set<VerifyDefineProvider> set = ExtraDesignClassManager.getInstance().getArray(VerifyDefineProvider.MARK_STRING); |
|
||||||
for (VerifyDefineProvider provider : set) { |
|
||||||
creators = ArrayUtils.add(creators, new NameObjectCreator( |
|
||||||
provider.nameForVerifier(), |
|
||||||
provider.iconPath(), |
|
||||||
provider.classForVerifier(), |
|
||||||
provider.appearanceForVerifier() |
|
||||||
) { |
|
||||||
}); |
|
||||||
} |
|
||||||
creators = ArrayUtils.add(creators, new NameObjectCreator( |
|
||||||
Inter.getLocText(new String[]{"Custom", "Verify"}), |
|
||||||
"/com/fr/web/images/reportlet.png", |
|
||||||
WClassVerifier.class, |
|
||||||
CustomVerifierPane.class)); |
|
||||||
return creators; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
|
||||||
return "Verify Collections"; |
|
||||||
} |
|
||||||
|
|
||||||
public void populate(ReportWriteAttr reportWriteAttr) { |
|
||||||
if (reportWriteAttr == null) { |
|
||||||
return; |
|
||||||
} |
|
||||||
|
|
||||||
java.util.List<NameObject> nameObjectList = new ArrayList<NameObject>(); |
|
||||||
|
|
||||||
int verifierCount = reportWriteAttr.getVerifierCount(); |
|
||||||
for (int i = 0; i < verifierCount; i++) { |
|
||||||
Verifier verifier = reportWriteAttr.getVerifier(i); |
|
||||||
nameObjectList.add(new NameObject(verifier.getName(), verifier)); |
|
||||||
} |
|
||||||
|
|
||||||
this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); |
|
||||||
} |
|
||||||
|
|
||||||
public void updateReportWriteAttr(ReportWriteAttr reportWriteAttr) { |
|
||||||
// Nameable[]居然不能强转成NameObject[],一定要这么写...
|
|
||||||
Nameable[] res = this.update(); |
|
||||||
NameObject[] res_array = new NameObject[res.length]; |
|
||||||
java.util.Arrays.asList(res).toArray(res_array); |
|
||||||
|
|
||||||
reportWriteAttr.clearVerifiers(); |
|
||||||
|
|
||||||
for (int i = 0; i < res_array.length; i++) { |
|
||||||
NameObject nameObject = res_array[i]; |
|
||||||
if (nameObject.getObject() instanceof Verifier) { |
|
||||||
Verifier verifier = (Verifier) nameObject.getObject(); |
|
||||||
verifier.setName(nameObject.getName()); |
|
||||||
reportWriteAttr.addVerifier(verifier); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
Loading…
Reference in new issue