neil 9 years ago
parent
commit
bd57556796
  1. 1
      designer/designer.iml
  2. 35
      designer/src/com/fr/design/report/BuildInVerifierPane.java
  3. 37
      designer/src/com/fr/design/report/CustomVerifierPane.java
  4. 113
      designer/src/com/fr/design/report/ValueVerifierEditPane.java
  5. 2
      designer/src/com/fr/design/report/VerifierListPane.java
  6. 4
      designer/src/com/fr/design/report/mobile/AppFitBrowserPane.java
  7. 3
      designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java
  8. 19
      designer_base/src/com/fr/design/ExtraDesignClassManager.java
  9. 5
      designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java
  10. 40
      designer_base/src/com/fr/design/fun/VerifyDefineProvider.java
  11. 20
      designer_base/src/com/fr/design/fun/impl/AbstractVerifyDefineProvider.java
  12. 10
      designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java
  13. 7
      designer_base/src/com/fr/design/gui/ibutton/UITabGroup.java

1
designer/designer.iml

@ -17,5 +17,6 @@
<orderEntry type="module" module-name="designer_base" />
<orderEntry type="module" module-name="engine" />
<orderEntry type="library" name="lib" level="project" />
<orderEntry type="module" module-name="engine-write" />
</component>
</module>

35
designer/src/com/fr/design/report/BuildInVerifierPane.java

@ -0,0 +1,35 @@
package com.fr.design.report;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.report.write.ValueVerifier;
import java.awt.*;
/**
* Created by richie on 16/6/12.
*/
public class BuildInVerifierPane extends BasicBeanPane<ValueVerifier> {
private ValueVerifierEditPane valueVerifierEditPane;
public BuildInVerifierPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
valueVerifierEditPane = new ValueVerifierEditPane();
this.add(valueVerifierEditPane, BorderLayout.CENTER);
}
@Override
public void populateBean(ValueVerifier ob) {
valueVerifierEditPane.populate(ob);
}
@Override
public ValueVerifier updateBean() {
return valueVerifierEditPane.update();
}
@Override
protected String title4PopupWindow() {
return "BuiltIn";
}
}

37
designer/src/com/fr/design/report/CustomVerifierPane.java

@ -0,0 +1,37 @@
package com.fr.design.report;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.report.write.WClassVerifier;
import java.awt.*;
/**
* Created by richie on 16/6/12.
*/
public class CustomVerifierPane extends BasicBeanPane<WClassVerifier> {
private CustomVerifyJobPane pane;
public CustomVerifierPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
pane = new CustomVerifyJobPane();
this.add(pane, BorderLayout.CENTER);
}
@Override
public void populateBean(WClassVerifier ob) {
this.pane.populateBean(ob.getClassVerifyJob());
}
@Override
public WClassVerifier updateBean() {
WClassVerifier verifier = new WClassVerifier();
verifier.setClassVerifyJob(this.pane.updateBean());
return verifier;
}
@Override
protected String title4PopupWindow() {
return "custom";
}
}

113
designer/src/com/fr/design/report/ValueVerifierEditPane.java

