diff --git a/designer/src/com/fr/design/actions/report/ReportBackgroundAction.java b/designer/src/com/fr/design/actions/report/ReportBackgroundAction.java index 3c3940ddad..4a381d4d08 100644 --- a/designer/src/com/fr/design/actions/report/ReportBackgroundAction.java +++ b/designer/src/com/fr/design/actions/report/ReportBackgroundAction.java @@ -37,16 +37,14 @@ public class ReportBackgroundAction extends ReportComponentAction { @Override protected String title4PopupWindow() { - return Inter.getLocText("FR-Designer_Fit-App"); + return Inter.getLocText("FR-Designer_Fit"); } private ActionListener getAppPreviewActionListener() { diff --git a/designer/src/com/fr/design/report/mobile/AppFitPreviewPane.java b/designer/src/com/fr/design/report/mobile/AppFitPreviewPane.java index 3625e4ba4e..bbb44f6122 100644 --- a/designer/src/com/fr/design/report/mobile/AppFitPreviewPane.java +++ b/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() { diff --git a/designer/src/com/fr/design/report/mobile/MobileRadioGroupPane.java b/designer/src/com/fr/design/report/mobile/MobileRadioGroupPane.java index 85cee58e8f..68446abc97 100644 --- a/designer/src/com/fr/design/report/mobile/MobileRadioGroupPane.java +++ b/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{ - private List radioButtons = new ArrayList(); + private List radioButtons = new ArrayList(); public MobileRadioGroupPane(String title) { initComponents(title); @@ -28,28 +29,35 @@ public class MobileRadioGroupPane extends BasicBeanPane{ 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{ * 设置按钮状态 */ 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{ 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{ 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{ 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; + } +} diff --git a/designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java b/designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java index 50c5e32381..0e0ec087d1 100644 --- a/designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java +++ b/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 { - - private List radioButtons = new ArrayList(); - - 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 { @Override public void populateBean(ElementCaseMobileAttr mobileAttr) { if(mobileAttr != null) { @@ -122,9 +25,4 @@ public class MobileUseHtmlGroupPane extends BasicBeanPane mobileAttr.setUseHTML(getSelectRadioIndex() == 1); } } - - @Override - protected String title4PopupWindow() { - return Inter.getLocText("FR-mobile_report_analysis"); - } } diff --git a/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java b/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java index 5b97137102..8f8f74437f 100644 --- a/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java +++ b/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java @@ -65,6 +65,6 @@ public class ReportMobileAttrPane extends BasicBeanPane{ @Override protected String title4PopupWindow() { - return Inter.getLocText("FR-Designer_Fit-App"); + return Inter.getLocText("FR-Designer_Mobile-Attr"); } } diff --git a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java index 553e6814c0..75b3219ebd 100644 --- a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java +++ b/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 { private ConnectionTableProcedurePane connectionTableProcedurePane; private UITableEditorPane 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 { } private void refresh() { - String[] paramTexts = new String[3]; + String[] paramTexts = new String[2]; paramTexts[0] = sqlTextPane.getText(); paramTexts[1] = pageQuery; - paramTexts[2] = customCountQuery; - List 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 { toolBarDef.addShortCut(new PreviewAction()); toolBarDef.addShortCut(SeparatorDef.DEFAULT); toolBarDef.addShortCut(new EditPageQueryAction()); - toolBarDef.addShortCut(SeparatorDef.DEFAULT); - toolBarDef.addShortCut(new EditCustomCountQueryAction()); + dbTableDataMenuHandler = ExtraDesignClassManager.getInstance().getSingle(DBTableDataMenuHandler.MARK_STRING); + if (dbTableDataMenuHandler != null) { + toolBarDef.addShortCut(SeparatorDef.DEFAULT); + 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 { } 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 { @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 { 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 { List 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.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 { } } - 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; diff --git a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java index 600481428e..6f2ee4da33 100644 --- a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java +++ b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java @@ -299,7 +299,6 @@ public class ProcedureDataPane extends AbstractTableDataPane 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); @@ -307,16 +306,16 @@ public class ProcedureDataPane extends AbstractTableDataPane imp // 获取参数默认值,例如:NAME in varchar2 default 'SCOTT',默认值为SCOTT String parameterDefaultValue = ""; if (StringUtils.isNotEmpty(procedureText)) { - int index_begin = procedureText.indexOf("BEGIN"); - - //from sam: 默认值只会在begin之前声明, 不然会把所有的存储过程里带'xx'的都作为默认值 - String defaulValueStr = index_begin == -1 ? procedureText : procedureText.substring(0, index_begin); - String[] strs = defaulValueStr.split("\'"); + int index_begin = procedureText.indexOf("BEGIN"); + + //from sam: 默认值只会在begin之前声明, 不然会把所有的存储过程里带'xx'的都作为默认值 + String defaulValueStr = index_begin == -1 ? procedureText : procedureText.substring(0, index_begin); + String[] strs = defaulValueStr.split("\'"); parameterDefaultValue = strs.length > 1 ? strs[1] : parameterDefaultValue; } StoreProcedureParameter[] newparameters; - newparameters = FRContext.getCurrentEnv().getStoreProcedureDeclarationParameters(connectionname, tableName[tableName.length - 1], parameterDefaultValue); + newparameters = FRContext.getCurrentEnv().getStoreProcedureDeclarationParameters(connectionname, text, parameterDefaultValue); editorPane.populate(newparameters); diff --git a/designer_base/src/com/fr/design/dialog/mobile/MobileUseHtmlGroupBeanPane.java b/designer_base/src/com/fr/design/dialog/mobile/MobileUseHtmlGroupBeanPane.java new file mode 100644 index 0000000000..5ddf61e560 --- /dev/null +++ b/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 extends BasicBeanPane { + + private List radioButtons = new ArrayList(); + + 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"); + } +} + diff --git a/designer_base/src/com/fr/design/fun/DBTableDataMenuHandler.java b/designer_base/src/com/fr/design/fun/DBTableDataMenuHandler.java new file mode 100644 index 0000000000..f06b63b712 --- /dev/null +++ b/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(); + + +} diff --git a/designer_base/src/com/fr/design/fun/DesignerStartOpenFileProcessor.java b/designer_base/src/com/fr/design/fun/DesignerStartOpenFileProcessor.java new file mode 100644 index 0000000000..bbc9f0ac8c --- /dev/null +++ b/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(); +} diff --git a/designer_base/src/com/fr/design/fun/impl/AbstractDBTableDataMenuHandler.java b/designer_base/src/com/fr/design/fun/impl/AbstractDBTableDataMenuHandler.java new file mode 100644 index 0000000000..dd11712505 --- /dev/null +++ b/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) { + + } +} diff --git a/designer_base/src/com/fr/design/fun/impl/AbstractDesignerStartOpenFileProcessor.java b/designer_base/src/com/fr/design/fun/impl/AbstractDesignerStartOpenFileProcessor.java new file mode 100644 index 0000000000..4d09ecd21d --- /dev/null +++ b/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; + } +} diff --git a/designer_base/src/com/fr/design/images/buttonicon/delete.png b/designer_base/src/com/fr/design/images/buttonicon/delete.png new file mode 100644 index 0000000000..6755647485 Binary files /dev/null and b/designer_base/src/com/fr/design/images/buttonicon/delete.png differ diff --git a/designer_base/src/com/fr/design/images/dialog/appfit/H4.png b/designer_base/src/com/fr/design/images/dialog/appfit/H4.png new file mode 100644 index 0000000000..4712003bdf Binary files /dev/null and b/designer_base/src/com/fr/design/images/dialog/appfit/H4.png differ diff --git a/designer_base/src/com/fr/design/images/dialog/appfit/V4.png b/designer_base/src/com/fr/design/images/dialog/appfit/V4.png new file mode 100644 index 0000000000..bc79abce56 Binary files /dev/null and b/designer_base/src/com/fr/design/images/dialog/appfit/V4.png differ diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index 3850dd6659..41f3c8cdd8 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/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= \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_en_US.properties b/designer_base/src/com/fr/design/locale/designer_en_US.properties index 2df8886a67..334e01ca8c 100644 --- a/designer_base/src/com/fr/design/locale/designer_en_US.properties +++ b/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= \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties index c59d0a758a..6312538cf7 100644 --- a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties +++ b/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 @@ -486,4 +486,17 @@ FR-Designer_Form_Editing_Listeners= FR-Designer_Form_Basic_Properties= FR-Designer_DS_Dictionary= FR-Designer_Create_Tree= -FR-Designer_Set_Callback_Function= \ No newline at end of file +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= \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties index 866d2d5971..87a1b893c8 100644 --- a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties +++ b/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. @@ -481,4 +481,17 @@ FR-Designer_Form_Editing_Listeners= FR-Designer_Form_Basic_Properties= FR-Designer_DS_Dictionary= FR-Designer_Create_Tree= -FR-Designer_Set_Callback_Function= \ No newline at end of file +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= \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties index 3b543ee17b..10c53380d0 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties +++ b/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 \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties index 09511f05fc..96cb4260a9 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties +++ b/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 @@ -499,4 +499,17 @@ FR-Designer_Form_Editing_Listeners= FR-Designer_Form_Basic_Properties= FR-Designer_DS_Dictionary= FR-Designer_Create_Tree= -FR-Designer_Set_Callback_Function= \ No newline at end of file +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= \ No newline at end of file diff --git a/designer_base/src/com/fr/design/style/background/BackgroundButtonPane.java b/designer_base/src/com/fr/design/style/background/BackgroundButtonPane.java new file mode 100644 index 0000000000..296ee746e3 --- /dev/null +++ b/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 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; + } + +} diff --git a/designer_base/src/com/fr/design/style/background/BackgroundFactory.java b/designer_base/src/com/fr/design/style/background/BackgroundFactory.java index 25bf0b5b53..d636eb3a30 100644 --- a/designer_base/src/com/fr/design/style/background/BackgroundFactory.java +++ b/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, BackgroundUIWrapper> map = new LinkedHashMap<>(); private static Map, BackgroundUIWrapper> browser = new LinkedHashMap<>(); + private static Map, 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, 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, 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, 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, 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, BackgroundUIWrapper> map) { @@ -85,6 +94,29 @@ public class BackgroundFactory { return new NullBackgroundPane(); } + public static Set> buttonKindsOfKey() { + return button.keySet(); + } + + public static BackgroundUIWrapper getButtonWrapper(Class category) { + return button.get(category); + } + + public static BackgroundDetailPane createButtonIfAbsent(Class 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> browserKindsOfKey() { return browser.keySet(); } diff --git a/designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane.java b/designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane.java index 62ad05485f..ced818426c 100644 --- a/designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane.java +++ b/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); diff --git a/designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane4Browser.java b/designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane4Browser.java index 4d15f18ac3..431ad2c0d1 100644 --- a/designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane4Browser.java +++ b/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, }); diff --git a/designer_base/src/com/fr/design/style/background/impl/ImageButtonBackgroundPane.java b/designer_base/src/com/fr/design/style/background/impl/ImageButtonBackgroundPane.java new file mode 100644 index 0000000000..b72e67bae7 --- /dev/null +++ b/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()); + } +} diff --git a/designer_base/src/com/fr/design/style/color/ColorPicker.java b/designer_base/src/com/fr/design/style/color/ColorPicker.java index cb30c186dd..8807e1f402 100644 --- a/designer_base/src/com/fr/design/style/color/ColorPicker.java +++ b/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(); - colorSelectable.setColor(colorToSet); + 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; } /** diff --git a/designer_base/src/com/fr/design/style/color/ColorSelectDialog.java b/designer_base/src/com/fr/design/style/color/ColorSelectDialog.java index a26bc10c26..11a243b6cd 100644 --- a/designer_base/src/com/fr/design/style/color/ColorSelectDialog.java +++ b/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(); } diff --git a/designer_base/src/com/fr/design/style/color/PickColorButtonFactory.java b/designer_base/src/com/fr/design/style/color/PickColorButtonFactory.java index 0ffd293c84..32188ff4e8 100644 --- a/designer_base/src/com/fr/design/style/color/PickColorButtonFactory.java +++ b/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); } }); diff --git a/designer_base/src/com/fr/start/BaseDesigner.java b/designer_base/src/com/fr/start/BaseDesigner.java index 5af9856c28..016ad604dd 100644 --- a/designer_base/src/com/fr/start/BaseDesigner.java +++ b/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 { diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java index cae7afc39a..6a33c6df96 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java @@ -70,8 +70,8 @@ public class NormalChartDataPane extends DataContentsPane { @Override protected List> initPaneList() { - tableDataPane = new TableDataPane(parent); - reportDataPane = new ReportDataPane(parent); + tableDataPane = getTableDataPane(parent); + reportDataPane = getReportDataPane(parent); List> paneList = new ArrayList>(); 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); + } + /** * 更新界面 数据内容 */ diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/ReportDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/ReportDataPane.java index a3ede1b9f3..c5d80ccc17 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/ReportDataPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/ReportDataPane.java @@ -21,7 +21,7 @@ public class ReportDataPane extends FurtherBasicBeanPane{ this.parent = parent; } - private AbstractReportDataContentPane getContentPane(Chart chart) { + protected AbstractReportDataContentPane getContentPane(Chart chart) { if(chart == null) { return null; } diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/TableDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/TableDataPane.java index 3b6c71ef1e..a6bea6b0ca 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/TableDataPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/TableDataPane.java @@ -69,7 +69,7 @@ public class TableDataPane extends FurtherBasicBeanPane{ } } - private AbstractTableDataContentPane getContentPane(Plot plot) { + protected AbstractTableDataContentPane getContentPane(Plot plot) { return ChartTypeInterfaceManager.getInstance().getTableDataSourcePane(plot, parent); } diff --git a/designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java b/designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java index 47f4270a5e..254e9a9184 100644 --- a/designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java +++ b/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控件 diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java index 0c459b61cd..fa4c1d4a9b 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java +++ b/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()); - XCardSwitchButton showButton = new XCardSwitchButton(titleButton,dimension,cardLayout,tagLayout); - titleButton.setCustomStyle(true); + 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); } diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java index c75fc2542b..28c5e33e3f 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java +++ b/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,25 +40,38 @@ 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); - + private static final int MIN_SIZE = 1; - + // 删除按钮识别区域偏移量 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 Icon MOUSE_COLSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png"); + + 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 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); } @@ -130,22 +158,29 @@ public class XCardSwitchButton extends XButton { //将当前tab按钮改为选中状态 changeButtonState(index); - + // 切换到当前tab按钮对应的tabFitLayout XWTabFitLayout tabFitLayout = (XWTabFitLayout) cardLayout.getComponent(index); + tabFitLayout.setxCardSwitchButton(this); selectionModel.setSelectedCreator(tabFitLayout); - + if (editingMouseListener.stopEditing()) { ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, this); 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,16 +277,22 @@ public class XCardSwitchButton extends XButton { //画背景 private void drawBackgorund(){ CardSwitchButton button = (CardSwitchButton)this.toData(); - ColorBackground background; - if(button.isShowButton()){ - this.rebuid(); - background = ColorBackground.getInstance(CHOOSED_GRAL); - this.setContentBackground(background); - }else{ - this.rebuid(); - background = ColorBackground.getInstance(NORMAL_GRAL); - this.setContentBackground(background); - } + 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(); + background = ColorBackground.getInstance(CHOOSED_GRAL); + this.setContentBackground(background); + }else{ + this.rebuid(); + background = ColorBackground.getInstance(NORMAL_GRAL); + this.setContentBackground(background); + } + } } //画标题 @@ -272,10 +314,12 @@ public class XCardSwitchButton extends XButton { label.setForeground(font.getForeground()); Background background = title.getBackground(); if (background != null) { - if(button.isShowButton()){ - background = ColorBackground.getInstance(CHOOSED_GRAL); - this.setContentBackground(background); - }else{ + if(button.isShowButton() && selectBackground != null){ + this.setContentBackground(selectBackground); + }else if (button.isShowButton() && selectBackground == null){ + background = ColorBackground.getInstance(CHOOSED_GRAL); + this.setContentBackground(background); + } else { this.setContentBackground(background); } } @@ -297,5 +341,54 @@ public class XCardSwitchButton extends XButton { public XLayoutContainer getTopLayout() { return this.getBackupParent().getTopLayout(); } - + + public void setTabsAndAdjust() { + if (this.tagLayout == null) { + return; + } + int tabLength = this.tagLayout.getComponentCount(); + Map cardWidth = new HashMap<>(); + Map 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 width, Map 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(); + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java index 4f2492ee9e..ac929a1635 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java +++ b/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)); - xTag.setCurrentCard(firstBtn); - XCardSwitchButton xFirstBtn = new XCardSwitchButton(firstBtn, new Dimension(CardSwitchButton.DEF_WIDTH, -1),this,xTag); firstBtn.setCustomStyle(true); + xTag.setCurrentCard(firstBtn); + XCardSwitchButton xFirstBtn = new XCardSwitchButton(firstBtn, new Dimension(CardSwitchButton.DEF_WIDTH, -1), this, xTag); xFirstBtn.setBackupParent(xTag); return xFirstBtn; @@ -272,27 +278,68 @@ public class XWCardLayout extends XLayoutContainer { * @throws IntrospectionException */ public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - return new CRPropertyDescriptor[] { - new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Inter - .getLocText("FR-Designer_Form-Widget_Name")).setPropertyChangeListener(new PropertyChangeAdapter(){ - - @Override - public void propertyChange(){ - WCardLayout cardLayout = toData(); - changeRalateSwitchCardname(cardLayout.getWidgetName()); - } - }), - new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass( - CardTagWLayoutBorderStyleEditor.class).setI18NName( - Inter.getLocText("FR-Engine_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") - .setPropertyChangeListener(new PropertyChangeAdapter() { + 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(){ + + @Override + public void propertyChange(){ + WCardLayout cardLayout = toData(); + changeRalateSwitchCardname(cardLayout.getWidgetName()); + } + }), + new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass( + CardTagWLayoutBorderStyleEditor.class).setI18NName( + Inter.getLocText("FR-Engine_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") + .setPropertyChangeListener(new PropertyChangeAdapter() { - @Override - public void propertyChange() { - initStyle(); - } - }), - }; + @Override + public void propertyChange() { + initStyle(); + } + }) + }; } //初始化样式 diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java index e40a7ca871..82170bacc2 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java +++ b/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 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); diff --git a/designer_form/src/com/fr/design/designer/properties/mobile/MobileFitAlignmentItems.java b/designer_form/src/com/fr/design/designer/properties/mobile/MobileFitAlignmentItems.java index 552589b71a..8926befde4 100644 --- a/designer_form/src/com/fr/design/designer/properties/mobile/MobileFitAlignmentItems.java +++ b/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 diff --git a/designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java b/designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java index 0aafd8258c..eb53e8f8cc 100644 --- a/designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java +++ b/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{ //工具栏容器 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{ 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 diff --git a/designer_form/src/com/fr/design/form/mobile/MobileUseHtmlGroupPane.java b/designer_form/src/com/fr/design/form/mobile/MobileUseHtmlGroupPane.java new file mode 100644 index 0000000000..45550a8420 --- /dev/null +++ b/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 { + @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); + } + } +} diff --git a/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleImgBackgroundEditor.java b/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleImgBackgroundEditor.java index 0350704960..8def747683 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleImgBackgroundEditor.java +++ b/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); } } \ No newline at end of file