daniel 8 years ago
parent
commit
b609ff32a3
  1. 6
      designer/src/com/fr/design/actions/report/ReportBackgroundAction.java
  2. 2
      designer/src/com/fr/design/report/mobile/AppFitBrowserPane.java
  3. 2
      designer/src/com/fr/design/report/mobile/AppFitPreviewPane.java
  4. 66
      designer/src/com/fr/design/report/mobile/MobileRadioGroupPane.java
  5. 106
      designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java
  6. 2
      designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java
  7. 54
      designer_base/src/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  8. 3
      designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java
  9. 112
      designer_base/src/com/fr/design/dialog/mobile/MobileUseHtmlGroupBeanPane.java
  10. 22
      designer_base/src/com/fr/design/fun/DBTableDataMenuHandler.java
  11. 20
      designer_base/src/com/fr/design/fun/DesignerStartOpenFileProcessor.java
  12. 34
      designer_base/src/com/fr/design/fun/impl/AbstractDBTableDataMenuHandler.java
  13. 18
      designer_base/src/com/fr/design/fun/impl/AbstractDesignerStartOpenFileProcessor.java
  14. BIN
      designer_base/src/com/fr/design/images/buttonicon/delete.png
  15. BIN
      designer_base/src/com/fr/design/images/dialog/appfit/H4.png
  16. BIN
      designer_base/src/com/fr/design/images/dialog/appfit/V4.png
  17. 15
      designer_base/src/com/fr/design/locale/designer.properties
  18. 16
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  19. 15
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  20. 15
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  21. 17
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  22. 15
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  23. 53
      designer_base/src/com/fr/design/style/background/BackgroundButtonPane.java
  24. 48
      designer_base/src/com/fr/design/style/background/BackgroundFactory.java
  25. 55
      designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane.java
  26. 5
      designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane4Browser.java
  27. 79
      designer_base/src/com/fr/design/style/background/impl/ImageButtonBackgroundPane.java
  28. 38
      designer_base/src/com/fr/design/style/color/ColorPicker.java
  29. 2
      designer_base/src/com/fr/design/style/color/ColorSelectDialog.java
  30. 10
      designer_base/src/com/fr/design/style/color/PickColorButtonFactory.java
  31. 12
      designer_base/src/com/fr/start/BaseDesigner.java
  32. 12
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java
  33. 2
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/ReportDataPane.java
  34. 2
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/TableDataPane.java
  35. 23
      designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java
  36. 13
      designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java
  37. 117
      designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java
  38. 53
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java
  39. 12
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java
  40. 186
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java
  41. 8
      designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java
  42. 14
      designer_form/src/com/fr/design/designer/properties/mobile/MobileFitAlignmentItems.java
  43. 35
      designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java
  44. 29
      designer_form/src/com/fr/design/form/mobile/MobileUseHtmlGroupPane.java
  45. 13
      designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleImgBackgroundEditor.java

6
designer/src/com/fr/design/actions/report/ReportBackgroundAction.java

@ -37,16 +37,14 @@ public class ReportBackgroundAction extends ReportComponentAction<ReportComponen
}
final ReportBackgroundPane bPane = new ReportBackgroundPane();
bPane.populate(ReportUtils.getReportSettings(reportPane.getTemplateReport()));
BasicDialog bDialog = bPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
bPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
bPane.update(reportPane.getTemplateReport().getReportSettings());
reportPane.fireTargetModified();
}
});
bDialog.setModal(false);
bDialog.setVisible(true);
}).setVisible(true);
return false;
}
}

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