@ -2,11 +2,15 @@ package com.fr.design.report;
import com.fr.base.Formula;
import com.fr.data.Verifier;
import com.fr.data.VerifyItem;
import com.fr.design.gui.itableeditorpane.ActionStyle;
import com.fr.design.gui.itableeditorpane.UIArrayTableModel;
import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.GeneralUtils;
import com.fr.general.Inter;
import com.fr.report.write.ValueVerifier;
import com.fr.stable.FormulaProvider;
import com.fr.stable.bridge.StableFactory;
import com.fr.write.ReportWriteAttrProvider;
import com.fr.write.ValueVerifierProvider;
@ -32,116 +36,35 @@ public class ValueVerifierEditPane extends JPanel {
/**
* populate
*/
public void populate(ReportWriteAttrProvider reportWriteAttr) {
if (reportWriteAttr == null) {
public void populate(ValueVerifier valueVerifier) {
if (valueVerifier == null) {
return;
}
int rowCount = reportWriteAttr.getVerifierCount();
Object[][] os = new Object[reportWriteAttr.getValueVerifierCount()][];
int cnt = 0;
for (int i = 0; i < rowCount; i++) {
if (!(reportWriteAttr.getVerifier(i) instanceof ValueVerifierProvider)) {
continue;
}
Formula formula = ((ValueVerifierProvider)reportWriteAttr.getVerifier(i)).getFormula();
int rowCount = valueVerifier.getVerifyItemsCount();
Object[][] os = new Object[rowCount][];
int tableDataCount = 0;
for (int i = 0; i < rowCount; i ++) {
VerifyItem item = valueVerifier.getVerifyItem(i);
FormulaProvider formula = item.getFormula();
if (formula == null) {
continue;
}
String formulaContent = formula.getContent().substring(1);
String message = reportWriteAttr.getVerifier(i).getMessage();
os[cnt++] = new Object[] { formulaContent, message };
os[tableDataCount++] = new Object[]{formula.getPureContent(), item.getMessage()};
}
this.tableEditorPane.populate(os);
}
/**
* update
*/
public void update(ReportWriteAttrProvider reportWriteAttr, String name) {
public ValueVerifier update() {
ValueVerifier valueVerifier = new ValueVerifier();
java.util.List<Object[]> list = tableEditorPane.update();
reportWriteAttr.clearVerifiers(true);
for (int i = 0; i < list.size(); i++) {
Object[] o = list.get(i);
if (o == null || o[0] == null) {
continue;
}
ValueVerifierProvider p = StableFactory.getMarkedInstanceObjectFromClass(ValueVerifierProvider.TAG, ValueVerifierProvider.class);
p.setFormula(new Formula(readValueVerifyObject(o[0])));
p.setMessage(readValueVerifyObject(o[1]));
reportWriteAttr.addVerifier(name, (Verifier) p);
// reportWriteAttr.addVerifier(name, new ValueVerifier(readValueVerifyObject(o[0]), readValueVerifyObject(o[1])));
VerifyItem item = new VerifyItem(new Formula(GeneralUtils.objectToString(o[0])), GeneralUtils.objectToString(o[1]));
valueVerifier.addVerifyItem(item);
}
}
private String readValueVerifyObject(Object obj) {
if (obj == null) {
return null;
}
return obj.toString();
return valueVerifier;
}
}
//public class ValueVerifierEditPane extends BasicBeanPane<ValueVerifier> {
// private ValueVerifier valueVerifier;
// private UITextArea formula = new UITextArea();
// private UITextArea message = new UITextArea();
// private int col = 60;
// private int row = 5;
//
// public ValueVerifierEditPane() {
// valueVerifier = new ValueVerifier();
//
// this.setLayout(new FlowLayout());
//
// JPanel formulaPane = new JPanel();
// UIScrollPane formulaScrollPane = new UIScrollPane(formula);
// formula.setRows(row);
// formula.setColumns(col);
// formula.setLineWrap(true);
// formula.setToolTipText(Inter.getLocText("Verify-ToolTips"));
// UILabel fl = new UILabel(Inter.getLocText("Verify-Verify_Formula"));
// fl.setPreferredSize(new Dimension(80, 20));
// formulaPane.add(fl);
// formulaPane.add(formulaScrollPane);
//
// JPanel messagePane = new JPanel();
// UIScrollPane messageScrollPane = new UIScrollPane(message);
// message.setRows(row);
// message.setColumns(col);
// message.setLineWrap(true);
// UILabel ml = new UILabel(Inter.getLocText("Verify-Error_Information"));
// ml.setPreferredSize(new Dimension(80, 20));
// messagePane.add(ml);
// messagePane.add(messageScrollPane);
//
// this.add(formulaPane);
// this.add(messagePane);
// }
//
// @Override
// public void populateBean(ValueVerifier ob) {
// valueVerifier = ob;
// if (ob != null) {
// if (ob.getFormula() != null) {
// String content = ob.getFormula().getContent();
// formula.setText(content.startsWith("=") ? content.substring(1) : content);
// } else {
// formula.setText("");
// }
// message.setText(ob.getMessage());
// }
// }
//
// @Override
// public ValueVerifier updateBean() {
// valueVerifier.setFormula(new Formula(formula.getText()));
// valueVerifier.setMessage(message.getText());
// return valueVerifier;
// }
//
// @Override
// protected String title4PopupWindow() {
// return "valueVerifierPane";
// }
//}

2
designer/src/com/fr/design/report/VerifierListPane.java

File diff suppressed because one or more lines are too long

4
designer/src/com/fr/design/report/mobile/AppFitBrowserPane.java

@ -36,7 +36,7 @@ public class AppFitBrowserPane extends BasicBeanPane<ElementCaseMobileAttr> {
JPanel fitOpsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
horizionPane = new MobileRadioGroupPane(Inter.getLocText("FR-Designer_Mobile-Horizontal"));
verticalPane = new MobileRadioGroupPane(Inter.getLocText("FR-Designer_Mobile-Vertical"));
radioCheckPane = new MobileRadioCheckPane(Inter.getLocText("FR-Designer_Mobile-ZOOM"));
radioCheckPane = new MobileRadioCheckPane(Inter.getLocText("FR-Designer_Mobile-Zoom"));
ActionListener actionListener = getAppPreviewActionListener();
horizionPane.addActionListener(actionListener);
verticalPane.addActionListener(actionListener);
@ -64,7 +64,7 @@ public class AppFitBrowserPane extends BasicBeanPane<ElementCaseMobileAttr> {
}
horizionPane.populateBean(ob.getHorziontalAttr());
verticalPane.populateBean(ob.getVerticalAttr());
radioCheckPane.populateBean(ob.getZoom());
radioCheckPane.populateBean(ob.isZoom());
appFitPreviewPane.refreshPreview(getCurrentFitOptions());
}

3
designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java

@ -10,7 +10,6 @@ import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
@ -27,7 +26,7 @@ public class MobileRadioCheckPane extends BasicBeanPane<Boolean> {
double[] rowSize = {p};
double[] columnSize = {p,p};
UICheckBox checkBox = new UICheckBox(Inter.getLocText("FS-CPT_ZOOM"));
UICheckBox checkBox = new UICheckBox(Inter.getLocText("FR-Designer_Mobile-Open"));
checkBox.setSelected(true);
checkBoxes.add(checkBox);

19
designer_base/src/com/fr/design/ExtraDesignClassManager.java

@ -138,6 +138,8 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
private Set<BackgroundUIProvider> backgroundUIProviders;
private Set<VerifyDefineProvider> verifyDefineProviders;
public TableDataPaneProcessor getTableDataPaneProcessor() {
return tableDataPaneProcessor;
}
@ -804,6 +806,21 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
backgroundUIProviders.add((BackgroundUIProvider) level);
}
public VerifyDefineProvider[] getVerifyDefineProviders() {
if (verifyDefineProviders == null) {
return new VerifyDefineProvider[0];
}
return verifyDefineProviders.toArray(new VerifyDefineProvider[verifyDefineProviders.size()]);
}
private void addVerifyDefineProvider(Level level, PluginSimplify simplify) throws Exception {
if (verifyDefineProviders == null) {
verifyDefineProviders = new HashSet<>();
}
validAPILevel(level, VerifyDefineProvider.CURRENT_LEVEL, simplify.getPluginName());
verifyDefineProviders.add((VerifyDefineProvider) level);
}
/**
* 文件名
*
@ -902,6 +919,8 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
addWidgetAttrProvider(impl, simplify);
} else if (tagName.equals(ExportAttrTabProvider.XML_TAG)) {
addExportAttrTabProvider(impl, simplify);
} else if (tagName.equals(VerifyDefineProvider.MARK_STRING)) {
addVerifyDefineProvider(impl, simplify);
}
} catch (PluginInvalidLevelException e) {
PluginMessage.remindUpdate(e.getMessage());

5
designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java

@ -13,6 +13,8 @@ import com.fr.stable.StringUtils;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.*;
import java.util.List;
import java.util.regex.Pattern;
/**
@ -35,6 +37,9 @@ public class ColumnSelectedEditor extends Editor<SimpleDSColumn> {
@Override
public void itemStateChanged(ItemEvent e) {
//这边需要重新初始化columnNames, 否则nameList长度和columnNames长度不同导致出錯。
List<String> nameList = tableDataComboBox.getSelectedItem().calculateColumnNameList();
columnNames = new String[nameList.size()];
columnNames = tableDataComboBox.getSelectedItem().calculateColumnNameList().toArray(columnNames);
columnNameComboBox.removeAllItems();
for (int i = 0; i < columnNames.length; i++) {

40
designer_base/src/com/fr/design/fun/VerifyDefineProvider.java

@ -0,0 +1,40 @@
package com.fr.design.fun;
import com.fr.data.Verifier;
import com.fr.design.beans.BasicBeanPane;
import com.fr.stable.fun.Level;
import com.fr.stable.fun.Provider;
/**
* Created by richie on 16/6/8.
*/
public interface VerifyDefineProvider extends Level, Provider {
String MARK_STRING = "VerifyDefineProvider";
int CURRENT_LEVEL = 1;
/**
* 对应的校验类
* @return 校验类
*/
Class<? extends Verifier> classForVerifier();
/**
* 校验设置的界面
* @return 界面
*/
Class<? extends BasicBeanPane> appearanceForVerifier();
/**
* 此种类型的校验的名字
* @return 名字
*/
String nameForVerifier();
/**
* 菜单图标
* @return 图标路径
*/
String iconPath();
}

20
designer_base/src/com/fr/design/fun/impl/AbstractVerifyDefineProvider.java

@ -0,0 +1,20 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.VerifyDefineProvider;
import com.fr.stable.fun.impl.AbstractProvider;
/**
* Created by richie on 16/6/8.
*/
public abstract class AbstractVerifyDefineProvider extends AbstractProvider implements VerifyDefineProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

10
designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java

@ -1,12 +1,6 @@
package com.fr.design.gui.ibutton;
import java.awt.BorderLayout;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
@ -174,7 +168,7 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
return BorderFactory.createEmptyBorder(1, 1, 1, 1);
}
protected GridLayout getGridLayout(int number) {
protected LayoutManager getGridLayout(int number) {
return new GridLayout(0, number, 1, 0);
}

7
designer_base/src/com/fr/design/gui/ibutton/UITabGroup.java

@ -1,9 +1,6 @@
package com.fr.design.gui.ibutton;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.RenderingHints;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.Icon;
@ -38,7 +35,7 @@ public class UITabGroup extends UIButtonGroup<Integer> {
}
@Override
protected GridLayout getGridLayout(int number) {
protected LayoutManager getGridLayout(int number) {
if (number < BUTTON_NUMBER || isOneLineTab) {
return super.getGridLayout(number);
} else if (number == BUTTON_NUMBER || number == SEVEN_NUMBER) {

Loading…
Cancel
Save