forked from fanruan/design
mengao
7 years ago
75 changed files with 1635 additions and 1429 deletions
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 19 KiB |
@ -1,47 +1,55 @@
|
||||
package com.fr.design.report; |
||||
|
||||
import java.awt.BorderLayout; |
||||
|
||||
import com.fr.page.ReportSettingsProvider; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.style.background.BackgroundPane; |
||||
|
||||
public class ReportBackgroundPane extends BasicPane { |
||||
private UICheckBox isPrintBackgroundCheckBox; |
||||
private BackgroundPane backgroundPane; |
||||
|
||||
public ReportBackgroundPane() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
|
||||
backgroundPane = new BackgroundPane(); |
||||
this.add(backgroundPane, BorderLayout.CENTER); |
||||
|
||||
isPrintBackgroundCheckBox = new UICheckBox( |
||||
Inter.getLocText("ReportGUI-Print_Background")); |
||||
this.add(isPrintBackgroundCheckBox, BorderLayout.SOUTH); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText(new String[]{"paper", "Background"}); |
||||
} |
||||
|
||||
/** |
||||
* Populate |
||||
*/ |
||||
public void populate(ReportSettingsProvider reportSettings) { |
||||
this.backgroundPane.populate(reportSettings.getBackground()); |
||||
this.isPrintBackgroundCheckBox.setSelected(reportSettings.isPrintBackground()); |
||||
} |
||||
|
||||
/** |
||||
* update |
||||
*/ |
||||
public void update(ReportSettingsProvider reportSettings) { |
||||
reportSettings.setBackground(this.backgroundPane.update()); |
||||
reportSettings.setPrintBackground(this.isPrintBackgroundCheckBox.isSelected()); |
||||
} |
||||
package com.fr.design.report; |
||||
|
||||
import java.awt.BorderLayout; |
||||
|
||||
import javax.swing.JPanel; |
||||
|
||||
import com.fr.page.ReportSettingsProvider; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.style.background.BackgroundPane; |
||||
|
||||
public class ReportBackgroundPane extends BasicPane { |
||||
private UICheckBox isPrintBackgroundCheckBox; |
||||
private UICheckBox isExportBackgroundCheckBox; |
||||
private BackgroundPane backgroundPane; |
||||
|
||||
public ReportBackgroundPane() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
|
||||
backgroundPane = new BackgroundPane(); |
||||
this.add(backgroundPane, BorderLayout.CENTER); |
||||
|
||||
isPrintBackgroundCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Print_Background")); |
||||
isExportBackgroundCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Export_Background")); |
||||
JPanel sourth = new JPanel(); |
||||
sourth.add(isExportBackgroundCheckBox); |
||||
sourth.add(isPrintBackgroundCheckBox); |
||||
this.add(sourth, BorderLayout.SOUTH); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText(new String[]{"paper", "Background"}); |
||||
} |
||||
|
||||
/** |
||||
* Populate |
||||
*/ |
||||
public void populate(ReportSettingsProvider reportSettings) { |
||||
this.backgroundPane.populate(reportSettings.getBackground()); |
||||
this.isPrintBackgroundCheckBox.setSelected(reportSettings.isPrintBackground()); |
||||
this.isExportBackgroundCheckBox.setSelected(reportSettings.isExportBackground()); |
||||
} |
||||
|
||||
/** |
||||
* update |
||||
*/ |
||||
public void update(ReportSettingsProvider reportSettings) { |
||||
reportSettings.setBackground(this.backgroundPane.update()); |
||||
reportSettings.setPrintBackground(this.isPrintBackgroundCheckBox.isSelected()); |
||||
reportSettings.setExportBackground(this.isExportBackgroundCheckBox.isSelected()); |
||||
} |
||||
} |
@ -1 +1,100 @@
|
||||
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);
}
}
}
} |
||||
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<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); |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
@ -1,34 +0,0 @@
|
||||
package com.fr.design.extra; |
||||
|
||||
import com.fr.base.FRContext; |
||||
import com.fr.stable.StableUtils; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import java.io.FileInputStream; |
||||
import java.util.Properties; |
||||
|
||||
/** |
||||
* Created by vito on 16/4/22. |
||||
*/ |
||||
public class PluginStoreConstants { |
||||
|
||||
public static final String VERSION = loadAttribute("VERSION", ""); |
||||
|
||||
private static Properties PROP = null; |
||||
|
||||
private static String loadAttribute(String key, String defaultValue) { |
||||
if (PROP == null) { |
||||
PROP = new Properties(); |
||||
try { |
||||
PROP.load(new FileInputStream(StableUtils.pathJoin(FRContext.getCurrentEnv().getWebReportPath(), "scripts/store/web/plugin_store.properties"))); |
||||
} catch (Exception e) { |
||||
} |
||||
} |
||||
String p = PROP.getProperty(key); |
||||
if (StringUtils.isEmpty(p)) { |
||||
p = defaultValue; |
||||
} |
||||
return p; |
||||
} |
||||
|
||||
} |
@ -1,56 +1,43 @@
|
||||
package com.fr.design.gui.itextarea; |
||||
|
||||
import java.awt.Color; |
||||
import java.awt.Graphics; |
||||
import java.awt.Graphics2D; |
||||
import java.awt.Shape; |
||||
import java.awt.event.MouseAdapter; |
||||
import java.awt.event.MouseEvent; |
||||
import java.awt.geom.RoundRectangle2D; |
||||
|
||||
import javax.swing.JComponent; |
||||
import javax.swing.plaf.basic.BasicTextAreaUI; |
||||
import javax.swing.text.JTextComponent; |
||||
|
||||
import com.fr.design.constants.UIConstants; |
||||
import com.fr.design.utils.gui.GUIPaintUtils; |
||||
|
||||
public class UITextAreaUI extends BasicTextAreaUI { |
||||
protected boolean isRollOver; |
||||
private JComponent textField; |
||||
|
||||
public UITextAreaUI(final JComponent textField) { |
||||
super(); |
||||
this.textField = textField; |
||||
this.textField.addMouseListener(new MouseAdapter() { |
||||
@Override |
||||
public void mouseEntered(MouseEvent e) { |
||||
isRollOver = true; |
||||
textField.repaint(); |
||||
} |
||||
|
||||
@Override |
||||
public void mouseExited(MouseEvent e) { |
||||
isRollOver = false; |
||||
textField.repaint(); |
||||
} |
||||
}); |
||||
} |
||||
import javax.swing.*; |
||||
import javax.swing.plaf.basic.BasicTextAreaUI; |
||||
import java.awt.*; |
||||
import java.awt.event.MouseAdapter; |
||||
import java.awt.event.MouseEvent; |
||||
|
||||
@Override |
||||
protected void paintBackground(Graphics g) { |
||||
JTextComponent editor = getComponent(); |
||||
int width = editor.getWidth(); |
||||
int height = editor.getHeight(); |
||||
Graphics2D g2d = (Graphics2D)g; |
||||
g2d.clearRect(0, 0, width, height); |
||||
if(isRollOver && textField.isEnabled() && ((UITextArea)textField).isEditable()) { |
||||
Shape shape = new RoundRectangle2D.Double(1, 1, width - 3, height - 3, UIConstants.ARC, UIConstants.ARC); |
||||
GUIPaintUtils.paintBorderShadow(g2d, 3, shape, UIConstants.HOVER_BLUE, Color.WHITE); |
||||
} else { |
||||
g2d.setColor(UIConstants.LINE_COLOR); |
||||
g2d.drawRoundRect(1, 1, width - 2, height - 2, UIConstants.ARC, UIConstants.ARC); |
||||
} |
||||
} |
||||
public class UITextAreaUI extends BasicTextAreaUI { |
||||
protected boolean isRollOver; |
||||
private JComponent textField; |
||||
|
||||
public UITextAreaUI(final JComponent textField) { |
||||
super(); |
||||
this.textField = textField; |
||||
this.textField.addMouseListener(new MouseAdapter() { |
||||
@Override |
||||
public void mouseEntered(MouseEvent e) { |
||||
isRollOver = true; |
||||
textField.repaint(); |
||||
} |
||||
|
||||
@Override |
||||
public void mouseExited(MouseEvent e) { |
||||
isRollOver = false; |
||||
textField.repaint(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
public void paintBorder(Graphics2D g2d, int width, int height, boolean isRound, int rectDirection) { |
||||
if (isRollOver && textField.isEnabled()) { |
||||
g2d.setColor(UIConstants.TEXT_FILED_BORDER_SELECTED); |
||||
g2d.drawRect(0, 0, width - 1, height - 1); |
||||
} else { |
||||
GUIPaintUtils.drawBorder(g2d, 0, 0, width, height, isRound, rectDirection); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,42 @@
|
||||
package com.fr.design.mainframe.chart.gui.type; |
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
|
||||
/** |
||||
* Created by mengao on 2017/8/30. |
||||
* 不能删掉这个类,echarts插件中用到 |
||||
*/ |
||||
public abstract class UserDefinedChartTypePane extends AbstractChartTypePane { |
||||
protected String[] getTypeLayoutPath() { |
||||
return new String[0]; |
||||
} |
||||
|
||||
protected String[] getTypeLayoutTipName(){ |
||||
return new String[0]; |
||||
} |
||||
|
||||
protected String[] getTypeIconPath(){ |
||||
return new String[]{"/com/fr/design/images/chart/default.png"}; |
||||
} |
||||
|
||||
protected String[] getTypeTipName() { |
||||
return new String[]{title4PopupWindow()}; |
||||
} |
||||
|
||||
public void updateBean(Chart chart) { |
||||
|
||||
} |
||||
|
||||
public void populateBean(Chart chart){ |
||||
typeDemo.get(0).isPressing = true; |
||||
checkDemosBackground(); |
||||
} |
||||
|
||||
/** |
||||
* 弹出界面的标题 |
||||
* @return 标题 |
||||
*/ |
||||
public String title4PopupWindow(){ |
||||
return ""; |
||||
} |
||||
} |
Loading…
Reference in new issue