@ -75,7 +75,7 @@ public class AppFitBrowserPane extends BasicBeanPane<ElementCaseMobileAttr> {
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Fit-App");
return Inter.getLocText("FR-Designer_Fit");
}
private ActionListener getAppPreviewActionListener() {

2
designer/src/com/fr/design/report/mobile/AppFitPreviewPane.java

@ -35,10 +35,12 @@ public class AppFitPreviewPane extends BasicPane{
cachedVerticalPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/V1.png")));
cachedVerticalPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/V2.png")));
cachedVerticalPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/V3.png")));
cachedVerticalPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/V4.png")));
cachedHorizonPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/H0.png")));
cachedHorizonPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/H1.png")));
cachedHorizonPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/H2.png")));
cachedHorizonPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/H3.png")));
cachedHorizonPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/H4.png")));
}
private void initComponents() {

66
designer/src/com/fr/design/report/mobile/MobileRadioGroupPane.java

@ -1,11 +1,12 @@
package com.fr.design.report.mobile;
import com.fr.base.mobile.MobileFitAttrState;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.base.mobile.MobileFitAttrState;
import com.fr.general.data.index.Index;
import com.fr.stable.StringUtils;
import javax.swing.*;
@ -19,7 +20,7 @@ import java.util.List;
*/
public class MobileRadioGroupPane extends BasicBeanPane<MobileFitAttrState>{
private List<UIRadioButton> radioButtons = new ArrayList<UIRadioButton>();
private List<IndexRadioButton> radioButtons = new ArrayList<IndexRadioButton>();
public MobileRadioGroupPane(String title) {
initComponents(title);
@ -28,28 +29,35 @@ public class MobileRadioGroupPane extends BasicBeanPane<MobileFitAttrState>{
private void initComponents(String title) {
double p = TableLayout.PREFERRED;
double[] rowSize = {p};
double[] columnSize = {p, p, p, p, p};
double[] columnSize = {p, p, p, p, p, p};
UIRadioButton defaultRadio = new UIRadioButton(MobileFitAttrState.DEFAULT.description());
IndexRadioButton defaultRadio = new IndexRadioButton(MobileFitAttrState.DEFAULT.description(), MobileFitAttrState.DEFAULT);
defaultRadio.setSelected(true);
UIRadioButton horizonRadio = new UIRadioButton(MobileFitAttrState.HORIZONTAL.description());
UIRadioButton verticalRadio = new UIRadioButton(MobileFitAttrState.VERTICAL.description());
UIRadioButton notFitRadio = new UIRadioButton(MobileFitAttrState.NONE.description());
IndexRadioButton horizonRadio = new IndexRadioButton(MobileFitAttrState.HORIZONTAL.description(), MobileFitAttrState.HORIZONTAL);
IndexRadioButton verticalRadio = new IndexRadioButton(MobileFitAttrState.VERTICAL.description(), MobileFitAttrState.VERTICAL);
IndexRadioButton bidirectionalRadio = new IndexRadioButton(MobileFitAttrState.BIDIRECTIONAL.description(), MobileFitAttrState.BIDIRECTIONAL);
IndexRadioButton notFitRadio = new IndexRadioButton(MobileFitAttrState.NONE.description(), MobileFitAttrState.NONE);
addToButtonGroup(defaultRadio, horizonRadio, verticalRadio, notFitRadio);
addToButtonGroup(defaultRadio, horizonRadio, verticalRadio, notFitRadio, bidirectionalRadio);
Component[][] components = new Component[][]{
new Component[]{new UILabel(title), defaultRadio, horizonRadio, verticalRadio, notFitRadio}
new Component[] {
new UILabel(title),
defaultRadio,
horizonRadio,
verticalRadio,
bidirectionalRadio,
notFitRadio
}
};
JPanel fitOpsPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
fitOpsPane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10));
this.add(fitOpsPane);
}
private void addToButtonGroup(UIRadioButton... radios) {
private void addToButtonGroup(IndexRadioButton... radios) {
ButtonGroup buttonGroup = new ButtonGroup();
for (UIRadioButton radio : radios) {
for (IndexRadioButton radio : radios) {
radioButtons.add(radio);
buttonGroup.add(radio);
}
@ -59,7 +67,7 @@ public class MobileRadioGroupPane extends BasicBeanPane<MobileFitAttrState>{
* 设置按钮状态
*/
public void setEnabled(boolean enabled) {
for (UIRadioButton radioButton : radioButtons) {
for (IndexRadioButton radioButton : radioButtons) {
radioButton.setEnabled(enabled);
}
}
@ -72,7 +80,7 @@ public class MobileRadioGroupPane extends BasicBeanPane<MobileFitAttrState>{
public int getSelectRadioIndex() {
for (int i = 0, len = radioButtons.size(); i < len; i++) {
if (radioButtons.get(i).isSelected()) {
return i;
return radioButtons.get(i).getRadioButtonIndex();
}
}
@ -87,15 +95,18 @@ public class MobileRadioGroupPane extends BasicBeanPane<MobileFitAttrState>{
return;
}
UIRadioButton button = radioButtons.get(index);
button.setSelected(true);
for (IndexRadioButton radioButton : this.radioButtons) {
if (radioButton.getRadioButtonIndex() == index) {
radioButton.setSelected(true);
}
}
}
/**
* 给所有的按钮加上监听
*/
public void addActionListener(ActionListener actionListener) {
for (UIRadioButton radioButton : radioButtons) {
for (IndexRadioButton radioButton : radioButtons) {
radioButton.addActionListener(actionListener);
}
}
@ -116,3 +127,24 @@ public class MobileRadioGroupPane extends BasicBeanPane<MobileFitAttrState>{
return StringUtils.EMPTY;
}
}
/**
* created by fanglei on 2017/1/16
* 不再用radioButtonGroup的数组下标作为index而是给每个按钮传入MobileFitAttrState的枚举值
*/
class IndexRadioButton extends UIRadioButton {
private int index;
IndexRadioButton(String text, MobileFitAttrState mobileFitAttrState) {
super(text);
this.index = mobileFitAttrState.getState();
}
public int getRadioButtonIndex() {
return this.index;
}
public void setRadioButtonIndex(int index) {
this.index = index;
}
}

106
designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java

@ -1,109 +1,12 @@
package com.fr.design.report.mobile;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.UITitledBorder;
import com.fr.design.gui.ibutton.UIRadioButton;
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.general.Inter;
import com.fr.design.dialog.mobile.MobileUseHtmlGroupBeanPane;
import com.fr.report.mobile.ElementCaseMobileAttr;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
/**
* Created by kunsnat on 2016/8/3.
*/
public class MobileUseHtmlGroupPane extends BasicBeanPane<ElementCaseMobileAttr> {
private List<UIRadioButton> radioButtons = new ArrayList<UIRadioButton>();
public MobileUseHtmlGroupPane() {
initComponents();
}
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(UITitledBorder.createBorderWithTitle(this.title4PopupWindow()));
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p};
double[] columnSize = {p, p, p};
UIRadioButton useApp = new UIRadioButton(Inter.getLocText("FR-mobile_native_analysis"));
useApp.setSelected(true);
UIRadioButton useHTML5 = new UIRadioButton(Inter.getLocText("FR-mobile_html_analysis"));
addToButtonGroup(useApp, useHTML5);
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-mobile_analysis_style")), useApp, useHTML5},
new Component[]{new UILabel(Inter.getLocText("FR-mobile_analysis_annotation")), null, null}
};
JPanel usePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
usePane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10));
this.add(usePane);
}
private void addToButtonGroup(UIRadioButton... radios) {
ButtonGroup buttonGroup = new ButtonGroup();
for (UIRadioButton radio : radios) {
radioButtons.add(radio);
buttonGroup.add(radio);
}
}
/**
* 设置按钮状态
*/
public void setEnabled(boolean enabled) {
for (UIRadioButton radioButton : radioButtons) {
radioButton.setEnabled(enabled);
}
}
/**
* 获取当前选中的按钮index
*
* @return 按钮index
*/
public int getSelectRadioIndex() {
for (int i = 0, len = radioButtons.size(); i < len; i++) {
if (radioButtons.get(i).isSelected()) {
return i;
}
}
return 0;
}
/**
* 选中指定index的按钮
*/
public void selectIndexButton(int index) {
if (index < 0 || index > radioButtons.size() - 1) {
return;
}
UIRadioButton button = radioButtons.get(index);
button.setSelected(true);
}
/**
* 给所有的按钮加上监听
*/
public void addActionListener(ActionListener actionListener) {
for (UIRadioButton radioButton : radioButtons) {
radioButton.addActionListener(actionListener);
}
}
public class MobileUseHtmlGroupPane extends MobileUseHtmlGroupBeanPane<ElementCaseMobileAttr> {
@Override
public void populateBean(ElementCaseMobileAttr mobileAttr) {
if(mobileAttr != null) {
@ -122,9 +25,4 @@ public class MobileUseHtmlGroupPane extends BasicBeanPane<ElementCaseMobileAttr>
mobileAttr.setUseHTML(getSelectRadioIndex() == 1);
}
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-mobile_report_analysis");
}
}

2
designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java

@ -65,6 +65,6 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Fit-App");
return Inter.getLocText("FR-Designer_Mobile-Attr");
}
}

54
designer_base/src/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java

@ -7,6 +7,7 @@ import com.fr.base.ParameterHelper;
import com.fr.data.core.db.TableProcedure;
import com.fr.data.impl.DBTableData;
import com.fr.data.impl.NameDatabaseConnection;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
@ -17,6 +18,7 @@ import com.fr.design.data.datapane.sqlpane.SQLEditPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.fun.DBTableDataMenuHandler;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itableeditorpane.ParameterTableModel;
@ -34,7 +36,6 @@ import com.fr.general.Inter;
import com.fr.script.Calculator;
import com.fr.stable.ArrayUtils;
import com.fr.stable.ParameterProvider;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import javax.swing.*;
@ -53,11 +54,13 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
private ConnectionTableProcedurePane connectionTableProcedurePane;
private UITableEditorPane<ParameterProvider> editorPane;
private DBTableDataMenuHandler dbTableDataMenuHandler;
private SQLEditPane sqlTextPane;
private UICheckBox isShareCheckBox;
private MaxMemRowCountPanel maxPanel;
private String pageQuery = null;
private String customCountQuery = null;
private DBTableData dbTableData;
public DBTableDataPane() {
@ -149,11 +152,9 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
}
private void refresh() {
String[] paramTexts = new String[3];
String[] paramTexts = new String[2];
paramTexts[0] = sqlTextPane.getText();
paramTexts[1] = pageQuery;
paramTexts[2] = customCountQuery;
List<ParameterProvider> existParameterList = editorPane.update();
Parameter[] ps = existParameterList == null ? new Parameter[0] : existParameterList.toArray(new Parameter[existParameterList.size()]);
@ -166,8 +167,11 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
toolBarDef.addShortCut(new PreviewAction());
toolBarDef.addShortCut(SeparatorDef.DEFAULT);
toolBarDef.addShortCut(new EditPageQueryAction());
dbTableDataMenuHandler = ExtraDesignClassManager.getInstance().getSingle(DBTableDataMenuHandler.MARK_STRING);
if (dbTableDataMenuHandler != null) {
toolBarDef.addShortCut(SeparatorDef.DEFAULT);
toolBarDef.addShortCut(new EditCustomCountQueryAction());
toolBarDef.addShortCut(dbTableDataMenuHandler.createQueryAction());
}
isShareCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Is_Share_DBTableData"));
maxPanel = new MaxMemRowCountPanel();
maxPanel.setBorder(null);
@ -179,11 +183,9 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
}
private void checkParameter() {
String[] paramTexts = new String[3];
String[] paramTexts = new String[2];
paramTexts[0] = sqlTextPane.getText();
paramTexts[1] = pageQuery;
paramTexts[2] = customCountQuery;
Parameter[] parameters = ParameterHelper.analyze4Parameters(paramTexts, false);
if (parameters.length < 1 && editorPane.update().size() < 1) {
@ -210,6 +212,10 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
@Override
public void populateBean(DBTableData dbtabledata) {
this.dbTableData = dbtabledata;
if (dbTableDataMenuHandler != null) {
dbTableDataMenuHandler.populate(dbtabledata);
}
ParameterProvider[] parameters = null;
Calculator c = Calculator.createCalculator();
@ -227,8 +233,6 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
isShare = dbtabledata.isShare();
maxMemeryRow = dbtabledata.getMaxMemRowCount();
this.pageQuery = dbtabledata.getPageQuerySql();
this.customCountQuery = dbtabledata.getCustomCountQuery();
this.connectionTableProcedurePane.setSelectedDatabaseConnection(db);
this.sqlTextPane.setText(query);
this.sqlTextPane.requestFocus();
@ -253,7 +257,6 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
List<ParameterProvider> parameterList = editorPane.update();
Parameter[] parameters = parameterList.toArray(new Parameter[parameterList.size()]);
DBTableData dbTableData = new DBTableData();
dbTableData.setDatabase(new NameDatabaseConnection(dbName));
// p:必须先设置Parameters数组,因为setQuery里面会自动设置的
@ -264,8 +267,9 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
dbTableData.setShare(isShareCheckBox.isSelected());
dbTableData.setMaxMemRowCount(maxPanel.getValue());
dbTableData.setPageQuerySql(this.pageQuery);
dbTableData.setCustomCountQuery(this.customCountQuery);
if (dbTableDataMenuHandler != null) {
dbTableDataMenuHandler.update();
}
return dbTableData;
}
@ -318,28 +322,6 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
}
}
private class EditCustomCountQueryAction extends UpdateAction {
public EditCustomCountQueryAction() {
this.setName(Inter.getLocText("FR-Designer-LayerPageReport_CustomCountQuery"));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/text.png"));
}
@Override
public void actionPerformed(ActionEvent e) {
final QueryPane editPane = new QueryPane(Inter.getLocText("FR-Designer-LayerPageReport_Define_CustomCountQuery"));
editPane.populate(customCountQuery);
BasicDialog dialog = editPane.showWindow(DesignerContext.getDesignerFrame());
dialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() {
customCountQuery = editPane.update();
checkParameter();
}
});
dialog.setVisible(true);
}
}
private class QueryPane extends BasicPane {
private SQLEditPane pageQueryPane;
private String title;

3
designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java

@ -299,7 +299,6 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
text = StringUtils.EMPTY;
}
text = text.trim();
String[] tableName = text.split("\\.");
String connectionname = this.connectionTableProcedurePane.getSelectedDatabaseConnnectonName();
try {
String procedureText = FRContext.getCurrentEnv().getProcedureText(this.connectionTableProcedurePane.getSelectedDatabaseConnnectonName(), text);
@ -316,7 +315,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
}
StoreProcedureParameter[] newparameters;
newparameters = FRContext.getCurrentEnv().getStoreProcedureDeclarationParameters(connectionname, tableName[tableName.length - 1], parameterDefaultValue);
newparameters = FRContext.getCurrentEnv().getStoreProcedureDeclarationParameters(connectionname, text, parameterDefaultValue);
editorPane.populate(newparameters);

112
designer_base/src/com/fr/design/dialog/mobile/MobileUseHtmlGroupBeanPane.java

@ -0,0 +1,112 @@
package com.fr.design.dialog.mobile;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.UITitledBorder;
import com.fr.design.gui.ibutton.UIRadioButton;
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.general.Inter;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
/**
* 由于MobileUserHtmlGroupPane 现在在report和form中均会用到会出现重复代码故放入base中
* Created by fanglei on 2016/12/28.
*/
public abstract class MobileUseHtmlGroupBeanPane<T> extends BasicBeanPane<T> {
private List<UIRadioButton> radioButtons = new ArrayList<UIRadioButton>();
public MobileUseHtmlGroupBeanPane() {
initComponents();
}
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(UITitledBorder.createBorderWithTitle(this.title4PopupWindow()));
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p};
double[] columnSize = {p, p, p};
UIRadioButton useApp = new UIRadioButton(Inter.getLocText("FR-mobile_native_analysis"));
useApp.setSelected(true);
UIRadioButton useHTML5 = new UIRadioButton(Inter.getLocText("FR-mobile_html_analysis"));
addToButtonGroup(useApp, useHTML5);
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-mobile_analysis_style")), useApp, useHTML5},
new Component[]{new UILabel(Inter.getLocText("FR-mobile_analysis_annotation")), null, null}
};
JPanel usePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
usePane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10));
this.add(usePane);
}
private void addToButtonGroup(UIRadioButton... radios) {
ButtonGroup buttonGroup = new ButtonGroup();
for (UIRadioButton radio : radios) {
radioButtons.add(radio);
buttonGroup.add(radio);
}
}
/**
* 设置按钮状态
*/
public void setEnabled(boolean enabled) {
for (UIRadioButton radioButton : radioButtons) {
radioButton.setEnabled(enabled);
}
}
/**
* 获取当前选中的按钮index
*
* @return 按钮index
*/
public int getSelectRadioIndex() {
for (int i = 0, len = radioButtons.size(); i < len; i++) {
if (radioButtons.get(i).isSelected()) {
return i;
}
}
return 0;
}
/**
* 选中指定index的按钮
*/
public void selectIndexButton(int index) {
if (index < 0 || index > radioButtons.size() - 1) {
return;
}
UIRadioButton button = radioButtons.get(index);
button.setSelected(true);
}
/**
* 给所有的按钮加上监听
*/
public void addActionListener(ActionListener actionListener) {
for (UIRadioButton radioButton : radioButtons) {
radioButton.addActionListener(actionListener);
}
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-mobile_report_analysis");
}
}

22
designer_base/src/com/fr/design/fun/DBTableDataMenuHandler.java

@ -0,0 +1,22 @@
package com.fr.design.fun;
import com.fr.data.impl.DBTableData;
import com.fr.design.actions.UpdateAction;
import com.fr.stable.fun.mark.Immutable;
/**
* Created by xiaxiang on 2017/1/15.
*/
public interface DBTableDataMenuHandler extends Immutable {
String MARK_STRING = "DBTableDataMenuHandler";
int CURRENT_LEVEL = 1;
UpdateAction createQueryAction();
void populate(DBTableData dbTableData);
DBTableData update();
}

20
designer_base/src/com/fr/design/fun/DesignerStartOpenFileProcessor.java

@ -0,0 +1,20 @@
package com.fr.design.fun;
import com.fr.file.FILE;
import com.fr.stable.fun.mark.Immutable;
/**
* 指定设计器启动时默认打开的文件
* Created by rinoux on 2016/12/16.
*/
public interface DesignerStartOpenFileProcessor extends Immutable {
int CURRENT_LEVEL = 1;
String XML_TAG = "DesignerStartOpenFileProcessor";
/**
* 显示需要打开的报表文件
*/
FILE fileToShow();
}

34
designer_base/src/com/fr/design/fun/impl/AbstractDBTableDataMenuHandler.java

@ -0,0 +1,34 @@
package com.fr.design.fun.impl;
import com.fr.data.impl.DBTableData;
import com.fr.design.actions.UpdateAction;
import com.fr.design.fun.DBTableDataMenuHandler;
import com.fr.stable.fun.mark.API;
/**
* Created by xiaxiang on 2017/1/15.
*/
@API(level = DBTableDataMenuHandler.CURRENT_LEVEL)
public abstract class AbstractDBTableDataMenuHandler implements DBTableDataMenuHandler {
public int currentAPILevel() {
return CURRENT_LEVEL;
}
public int layerIndex() {
return DEFAULT_LAYER_INDEX;
}
public UpdateAction createQueryAction() {
return null;
}
@Override
public DBTableData update() {
return null;
}
@Override
public void populate(DBTableData dbTableData) {
}
}

18
designer_base/src/com/fr/design/fun/impl/AbstractDesignerStartOpenFileProcessor.java

@ -0,0 +1,18 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.DesignerStartOpenFileProcessor;
import com.fr.stable.fun.mark.API;
/**
* Created by rinoux on 2016/12/16.
*/
@API(level = DesignerStartOpenFileProcessor.CURRENT_LEVEL)
public abstract class AbstractDesignerStartOpenFileProcessor implements DesignerStartOpenFileProcessor {
public int currentAPILevel() {
return DesignerStartOpenFileProcessor.CURRENT_LEVEL;
}
public int layerIndex() {
return DEFAULT_LAYER_INDEX;
}
}

BIN
designer_base/src/com/fr/design/images/buttonicon/delete.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

BIN
designer_base/src/com/fr/design/images/dialog/appfit/H4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
designer_base/src/com/fr/design/images/dialog/appfit/V4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

15
designer_base/src/com/fr/design/locale/designer.properties

@ -100,7 +100,7 @@ FR-Designer_FS_Close_Other_Templates=
FR-Designer_File=
FR-Designer_Filter_Conditions=
FR-Designer_Finish-Modify-Share=
FR-Designer_Fit-App=
FR-Designer_Fit=
FR-Designer_Font-Family=
FR-Designer_Font-Size=
FR-Designer_Forbid_Drag_into_Adapt_Pane=Forbid Drag into Para Pane
@ -508,3 +508,16 @@ FR-Designer_Form_Basic_Properties=
FR-Designer_DS_Dictionary=
FR-Designer_Create_Tree=
FR-Designer_Set_Callback_Function=
FR-Designer_ConfirmDialog_Content=
FR-Designer_ConfirmDialog_Title=
FR-Designer_Background_Null=
FR-Designer_Background_Color=
FR-Designer_Background_Texture=
FR-Designer_Background_Pattern=
FR-Designer_Background_Gradient_Color=
FR-Designer_Background_Image=
FR-Designer_Background_Clear=
FR-Designer_Background_Image_Select=
FR-Designer_Tab_carousel=
FR-Designer_setCarousel=
FR-Designer_carouselInterval=

16
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -100,7 +100,7 @@ FR-Designer_FS_Close_Other_Templates=Close other templates
FR-Designer_File=file
FR-Designer_Filter_Conditions=Filter condition
FR-Designer_Finish-Modify-Share=Finish Modification And Share
FR-Designer_Fit-App=App self-adaption
FR-Designer_Fit=self-adaption
FR-Designer_Font-Family=Font name
FR-Designer_Font-Size=Font size
FR-Designer_Forbid_Drag_into_Adapt_Pane=Form body cannot be dragged into the object
@ -508,4 +508,16 @@ FR-Designer_Form_Basic_Properties=Basic Property
FR-Designer_DS_Dictionary=Data Dictionary
FR-Designer_Create_Tree=Build Tree
FR-Designer_Set_Callback_Function=Set Callback Function
FR-Designer_ConfirmDialog_Content=
FR-Designer_ConfirmDialog_Title=
FR-Designer_Background_Null=No Background
FR-Designer_Background_Color=Color
FR-Designer_Background_Texture=Texture
FR-Designer_Background_Pattern=Pattern
FR-Designer_Background_Gradient_Color=Gradient Color
FR-Designer_Background_Image=Image
FR-Designer_Background_Clear=Clear
FR-Designer_Background_Image_Select=Select Picture
FR-Designer_Tab_carousel=
FR-Designer_setCarousel=
FR-Designer_carouselInterval=

15
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -100,7 +100,7 @@ FR-Designer_FS_Close_Other_Templates=\u305D\u306E\u4ED6\u30C6\u30F3\u30D7\u30EC\
FR-Designer_File=\u30D5\u30A1\u30A4\u30EB
FR-Designer_Filter_Conditions=\u9078\u5225\u6761\u4EF6
FR-Designer_Finish-Modify-Share=\u4FEE\u6B63\u3092\u5B8C\u4E86\u3057\u3066\u30B7\u30A7\u30A2
FR-Designer_Fit-App=App\u81EA\u9069\u5FDC
FR-Designer_Fit=\u81EA\u9069\u5FDC
FR-Designer_Font-Family=\u30D5\u30A9\u30F3\u30C8\u540D\u79F0
FR-Designer_Font-Size=\u30D5\u30A9\u30F3\u30C8\u5927\u5C0F
FR-Designer_Forbid_Drag_into_Adapt_Pane=\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306F\u30D5\u30A9\u30FC\u30E0\u672C\u6587\u3092\u30C9\u30E9\u30C3\u30B0\u3059\u308B\u3053\u3068\u306F\u8A31\u3055\u308C\u306A\u3044
@ -487,3 +487,16 @@ FR-Designer_Form_Basic_Properties=
FR-Designer_DS_Dictionary=
FR-Designer_Create_Tree=
FR-Designer_Set_Callback_Function=
FR-Designer_ConfirmDialog_Content=
FR-Designer_ConfirmDialog_Title=
FR-Designer_Background_Null=
FR-Designer_Background_Color=
FR-Designer_Background_Texture=
FR-Designer_Background_Pattern=
FR-Designer_Background_Gradient_Color=
FR-Designer_Background_Image=
FR-Designer_Background_Clear=
FR-Designer_Background_Image_Select=
FR-Designer_Tab_carousel=
FR-Designer_setCarousel=
FR-Designer_carouselInterval=

15
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -100,7 +100,7 @@ FR-Designer_FS_Close_Other_Templates=\uAE30\uD0C0\uD15C\uD50C\uB9BF\uB2EB\uAE30
FR-Designer_File=\uD30C\uC77C
FR-Designer_Filter_Conditions=\uD544\uD130\uC870\uAC74
FR-Designer_Finish-Modify-Share=\uC218\uC815\uC644\uB8CC\uBC0F\uACF5\uC720
FR-Designer_Fit-App=App\uC790\uAE30\uC801\uC751
FR-Designer_Fit=\uC790\uAE30\uC801\uC751
FR-Designer_Font-Family=\uAE00\uAF34\uBA85\uCE6D
FR-Designer_Font-Size=\uAE00\uAF34\uD06C\uAE30
FR-Designer_Forbid_Drag_into_Adapt_Pane=\uD574\uB2F9\uAC1D\uCCB4\uB294\uD3FC\uD14C\uC774\uBE14\uBC14\uB514\uB4DC\uB798\uADF8\uB97C\uD5C8\uC6A9\uD558\uC9C0\uC54A\uC2B5\uB2C8\uB2E4.
@ -482,3 +482,16 @@ FR-Designer_Form_Basic_Properties=
FR-Designer_DS_Dictionary=
FR-Designer_Create_Tree=
FR-Designer_Set_Callback_Function=
FR-Designer_ConfirmDialog_Content=
FR-Designer_ConfirmDialog_Title=
FR-Designer_Background_Null=
FR-Designer_Background_Color=
FR-Designer_Background_Texture=
FR-Designer_Background_Pattern=
FR-Designer_Background_Gradient_Color=
FR-Designer_Background_Image=
FR-Designer_Background_Clear=
FR-Designer_Background_Image_Select=
FR-Designer_Tab_carousel=
FR-Designer_setCarousel=
FR-Designer_carouselInterval=

17
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -100,7 +100,7 @@ FR-Designer_FS_Close_Other_Templates=\u5173\u95ED\u5176\u4ED6\u6A21\u677F
FR-Designer_File=\u6587\u4EF6
FR-Designer_Filter_Conditions=\u8FC7\u6EE4\u6761\u4EF6
FR-Designer_Finish-Modify-Share=\u5B8C\u6210\u4FEE\u6539\u5E76\u5206\u4EAB
FR-Designer_Fit-App=App\u81EA\u9002\u5E94
FR-Designer_Fit=\u81EA\u9002\u5E94
FR-Designer_Font-Family=\u5B57\u4F53\u540D\u79F0
FR-Designer_Font-Size=\u5B57\u4F53\u5927\u5C0F
FR-Designer_Forbid_Drag_into_Adapt_Pane=\u8BE5\u5BF9\u8C61\u4E0D\u5141\u8BB8\u62D6\u5165\u8868\u5355\u4E3B\u4F53
@ -422,7 +422,7 @@ FR-Designer-Website_Url=http\://www.finereport.com/
FR-Designer-BBSLogin_Download-Unlogin-Tip=\u767B\u5F55\u540E\u624D\u80FD\u4E0B\u8F7D
FR-Designer-App_ReLayout=\u624B\u673A\u91CD\u5E03\u5C40
FR-Designer_Mobile-Attr=\u79FB\u52A8\u7AEF\u5C5E\u6027
FR-Designer_Mobile-Vertical=\u7AD6\u5C4FF
FR-Designer_Mobile-Vertical=\u7AD6\u5C4F
FR-Designer_Mobile-Horizontal=\u6A2A\u5C4F
FR-Designer_COMMUNITY=\u793E\u533A
FR-Designer_COMMUNITY_BBS=\u5E06\u8F6F\u8BBA\u575B
@ -512,3 +512,16 @@ FR-Designer_Form_Basic_Properties=\u57FA\u672C\u5C5E\u6027
FR-Designer_DS_Dictionary=\u6570\u636E\u5B57\u5178
FR-Designer_Create_Tree=\u6784\u5EFA\u6811
FR-Designer_Set_Callback_Function=\u8BBE\u7F6E\u56DE\u8C03\u51FD\u6570
FR-Designer_ConfirmDialog_Content=\u662F\u5426\u786E\u5B9A\u5220\u9664tab\u63A7\u4EF6
FR-Designer_ConfirmDialog_Title=FineReport 8.0
FR-Designer_Background_Null=\u6CA1\u6709\u80CC\u666F
FR-Designer_Background_Color=\u989C\u8272
FR-Designer_Background_Texture=\u7EB9\u7406
FR-Designer_Background_Pattern=\u56FE\u6848
FR-Designer_Background_Gradient_Color=\u6E10\u53D8\u8272
FR-Designer_Background_Image=\u56FE\u7247
FR-Designer_Background_Clear=\u6E05\u9664
FR-Designer_Background_Image_Select=\u9009\u62E9\u56FE\u7247
FR-Designer_Tab_carousel=tab\u8F6E\u64AD
FR-Designer_setCarousel=\u5F00\u542F\u8F6E\u64AD
FR-Designer_carouselInterval=\u8F6E\u64AD\u95F4\u9694

15
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -100,7 +100,7 @@ FR-Designer_FS_Close_Other_Templates=\u95DC\u9589\u5176\u4ED6\u7BC4\u672C
FR-Designer_File=\u6A94\u6848
FR-Designer_Filter_Conditions=\u904E\u6FFE\u689D\u4EF6
FR-Designer_Finish-Modify-Share=\u5B8C\u6210\u4FEE\u6539\u4E26\u5206\u4EAB
FR-Designer_Fit-App=App\u81EA\u9069\u61C9
FR-Designer_Fit=\u81EA\u9069\u61C9
FR-Designer_Font-Family=\u5B57\u9AD4\u540D\u7A31
FR-Designer_Font-Size=\u5B57\u9AD4\u5927\u5C0F
FR-Designer_Forbid_Drag_into_Adapt_Pane=\u8A72\u5C0D\u8C61\u4E0D\u5141\u8A31\u62D6\u5165\u8868\u55AE\u4E3B\u9AD4
@ -500,3 +500,16 @@ FR-Designer_Form_Basic_Properties=
FR-Designer_DS_Dictionary=
FR-Designer_Create_Tree=
FR-Designer_Set_Callback_Function=
FR-Designer_ConfirmDialog_Content=
FR-Designer_ConfirmDialog_Title=
FR-Designer_Background_Null=
FR-Designer_Background_Color=
FR-Designer_Background_Texture=
FR-Designer_Background_Pattern=
FR-Designer_Background_Gradient_Color=
FR-Designer_Background_Image=
FR-Designer_Background_Clear=
FR-Designer_Background_Image_Select=
FR-Designer_Tab_carousel=
FR-Designer_setCarousel=
FR-Designer_carouselInterval=

53
designer_base/src/com/fr/design/style/background/BackgroundButtonPane.java

@ -0,0 +1,53 @@
package com.fr.design.style.background;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Background;
import com.fr.general.Inter;
/**
* Created by ibm on 2017/1/5.
*/
public class BackgroundButtonPane extends BackgroundPane {
public BackgroundButtonPane() {
super();
}
protected void initTabPane() {
int index = 0;
for (Class<? extends Background> key : BackgroundFactory.buttonKindsOfKey()) {
BackgroundUIWrapper wrapper = BackgroundFactory.getButtonWrapper(key);
wrapper.setIndex(index++);
tabbedPane.addTab(Inter.getLocText(wrapper.getTitle()), FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane());
}
}
protected BackgroundUIWrapper getBackgroundUIWrapper(Background background) {
return BackgroundFactory.getButtonWrapper(background == null ? null : background.getClass());
}
protected BackgroundDetailPane getTabItemPane(Background background, int index) {
BackgroundDetailPane quickPane = cacheMap.get(index);
if (quickPane == null) {
quickPane = BackgroundFactory.createButtonIfAbsent(background == null ? null : background.getClass());
quickPane.addChangeListener(backgroundChangeListener);
cacheMap.put(index, quickPane);
}
tabbedPane.setComponentAt(index, quickPane);
tabbedPane.setSelectedIndex(index);
return quickPane;
}
protected BackgroundDetailPane getTabItemPaneByIndex(int index) {
BackgroundDetailPane quickPane = cacheMap.get(index);
if (quickPane == null) {
quickPane = BackgroundFactory.createButtonIfAbsent(index);
tabbedPane.setComponentAt(index, quickPane);
cacheMap.put(index, quickPane);
quickPane.addChangeListener(backgroundChangeListener);
}
return quickPane;
}
}

48
designer_base/src/com/fr/design/style/background/BackgroundFactory.java

@ -3,7 +3,6 @@ package com.fr.design.style.background;
import com.fr.base.background.*;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.BackgroundQuickUIProvider;
import com.fr.design.fun.BackgroundUIProvider;
import com.fr.design.style.background.gradient.GradientBackgroundPane;
import com.fr.design.style.background.impl.*;
@ -21,6 +20,7 @@ public class BackgroundFactory {
private static Map<Class<? extends Background>, BackgroundUIWrapper> map = new LinkedHashMap<>();
private static Map<Class<? extends Background>, BackgroundUIWrapper> browser = new LinkedHashMap<>();
private static Map<Class<? extends Background>, BackgroundUIWrapper> button = new LinkedHashMap<>();
static {
registerUniversal(map);
@ -29,29 +29,38 @@ public class BackgroundFactory {
registerBrowserImageBackground(browser);
registerExtra(map);
registerExtra(browser);
registerButtonBackground(button);
}
private static void registerUniversal(Map<Class<? extends Background>, BackgroundUIWrapper> map) {
map.put(null, BackgroundUIWrapper.create()
.setType(NullBackgroundPane.class).setTitle(Inter.getLocText("Background-Null")));
.setType(NullBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Null")));
map.put(ColorBackground.class, BackgroundUIWrapper.create()
.setType(ColorBackgroundPane.class).setTitle(Inter.getLocText("Color")));
.setType(ColorBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Color")));
map.put(TextureBackground.class, BackgroundUIWrapper.create()
.setType(TextureBackgroundPane.class).setTitle(Inter.getLocText("Background-Texture")));
.setType(TextureBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Texture")));
map.put(PatternBackground.class, BackgroundUIWrapper.create()
.setType(PatternBackgroundPane.class).setTitle(Inter.getLocText("Background-Pattern")));
.setType(PatternBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Pattern")));
map.put(GradientBackground.class, BackgroundUIWrapper.create()
.setType(GradientBackgroundPane.class).setTitle(Inter.getLocText("Gradient-Color")));
.setType(GradientBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Gradient_Color")));
}
private static void registerImageBackground(Map<Class<? extends Background>, BackgroundUIWrapper> map) {
map.put(ImageBackground.class, BackgroundUIWrapper.create()
.setType(ImageBackgroundPane.class).setTitle(Inter.getLocText("Image")));
.setType(ImageBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Image")));
}
private static void registerBrowserImageBackground(Map<Class<? extends Background>, BackgroundUIWrapper> map) {
map.put(ImageBackground.class, BackgroundUIWrapper.create()
.setType(ImageBackgroundPane4Browser.class).setTitle(Inter.getLocText("Image")));
.setType(ImageBackgroundPane4Browser.class).setTitle(Inter.getLocText("FR-Designer_Background_Image")));
}
private static void registerButtonBackground(Map<Class<? extends Background>, BackgroundUIWrapper> map){
map.put(ColorBackground.class, BackgroundUIWrapper.create()
.setType(ColorBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Color")));
map.put(ImageBackground.class, BackgroundUIWrapper.create()
.setType(ImageButtonBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Image")));
}
private static void registerExtra(Map<Class<? extends Background>, BackgroundUIWrapper> map) {
@ -85,6 +94,29 @@ public class BackgroundFactory {
return new NullBackgroundPane();
}
public static Set<Class<? extends Background>> buttonKindsOfKey() {
return button.keySet();
}
public static BackgroundUIWrapper getButtonWrapper(Class<? extends Background> category) {
return button.get(category);
}
public static BackgroundDetailPane createButtonIfAbsent(Class<? extends Background> category) {
BackgroundUIWrapper wrapper = button.get(category);
return createByWrapper(wrapper);
}
public static BackgroundDetailPane createButtonIfAbsent(int index) {
for (BackgroundUIWrapper wrapper : button.values()) {
if (wrapper.getIndex() == index) {
return createByWrapper(wrapper);
}
}
return new NullBackgroundPane();
}
public static Set<Class<? extends Background>> browserKindsOfKey() {
return browser.keySet();
}

55
designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane.java

@ -28,16 +28,16 @@ import java.io.File;
*/
public class ImageBackgroundPane extends BackgroundDetailPane {
private ImagePreviewPane previewPane = null;
protected ImagePreviewPane previewPane = null;
private Style imageStyle = null;
private ChangeListener changeListener = null;
private ImageFileChooser imageFileChooser = null;
private UILabel imageSizeLabel = new UILabel();
protected UILabel imageSizeLabel = new UILabel();
protected JRadioButton defaultRadioButton = null;
protected JRadioButton tiledRadioButton = null;
private JRadioButton extendRadioButton = null;
private JRadioButton adjustRadioButton = null;
protected UIRadioButton defaultRadioButton = null;
protected UIRadioButton tiledRadioButton = null;
private UIRadioButton extendRadioButton = null;
private UIRadioButton adjustRadioButton = null;
public ImageBackgroundPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -46,21 +46,27 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
JPanel previewContainerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.add(previewContainerPane, BorderLayout.CENTER);
JPanel previewOwnerPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Preview"));
JPanel previewOwnerPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Preview"));
previewOwnerPane.setLayout(new BorderLayout());
previewContainerPane.add(previewOwnerPane, BorderLayout.CENTER);
previewContainerPane.add(initSelectFilePane(), BorderLayout.EAST);
previewPane = new ImagePreviewPane();
previewOwnerPane.add(new JScrollPane(previewPane));
previewPane.addChangeListener(imageSizeChangeListener);
// init image file chooser.
imageFileChooser = new ImageFileChooser();
imageFileChooser.setMultiSelectionEnabled(false);
}
public JPanel initSelectFilePane(){
JPanel selectFilePane = FRGUIPaneFactory.createBorderLayout_L_Pane();
previewContainerPane.add(selectFilePane, BorderLayout.EAST);
selectFilePane.setBorder(BorderFactory.createEmptyBorder(8, 2, 4, 0));
UIButton selectPictureButton = new UIButton(
Inter.getLocText("Image-Select_Picture"));
Inter.getLocText("FR-Designer_Background_Image_Select"));
selectFilePane.add(selectPictureButton, BorderLayout.NORTH);
selectPictureButton.setMnemonic('S');
selectPictureButton.addActionListener(selectPictureActionListener);
@ -68,10 +74,10 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
selectFilePane.add(layoutPane, BorderLayout.CENTER);
//布局
defaultRadioButton = new UIRadioButton(Inter.getLocText("Default"));
tiledRadioButton = new UIRadioButton(Inter.getLocText("Image-Titled"));
extendRadioButton = new UIRadioButton(Inter.getLocText("Image-Extend"));
adjustRadioButton = new UIRadioButton(Inter.getLocText("Image-Adjust"));
defaultRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer-StyleAlignment_Layout_Default"));
tiledRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer-StyleAlignment_Layout_Image_Titled"));
extendRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer-StyleAlignment_Layout_Image_Extend"));
adjustRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer-StyleAlignment_Layout_Image_Adjust"));
defaultRadioButton.addActionListener(layoutActionListener);
tiledRadioButton.addActionListener(layoutActionListener);
@ -79,7 +85,7 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
adjustRadioButton.addActionListener(layoutActionListener);
JPanel jp = new JPanel(new GridLayout(4, 1, 15, 15));
for (JRadioButton button : imageLayoutButtons()) {
for (UIRadioButton button : imageLayoutButtons()) {
jp.add(button);
}
layoutPane.add(jp);
@ -91,14 +97,11 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
layoutBG.add(adjustRadioButton);
defaultRadioButton.setSelected(true);
// init image file chooser.
imageFileChooser = new ImageFileChooser();
imageFileChooser.setMultiSelectionEnabled(false);
return selectFilePane;
}
protected JRadioButton[] imageLayoutButtons() {
return new JRadioButton[]{
protected UIRadioButton[] imageLayoutButtons() {
return new UIRadioButton[]{
defaultRadioButton,
tiledRadioButton,
extendRadioButton,
@ -121,8 +124,7 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
CoreGraphHelper.waitForImage(image);
previewPane.setImage(image);
setImageStyle();
previewPane.setImageStyle(imageStyle);
imageStyleRepaint();
previewPane.repaint();
} else {
previewPane.setImage(null);
@ -133,6 +135,11 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
}
};
public void imageStyleRepaint(){
setImageStyle();
previewPane.setImageStyle(imageStyle);
}
private void setImageStyle() {
if (tiledRadioButton.isSelected()) {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_TILED);

5
designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane4Browser.java

@ -1,5 +1,6 @@
package com.fr.design.style.background.impl;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.stable.ArrayUtils;
import javax.swing.*;
@ -15,9 +16,9 @@ public class ImageBackgroundPane4Browser extends ImageBackgroundPane {
}
@Override
protected JRadioButton[] imageLayoutButtons() {
protected UIRadioButton[] imageLayoutButtons() {
return (JRadioButton[]) ArrayUtils.addAll(super.imageLayoutButtons(), new JRadioButton[] {
return (UIRadioButton[]) ArrayUtils.addAll(super.imageLayoutButtons(), new UIRadioButton[] {
defaultRadioButton,
tiledRadioButton,
});

79
designer_base/src/com/fr/design/style/background/impl/ImageButtonBackgroundPane.java

@ -0,0 +1,79 @@
package com.fr.design.style.background.impl;
import com.fr.base.Style;
import com.fr.base.background.ImageBackground;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.general.Background;
import com.fr.general.Inter;
import com.fr.stable.Constants;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Created by ibm on 2017/1/5.
*/
public class ImageButtonBackgroundPane extends ImageBackgroundPane {
private UIButton chooseButton;
private UIButton clearButton;
public ImageButtonBackgroundPane(){
super();
Style imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER);
previewPane.setImageStyle(imageStyle);
}
public JPanel initSelectFilePane(){
JPanel choosePane = new JPanel(new BorderLayout(0, 10));
choosePane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
JPanel choosePane1 = new JPanel(new BorderLayout(0, 10));
initButton();
choosePane.add(chooseButton, BorderLayout.NORTH);
choosePane1.add(clearButton,BorderLayout.NORTH);
choosePane.add(choosePane1,BorderLayout.CENTER);
imageSizeLabel.setHorizontalAlignment(SwingConstants.CENTER);
choosePane1.add(imageSizeLabel,BorderLayout.CENTER);
this.add(choosePane,BorderLayout.EAST);
return choosePane;
}
private void initButton() {
chooseButton = new UIButton(Inter.getLocText("FR-Designer_Background_Image_Select"));
chooseButton.addActionListener(selectPictureActionListener);
clearButton = new UIButton(Inter.getLocText("FR-Designer_Background_Clear"));
clearButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
previewPane.setImage(null);
previewPane.repaint();
}
});
}
public void imageStyleRepaint(){
}
public void populate(Background background) {
if(background != null && background instanceof ImageBackground){
ImageBackground imageBackground = (ImageBackground) background;
if(imageBackground.getImage() != null) {
previewPane.setImage(imageBackground.getImage());
}
}
}
public Background update() {
if(previewPane.getImage() == null) {
return null;
}
return new ImageBackground(previewPane.getImage());
}
}

38
designer_base/src/com/fr/design/style/color/ColorPicker.java

@ -5,6 +5,7 @@ package com.fr.design.style.color;
*/
import com.fr.base.BaseUtils;
import com.fr.general.FRLogger;
import java.awt.*;
import java.awt.event.*;
@ -49,7 +50,10 @@ public class ColorPicker extends JDialog implements ActionListener
updateSize(colorPickerSize);
this.colorSelectable = colorSelectable;
this.setColorRealTime = setColorRealTime;
start();
this.setModal(true);
this.setAlwaysOnTop(true);
updateLocation();
this.setVisible(true);
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
}
@ -58,6 +62,18 @@ public class ColorPicker extends JDialog implements ActionListener
timer = new Timer(timeCycle, this);
timer.start();
hideCursor();
// 如果要求实时变化,确保先关闭弹窗,再截屏
// 主要针对"图案"选项卡中的"前景"、"背景"
if (this.setColorRealTime) {
colorSelectable.setColor(Color.WHITE); // setColor 可以关闭弹窗
try {
Thread.sleep(100); // 等待弹窗关闭
} catch (InterruptedException e) {
FRLogger.getLogger().error(e.getMessage());
}
colorPickerPanel.captureScreen();
}
// System.out.println(KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow());
}
@ -68,7 +84,7 @@ public class ColorPicker extends JDialog implements ActionListener
public void actionPerformed(ActionEvent e) {
updateLocation();
colorToSet = colorPickerPanel.getPixelColor(mousePos);
if (setColorRealTime && !colorSelectable.getColor().equals(colorToSet)) {
if (setColorRealTime && (colorSelectable.getColor() == null || !colorSelectable.getColor().equals(colorToSet))) {
colorSelectable.setColor(colorToSet);
}
}
@ -94,9 +110,11 @@ public class ColorPicker extends JDialog implements ActionListener
validate(); // 更新所有子控件
}
public void pickComplete() {
public void pickComplete(boolean setColor) {
timer.stop();
if (setColor) {
colorSelectable.setColor(colorToSet);
}
this.dispose();
}
@ -109,9 +127,8 @@ public class ColorPicker extends JDialog implements ActionListener
private class MouseFunctions extends MouseAdapter
{
public void mousePressed(MouseEvent e)
{
pickComplete();
public void mousePressed(MouseEvent e) {
pickComplete(e.getButton() == e.BUTTON1); // 左键确定
}
}
}
@ -138,6 +155,15 @@ class ColorPickerPanel extends JPanel
*/
public ColorPickerPanel(int scaleFactor)
{
colorPickerFrame = BaseUtils.readImage("/com/fr/design/images/gui/colorPicker/colorPickerFrame.png");
this.scaleFactor = scaleFactor;
captureScreen();
}
/**
* 截屏
*/
public void captureScreen() {
try
{
robot = new Robot();
@ -149,8 +175,6 @@ class ColorPickerPanel extends JPanel
screenImage = robot.createScreenCapture(new Rectangle(0, 0, Toolkit
.getDefaultToolkit().getScreenSize().width, Toolkit
.getDefaultToolkit().getScreenSize().height));
colorPickerFrame = BaseUtils.readImage("/com/fr/design/images/gui/colorPicker/colorPickerFrame.png");
this.scaleFactor = scaleFactor;
}
/**

2
designer_base/src/com/fr/design/style/color/ColorSelectDialog.java

@ -137,7 +137,7 @@ public class ColorSelectDialog extends MiddleChartDialog{
public static void showDialog(Frame owner,ColorSelectDetailPane pane,Color initialColor,ColorSelectable selectePane){
ColorTracker okListener = new ColorTracker(pane);
ColorSelectDialog dialog = new ColorSelectDialog(owner,pane,initialColor,okListener,selectePane);
// dialog.setModal(true);
dialog.setModal(true);
dialog.show();
}

10
designer_base/src/com/fr/design/style/color/PickColorButtonFactory.java

@ -4,8 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.design.gui.ibutton.UIButton;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.*;
/**
* Created by plough on 2016/12/22.
@ -28,11 +27,10 @@ public class PickColorButtonFactory {
}
pickColorButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
pickColorButton.addActionListener(new ActionListener() {
pickColorButton.addMouseListener(new MouseAdapter() {
@Override
public void actionPerformed(ActionEvent e) {
ColorPicker colorPicker = new ColorPicker(colorSelectable, setColorRealTime);
colorPicker.start();
public void mousePressed(MouseEvent e) {
new ColorPicker(colorSelectable, setColorRealTime);
}
});

12
designer_base/src/com/fr/start/BaseDesigner.java

@ -11,6 +11,7 @@ import com.fr.design.extra.WebDialog;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.DesignerStartOpenFileProcessor;
import com.fr.design.fun.GlobalListenerProvider;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.TemplatePane;
@ -224,6 +225,17 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
file = FILEFactory.createFILE(FILEFactory.ENV_PREFIX
+ DesignerEnvManager.getEnvManager().getLastOpenFile());
}
//启动时打开指定文件的接口
DesignerStartOpenFileProcessor processor = ExtraDesignClassManager.getInstance().getSingle(DesignerStartOpenFileProcessor.XML_TAG);
if (processor != null) {
FILE f = processor.fileToShow();
if (f != null) {
file = f;//避免null
} else {
isException = true;//此时有文件nullpointer异常,执行打开空文件
}
}
if (file.exists() && !isException) {
df.openTemplate(file);
} else {

12
designer_chart/src/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java

@ -70,8 +70,8 @@ public class NormalChartDataPane extends DataContentsPane {
@Override
protected List<FurtherBasicBeanPane<? extends ChartCollection>> initPaneList() {
tableDataPane = new TableDataPane(parent);
reportDataPane = new ReportDataPane(parent);
tableDataPane = getTableDataPane(parent);
reportDataPane = getReportDataPane(parent);
List<FurtherBasicBeanPane<? extends ChartCollection>> paneList = new ArrayList<FurtherBasicBeanPane<? extends ChartCollection>>();
paneList.add(tableDataPane);
paneList.add(reportDataPane);
@ -96,6 +96,14 @@ public class NormalChartDataPane extends DataContentsPane {
}
protected ReportDataPane getReportDataPane(ChartDataPane parent) {
return new ReportDataPane(parent);
}
protected TableDataPane getTableDataPane(ChartDataPane chartDataPane) {
return new TableDataPane(chartDataPane);
}
/**
* 更新界面 数据内容
*/

2
designer_chart/src/com/fr/design/mainframe/chart/gui/data/ReportDataPane.java

@ -21,7 +21,7 @@ public class ReportDataPane extends FurtherBasicBeanPane<ChartCollection>{
this.parent = parent;
}
private AbstractReportDataContentPane getContentPane(Chart chart) {
protected AbstractReportDataContentPane getContentPane(Chart chart) {
if(chart == null) {
return null;
}

2
designer_chart/src/com/fr/design/mainframe/chart/gui/data/TableDataPane.java

@ -69,7 +69,7 @@ public class TableDataPane extends FurtherBasicBeanPane<ChartCollection>{
}
}
private AbstractTableDataContentPane getContentPane(Plot plot) {
protected AbstractTableDataContentPane getContentPane(Plot plot) {
return ChartTypeInterfaceManager.getInstance().getTableDataSourcePane(plot, parent);
}

23
designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java

@ -10,8 +10,6 @@ import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.widget.editors.PaddingMarginEditor;
import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor;
import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer;
import com.fr.design.mainframe.widget.renderer.PaddingMarginCellRenderer;
import com.fr.design.parameter.ParameterBridge;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WLayout;
@ -81,6 +79,27 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
};
}
/**
* 控件名属性
* @return
* @throws IntrospectionException
*/
public CRPropertyDescriptor createWidgetNameDescriptor() throws IntrospectionException {
return new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Inter
.getLocText("FR-Designer_Form-Widget_Name"));
}
/**
* 边距属性
* @return
* @throws IntrospectionException
*/
public CRPropertyDescriptor createMarginDescriptor() throws IntrospectionException {
return new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class)
.setI18NName(Inter.getLocText("FR-Designer_Layout-Padding"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced");
}
/**
* 返回对应的wlayout
* @return wlayout控件

13
designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java

@ -1,13 +1,12 @@
package com.fr.design.designer.creator.cardlayout;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.*;
import java.awt.event.MouseEvent;
import javax.swing.Icon;
import com.fr.base.BaseUtils;
import com.fr.base.background.ColorBackground;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.models.SelectionModel;
@ -32,6 +31,7 @@ public class XCardAddButton extends XButton{
private static final int START_INDEX = 3;
private static final int INDEX = 0;
private static final int DEFAULT_BUTTON_WIDTH = 80;
private static Icon ADD_ICON = BaseUtils.readIcon("/com/fr/design/form/images/add.png");
@ -140,19 +140,18 @@ public class XCardAddButton extends XButton{
//新增tab
private void addTab(int index){
Dimension dimension = new Dimension();
XCardSwitchButton button = (XCardSwitchButton) this.tagLayout.getComponent(INDEX);
dimension.width = button.getWidth();
dimension.width = DEFAULT_BUTTON_WIDTH;
String cardLayoutName = cardLayout.toData().getWidgetName();
CardSwitchButton titleButton = new CardSwitchButton(index,cardLayoutName);
//设置标题
titleButton.setText(getTabTitleName());
titleButton.setInitialBackground(ColorBackground.getInstance(Color.WHITE));
XCardSwitchButton showButton = new XCardSwitchButton(titleButton, dimension, cardLayout, tagLayout);
titleButton.setCustomStyle(true);
titleButton.setShowButton(true);
showButton.setBackupParent(tagLayout);
this.tagLayout.setCurrentCard(titleButton);
this.tagLayout.setTabFitIndex(index);
this.tagLayout.add(showButton);
@ -162,6 +161,8 @@ public class XCardAddButton extends XButton{
private void showNewTab(EditingMouseListener editingMouseListener,int index){
SelectionModel selectionModel = editingMouseListener.getSelectionModel();
XWTabFitLayout tabFitLayout = (XWTabFitLayout) cardLayout.getComponent(index);
XCardSwitchButton xCardSwitchButton = (XCardSwitchButton) this.tagLayout.getComponent(index);
tabFitLayout.setxCardSwitchButton(xCardSwitchButton);
selectionModel.setSelectedCreator(tabFitLayout);
}

117
designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java

@ -3,17 +3,15 @@
*/
package com.fr.design.designer.creator.cardlayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.geom.Rectangle2D;
import java.util.*;
import javax.swing.Icon;
import javax.swing.*;
import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper;
import com.fr.base.background.ColorBackground;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter;
@ -33,6 +31,7 @@ import com.fr.form.ui.WidgetTitle;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.Background;
import com.fr.general.FRFont;
import com.fr.general.Inter;
/**
*
@ -41,10 +40,14 @@ import com.fr.general.FRFont;
*/
public class XCardSwitchButton extends XButton {
private XWCardLayout cardLayout;
private XWCardTagLayout tagLayout;
private static final int LEFT_GAP = 16;
private static Icon MOUSE_COLSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png");
//设置的图片类型
private static final String COLORBACKGROUNDTYPE = "ColorBackground";
private static final String DEFAULTTYPE = "default";
//默认颜色
public static final Color NORMAL_GRAL = new Color(236,236,236);
public static final Color CHOOSED_GRAL = new Color(222,222,222);
@ -54,12 +57,21 @@ public class XCardSwitchButton extends XButton {
private static final int RIGHT_OFFSET = 15;
private static final int TOP_OFFSET = 25;
//这边先不计算button的高度,涉及到layout那边的整体高度,先用之前的固定高度
private static final int DEFAULT_BUTTON_HEIGHT = 36;
// tab按钮里的字体因为按钮内部的布局看起来比正常的要小,加个调整量
private static final int FONT_SIZE_ADJUST = 2;
private static final int SIDE_OFFSET = 57;
private static final int HEIGHT_OFFSET = 25;
private XWCardLayout cardLayout;
private XWCardTagLayout tagLayout;
private Background selectBackground;
private boolean isCustomStyle;
private static Icon MOUSE_COLSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png");
private Icon closeIcon = MOUSE_COLSE;
public XWCardTagLayout getTagLayout() {
@ -78,6 +90,22 @@ public class XCardSwitchButton extends XButton {
this.cardLayout = cardLayout;
}
public boolean isCustomStyle() {
return isCustomStyle;
}
public void setCustomStyle(boolean customStyle) {
isCustomStyle = customStyle;
}
public Background getSelectBackground() {
return selectBackground;
}
public void setSelectBackground(Background selectBackground) {
this.selectBackground = selectBackground;
}
public XCardSwitchButton(CardSwitchButton widget, Dimension initSize) {
super(widget, initSize);
}
@ -133,6 +161,7 @@ public class XCardSwitchButton extends XButton {
// 切换到当前tab按钮对应的tabFitLayout
XWTabFitLayout tabFitLayout = (XWTabFitLayout) cardLayout.getComponent(index);
tabFitLayout.setxCardSwitchButton(this);
selectionModel.setSelectedCreator(tabFitLayout);
if (editingMouseListener.stopEditing()) {
@ -141,11 +170,17 @@ public class XCardSwitchButton extends XButton {
editingMouseListener.startEditing(this,
adapter.getDesignerEditor(), adapter);
}
setTabsAndAdjust();
}
//删除card,同时修改其他switchbutton和tabfit的index
private void deleteCard(XCardSwitchButton button,int index){
String titleName = button.getContentLabel().getText();
int value = JOptionPane.showConfirmDialog(null, Inter.getLocText("FR-Designer_ConfirmDialog_Content") + "“" + titleName + "”",
Inter.getLocText("FR-Designer_ConfirmDialog_Title"),JOptionPane.YES_NO_OPTION);
if (value != JOptionPane.OK_OPTION) {
return;
}
tagLayout.remove(button);
// 先清除该tab内部组件,否在再显示上有样式的残留
XWTabFitLayout tabLayout = (XWTabFitLayout)cardLayout.getComponent(index);
@ -225,6 +260,7 @@ public class XCardSwitchButton extends XButton {
public void paintComponent(Graphics g) {
super.paintComponent(g);
setTabsAndAdjust();
Graphics2D g2d = (Graphics2D) g;
drawBackgorund();
drawTitle();
@ -241,6 +277,11 @@ public class XCardSwitchButton extends XButton {
//画背景
private void drawBackgorund(){
CardSwitchButton button = (CardSwitchButton)this.toData();
Background currentBackground;
currentBackground = this.getSelectBackground();
//这边就是button的背景图片,图片的是image,默认的是color,所以不应该是针对null的判断
String type = currentBackground != null? currentBackground.getBackgroundType() : DEFAULTTYPE;
if (type.equals(COLORBACKGROUNDTYPE) || type.equals(DEFAULTTYPE)) {
ColorBackground background;
if(button.isShowButton()){
this.rebuid();
@ -252,6 +293,7 @@ public class XCardSwitchButton extends XButton {
this.setContentBackground(background);
}
}
}
//画标题
private void drawTitle() {
@ -272,7 +314,9 @@ public class XCardSwitchButton extends XButton {
label.setForeground(font.getForeground());
Background background = title.getBackground();
if (background != null) {
if(button.isShowButton()){
if(button.isShowButton() && selectBackground != null){
this.setContentBackground(selectBackground);
}else if (button.isShowButton() && selectBackground == null){
background = ColorBackground.getInstance(CHOOSED_GRAL);
this.setContentBackground(background);
} else {
@ -298,4 +342,53 @@ public class XCardSwitchButton extends XButton {
return this.getBackupParent().getTopLayout();
}
public void setTabsAndAdjust() {
if (this.tagLayout == null) {
return;
}
int tabLength = this.tagLayout.getComponentCount();
Map<Integer, Integer> cardWidth = new HashMap<>();
Map<Integer, Integer> cardHeight = new HashMap<>();
for (int i = 0; i < tabLength; i++) {
XCardSwitchButton temp = (XCardSwitchButton) this.tagLayout.getComponent(i);
CardSwitchButton tempCard = (CardSwitchButton) temp.toData();
String tempText = tempCard.getText();
Font f = ((CardSwitchButton)this.toData()).getFont();
FontMetrics fm = GraphHelper.getFontMetrics(f);
cardWidth.put(i,fm.stringWidth(tempText));
cardHeight.put(i,fm.getHeight());
}
adjustTabs(tabLength, cardWidth, cardHeight);
}
public void adjustTabs(int tabLength, Map<Integer, Integer> width, Map<Integer, Integer> height) {
if (width == null) {
return;
}
int tempX = 0;
for (int i = 0; i < tabLength; i++) {
Rectangle rectangle = this.tagLayout.getComponent(i).getBounds();
Integer cardWidth = width.get(i) + SIDE_OFFSET;
//先用这边的固定高度
Integer cardHeight = DEFAULT_BUTTON_HEIGHT;
rectangle.setSize(cardWidth, cardHeight);
rectangle.setBounds(tempX, 0, cardWidth, cardHeight);
tempX += cardWidth;
this.tagLayout.getComponent(i).setBounds(rectangle);
Dimension dimension = new Dimension();
dimension.setSize(cardWidth, cardHeight);
XCardSwitchButton temp = (XCardSwitchButton) this.tagLayout.getComponent(i);
UILabel label = temp.getContentLabel();
label.setSize(dimension);
temp.setContentLabel(label);
temp.setSize(dimension);
temp.setPreferredSize(new Dimension(cardWidth, cardHeight));
}
}
@Override
public void doLayout() {
super.doLayout();
setTabsAndAdjust();
}
}

53
designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java

@ -6,13 +6,16 @@ package com.fr.design.designer.creator.cardlayout;
import com.fr.base.background.ColorBackground;
import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRCardLayoutAdapter;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.creator.*;
import com.fr.design.form.layout.FRCardLayout;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.editors.BooleanEditor;
import com.fr.design.mainframe.widget.editors.CardTagWLayoutBorderStyleEditor;
import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer;
import com.fr.design.mainframe.widget.editors.DoubleEditor;
import com.fr.form.ui.*;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WCardLayout;
@ -22,6 +25,7 @@ import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WCardTitleLayout;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants;
import com.fr.stable.core.PropertyChangeAdapter;
@ -39,6 +43,8 @@ public class XWCardLayout extends XLayoutContainer {
private CardLayout cardLayout;
private boolean initFlag = true;
private static final int NORTH = 0;
private FormDesigner designer;
//默认蓝色标题背景
private static final Color TITLE_COLOR = new Color(51, 132, 240);
@ -197,9 +203,9 @@ public class XWCardLayout extends XLayoutContainer {
CardSwitchButton firstBtn = new CardSwitchButton(widgetName);
firstBtn.setText(Inter.getLocText("FR-Designer_Title") + 0);
firstBtn.setInitialBackground(ColorBackground.getInstance(Color.WHITE));
firstBtn.setCustomStyle(true);
xTag.setCurrentCard(firstBtn);
XCardSwitchButton xFirstBtn = new XCardSwitchButton(firstBtn, new Dimension(CardSwitchButton.DEF_WIDTH, -1), this, xTag);
firstBtn.setCustomStyle(true);
xFirstBtn.setBackupParent(xTag);
return xFirstBtn;
@ -272,6 +278,47 @@ public class XWCardLayout extends XLayoutContainer {
* @throws IntrospectionException
*/
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
CRPropertyDescriptor[] crp = ((WCardLayout) data).isCarousel() ? getisCarousel() : getisnotCarousel();
return ArrayUtils.addAll(getDefaultDescriptor(), crp);
}
public CRPropertyDescriptor[] getisCarousel() throws IntrospectionException {
return new CRPropertyDescriptor[] {
new CRPropertyDescriptor("carousel", this.data.getClass())
.setEditorClass(BooleanEditor.class)
.setI18NName(Inter.getLocText("FR-Designer_setCarousel"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "FR-Designer_Tab_carousel")
.setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED);
}
}),
new CRPropertyDescriptor("carouselInterval", this.data.getClass())
.setEditorClass(DoubleEditor.class)
.setI18NName(Inter.getLocText("FR-Designer_carouselInterval"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "FR-Designer_Tab_carousel")
};
}
public CRPropertyDescriptor[] getisnotCarousel() throws IntrospectionException {
return new CRPropertyDescriptor[] {
new CRPropertyDescriptor("carousel", this.data.getClass())
.setEditorClass(BooleanEditor.class)
.setI18NName(Inter.getLocText("FR-Designer_setCarousel"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "FR-Designer_Tab_carousel")
.setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED);
}
})
};
}
public CRPropertyDescriptor[] getDefaultDescriptor() throws IntrospectionException {
return new CRPropertyDescriptor[] {
new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Inter
.getLocText("FR-Designer_Form-Widget_Name")).setPropertyChangeListener(new PropertyChangeAdapter(){
@ -291,7 +338,7 @@ public class XWCardLayout extends XLayoutContainer {
public void propertyChange() {
initStyle();
}
}),
})
};
}

12
designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java

@ -163,18 +163,6 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
* void
*/
public void adjustComponentWidth(){
int btnNum = this.getComponentCount();
int tagLayoutWidth = this.getWidth();
int allBtnWidth = btnNum * CardSwitchButton.DEF_WIDTH + btnNum;
int size = CardSwitchButton.DEF_WIDTH;
if(tagLayoutWidth - allBtnWidth < CardSwitchButton.DEF_WIDTH){
size = (tagLayoutWidth - CardSwitchButton.DEF_WIDTH - btnNum)/btnNum;
}
WCardTagLayout layout = (WCardTagLayout)this.toData();
for(int i=0;i<btnNum;i++){
CardSwitchButton button = layout.getSwitchButton(i);
layout.setWidthAtWidget(button, size);
}
}

186
designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java

@ -1,12 +1,11 @@
package com.fr.design.designer.creator.cardlayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.*;
import java.beans.IntrospectionException;
import javax.swing.border.Border;
import com.fr.base.background.ColorBackground;
import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRTabFitLayoutAdapter;
import com.fr.design.designer.beans.models.SelectionModel;
@ -14,19 +13,25 @@ import com.fr.design.designer.creator.CRPropertyDescriptor;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.properties.mobile.BodyMobilePropertyUI;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormHierarchyTreePane;
import com.fr.design.mainframe.widget.editors.PaddingMarginEditor;
import com.fr.design.mainframe.widget.renderer.PaddingMarginCellRenderer;
import com.fr.design.mainframe.widget.editors.ButtonTypeEditor;
import com.fr.design.mainframe.widget.editors.FontEditor;
import com.fr.design.mainframe.widget.editors.ImgBackgroundEditor;
import com.fr.design.mainframe.widget.renderer.FontCellRenderer;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.Background;
import com.fr.general.FRFont;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.core.PropertyChangeAdapter;
/**
* @author focus
@ -37,8 +42,13 @@ public class XWTabFitLayout extends XWFitLayout {
private static final int MIN_SIZE = 1;
// tab布局在拖拽导致的缩放里(含间隔时),如果拖拽宽高大于组件宽高,会导致调整的时候找不到原来的组件
// 这里先将拖拽之前的宽高先做备份
private static final Color NORMAL_GRAL = new Color(236,236,236);
private Dimension referDim;
private Background initialBackground;
private Background overBackground;
private Background clickBackground;
private FRFont font;
private XCardSwitchButton xCardSwitchButton;
public Dimension getReferDim() {
return referDim;
@ -48,6 +58,47 @@ public class XWTabFitLayout extends XWFitLayout {
this.referDim = referDim;
}
public Background getInitialBackground() {
return initialBackground;
}
public void setInitialBackground(Background initialBackground) {
this.initialBackground = initialBackground;
}
public Background getOverBackground() {
return overBackground;
}
public void setOverBackground(Background overBackground) {
this.overBackground = overBackground;
}
public Background getClickBackground() {
return clickBackground;
}
public void setClickBackground(Background clickBackground) {
this.clickBackground = clickBackground;
}
@Override
public FRFont getFont() {
return font;
}
public void setFont(FRFont font) {
this.font = font;
}
public XCardSwitchButton getxCardSwitchButton() {
return xCardSwitchButton;
}
public void setxCardSwitchButton(XCardSwitchButton xCardSwitchButton) {
this.xCardSwitchButton = xCardSwitchButton;
}
public XWTabFitLayout(){
this(new WTabFitLayout(), new Dimension());
}
@ -62,13 +113,124 @@ public class XWTabFitLayout extends XWFitLayout {
* @throws IntrospectionException
*/
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
checkButonType();
CRPropertyDescriptor[] crp = ((WTabFitLayout) data).isCustomStyle() ? getisCustomStyle() : getisnotCustomStyle();
return ArrayUtils.addAll(defaultDescriptor(), crp);
}
protected CRPropertyDescriptor[] getisCustomStyle() throws IntrospectionException {
return new CRPropertyDescriptor[]{
new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Inter
.getLocText("FR-Designer_Form-Widget_Name")),
new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class)
.setI18NName(Inter.getLocText("FR-Designer_Layout-Padding"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
//标题样式
creatNonListenerStyle(0).setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
checkButonType();
}
}),
//初始背景
creatNonListenerStyle(1).setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
initialBackground = ((WTabFitLayout) data).getInitialBackground();
xCardSwitchButton.setSelectBackground(null);
xCardSwitchButton.setSelectBackground(initialBackground);
CardSwitchButton cardSwitchButton = (CardSwitchButton) xCardSwitchButton.toData();
cardSwitchButton.setInitialBackground(initialBackground);
}
}),
//鼠标浮动背景
creatNonListenerStyle(2).setPropertyChangeListener(
new PropertyChangeAdapter() {
@Override
public void propertyChange() {
overBackground = ((WTabFitLayout) data).getOverBackground();
CardSwitchButton cardSwitchButton = (CardSwitchButton) xCardSwitchButton.toData();
cardSwitchButton.setOverBackground(overBackground);
}
}),
//鼠标点击背景
creatNonListenerStyle(3).setPropertyChangeListener(
new PropertyChangeAdapter() {
@Override
public void propertyChange() {
clickBackground = ((WTabFitLayout) data).getClickBackground();
CardSwitchButton cardSwitchButton = (CardSwitchButton) xCardSwitchButton.toData();
cardSwitchButton.setClickBackground(clickBackground);
}
}
),
//字体
creatNonListenerStyle(4).setPropertyChangeListener(
new PropertyChangeAdapter() {
@Override
public void propertyChange() {
}
}),
};
}
protected CRPropertyDescriptor[] getisnotCustomStyle() throws IntrospectionException {
return new CRPropertyDescriptor[]{
new CRPropertyDescriptor("customStyle", this.data.getClass()).setI18NName(
Inter.getLocText(new String[]{"Title", "Style"})).setEditorClass(
ButtonTypeEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
checkButonType();
}
})
};
}
protected CRPropertyDescriptor creatNonListenerStyle(int i) throws IntrospectionException{
CRPropertyDescriptor[] crPropertyDescriptors = {
new CRPropertyDescriptor("customStyle", this.data.getClass()).setI18NName(
Inter.getLocText(new String[]{"Title", "Style"})).setEditorClass(
ButtonTypeEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("initialBackground", this.data.getClass()).setEditorClass(
ImgBackgroundEditor.class).setI18NName(Inter.getLocText("FR-Designer_Background-Initial")).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("overBackground", this.data.getClass()).setEditorClass(
ImgBackgroundEditor.class).setI18NName(Inter.getLocText("FR-Designer_Background-Over")).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("clickBackground", this.data.getClass()).setEditorClass(
ImgBackgroundEditor.class).setI18NName(Inter.getLocText("FR-Designer_Background-Click")).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("font", this.data.getClass()).setI18NName(Inter.getLocText("FR-Designer_FRFont"))
.setEditorClass(FontEditor.class).setRendererClass(FontCellRenderer.class).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
};
return crPropertyDescriptors[i];
}
protected CRPropertyDescriptor[] defaultDescriptor() throws IntrospectionException {
CRPropertyDescriptor[] crPropertyDescriptors = {
super.createWidgetNameDescriptor(),
super.createMarginDescriptor()
};
return crPropertyDescriptors;
}
private void checkButonType() {
if (this.xCardSwitchButton == null) {
return;
}
boolean isStyle = ((WTabFitLayout) data).isCustomStyle();
Background bg;
bg = ColorBackground.getInstance(NORMAL_GRAL);
if (!isStyle) {
this.xCardSwitchButton.setCustomStyle(false);
this.xCardSwitchButton.setSelectBackground(bg);
} else {
CardSwitchButton cardSwitchButton = (CardSwitchButton) this.xCardSwitchButton.toData();
Background initialBackground = cardSwitchButton.getInitialBackground();
bg = initialBackground == null ? bg : initialBackground;
this.xCardSwitchButton.setSelectBackground(bg);
this.xCardSwitchButton.setCustomStyle(true);
cardSwitchButton.setCustomStyle(true);
}
}
@Override

8
designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java

@ -50,15 +50,15 @@ public class ElementCasePropertyTable extends AbstractPropertyTable{
new CRPropertyDescriptor("horziontalAttr", this.xCreator.toData().getClass()).setEditorClass(MobileFitEditor.class)
.setRendererClass(MobileFitRender.class)
.setI18NName(Inter.getLocText("FR-Designer_Mobile-Horizontal"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App")),
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit")),
new CRPropertyDescriptor("verticalAttr", this.xCreator.toData().getClass()).setEditorClass(MobileFitEditor.class)
.setRendererClass(MobileFitRender.class)
.setI18NName(Inter.getLocText("FR-Designer_Mobile-Vertical"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App")),
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit")),
new CRPropertyDescriptor("heightRestrict", this.xCreator.toData().getClass()).setEditorClass(InChangeBooleanEditor.class)
.setI18NName(Inter.getLocText("Form-EC_heightrestrict"))
.setRendererClass(BooleanRender.class)
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit"))
};
List<CRPropertyDescriptor> defaultList = new ArrayList<>();
@ -96,7 +96,7 @@ public class ElementCasePropertyTable extends AbstractPropertyTable{
}
groups.add(new PropertyGroup(new ReportAppPropertyGroupModel(Inter.getLocText("FR-Designer_Fit-App"), xCreator, propertyTableEditor, designer)));
groups.add(new PropertyGroup(new ReportAppPropertyGroupModel(Inter.getLocText("FR-Designer_Fit"), xCreator, propertyTableEditor, designer)));
TableModel model = new BeanTableModel();
setModel(model);

14
designer_form/src/com/fr/design/designer/properties/mobile/MobileFitAlignmentItems.java

@ -9,12 +9,14 @@ public class MobileFitAlignmentItems implements ItemProvider {
private static Item[] VALUE_ITEMS;
static {
MobileFitAttrState[] allStates = MobileFitAttrState.values();
int len = allStates.length;
VALUE_ITEMS = new Item[len];
for (int i = 0; i < len ; i++) {
VALUE_ITEMS[i] = new Item(allStates[i].description(), allStates[i]);
}
// 此处不能循环根据MobileFitAttrState的枚举顺序创建items,否则不自适应选项就会跑到双向自适应选项前面。
VALUE_ITEMS = new Item[]{
new Item(MobileFitAttrState.DEFAULT.description(), MobileFitAttrState.DEFAULT),
new Item(MobileFitAttrState.HORIZONTAL.description(), MobileFitAttrState.HORIZONTAL),
new Item(MobileFitAttrState.VERTICAL.description(), MobileFitAttrState.VERTICAL),
new Item(MobileFitAttrState.BIDIRECTIONAL.description(), MobileFitAttrState.BIDIRECTIONAL),
new Item(MobileFitAttrState.NONE.description(), MobileFitAttrState.NONE)
};
}
@Override

35
designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java

@ -1,6 +1,7 @@
package com.fr.design.form.mobile;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.main.mobile.FormMobileAttr;
import com.fr.general.Inter;
@ -15,22 +16,34 @@ public class FormMobileAttrPane extends BasicBeanPane<FormMobileAttr>{
//工具栏容器
private MobileToolBarPane mobileToolBarPane;
static final int paddingHeight = 10;
//h5解析容器
private MobileUseHtmlGroupPane mobileUseHtmlGroupPane;
static final int PADDINGHEIGHT = 10;
public FormMobileAttrPane() {
this.initComponents();
}
//现在只有两个panel,填不满自适应对话框,只能为工具栏Panel和h5解析方式panel分别包裹上一层Panel再计算高度,不然会自动
//拉长两个Panel的高度去填满整个对话框。
private void initComponents() {
JPanel jPanel = new JPanel();
JPanel jPanel1 = new JPanel();
JPanel jPanel2 = new JPanel();
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
jPanel.setLayout(FRGUIPaneFactory.createBorderLayout());
jPanel1.setLayout(FRGUIPaneFactory.createBorderLayout());
jPanel1.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
jPanel2.setLayout(FRGUIPaneFactory.createBorderLayout());
jPanel2.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
this.mobileToolBarPane = new MobileToolBarPane();
this.mobileUseHtmlGroupPane = new MobileUseHtmlGroupPane();
//设置一个JPanel包裹mobileToolBarPane这个Panel,让jPanel的高度等于mobileToolBarPane高度加10,再放入this中
jPanel.setPreferredSize(new Dimension(0, (int)this.mobileToolBarPane.getPreferredSize().getHeight() + paddingHeight));
jPanel.add("North", mobileToolBarPane);
this.add(jPanel);
jPanel1.setPreferredSize(new Dimension(0, (int)this.mobileToolBarPane.getPreferredSize().getHeight() + PADDINGHEIGHT));
jPanel2.setPreferredSize(new Dimension(0, (int)this.mobileUseHtmlGroupPane.getPreferredSize().getHeight() + PADDINGHEIGHT));
jPanel1.add("North", this.mobileUseHtmlGroupPane);
jPanel2.add("North", this.mobileToolBarPane);
this.add("North", jPanel1);
this.add("Center", jPanel2);
}
@Override
@ -39,13 +52,15 @@ public class FormMobileAttrPane extends BasicBeanPane<FormMobileAttr>{
ob = new FormMobileAttr();
}
this.mobileToolBarPane.populateBean(ob);
this.mobileUseHtmlGroupPane.populateBean(ob);
}
@Override
public FormMobileAttr updateBean() {
FormMobileAttr caseMobileAttr = new FormMobileAttr();
this.mobileToolBarPane.updateBean(caseMobileAttr);
return caseMobileAttr;
FormMobileAttr formMobileAttr = new FormMobileAttr();
this.mobileToolBarPane.updateBean(formMobileAttr);
this.mobileUseHtmlGroupPane.updateBean(formMobileAttr);
return formMobileAttr;
}
@Override

29
designer_form/src/com/fr/design/form/mobile/MobileUseHtmlGroupPane.java

@ -0,0 +1,29 @@
package com.fr.design.form.mobile;
import com.fr.design.dialog.mobile.MobileUseHtmlGroupBeanPane;
import com.fr.form.main.mobile.FormMobileAttr;
/**
* 直接copyreport中的MobileUseHtmlGroupPane
* Created by fanglei on 2016/12/28.
*/
public class MobileUseHtmlGroupPane extends MobileUseHtmlGroupBeanPane<FormMobileAttr> {
@Override
public void populateBean(FormMobileAttr mobileAttr) {
if(mobileAttr != null) {
selectIndexButton(mobileAttr.isUseHTML() ? 1 : 0);
}
}
@Override
public FormMobileAttr updateBean() {
return null;
}
@Override
public void updateBean(FormMobileAttr mobileAttr) {
if(mobileAttr != null) {
mobileAttr.setUseHTML(getSelectRadioIndex() == 1);
}
}
}

13
designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleImgBackgroundEditor.java

@ -1,17 +1,16 @@
package com.fr.design.mainframe.widget.accessibles;
import java.awt.Dimension;
import javax.swing.SwingUtilities;
import com.fr.base.background.ImageBackground;
import com.fr.base.background.ColorBackground;
import com.fr.design.mainframe.widget.wrappers.BackgroundWrapper;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.frpane.ImgChoosePane;
import com.fr.design.style.background.BackgroundButtonPane;
import com.fr.general.Background;
public class AccessibleImgBackgroundEditor extends UneditableAccessibleEditor {
private ImgChoosePane choosePane;
private BackgroundButtonPane choosePane;
public AccessibleImgBackgroundEditor() {
super(new BackgroundWrapper());
@ -20,7 +19,7 @@ public class AccessibleImgBackgroundEditor extends UneditableAccessibleEditor {
@Override
protected void showEditorPane() {
if (choosePane == null) {
choosePane = new ImgChoosePane();
choosePane = new BackgroundButtonPane();
choosePane.setPreferredSize(new Dimension(600, 400));
}
BasicDialog dlg = choosePane.showWindow(SwingUtilities.getWindowAncestor(this));
@ -32,7 +31,7 @@ public class AccessibleImgBackgroundEditor extends UneditableAccessibleEditor {
fireStateChanged();
}
});
choosePane.populate(getValue() instanceof ImageBackground ? (ImageBackground) getValue() : null);
choosePane.populate(getValue() instanceof Background ? (Background) getValue() : new ColorBackground());
dlg.setVisible(true);
}
}
Loading…
Cancel
Save