forked from fanruan/design
Browse Source
* commit '90e8684e1d507b7bc24540a5460924d256c3a047': (38 commits) REPORT-50201 fix 拼写错误 REPORT-50201 远程af搜索模板,部分模板右侧加载不出来 REPORT-60134 表单组件属性国际化-显示不全 REPORT-59681 远程设计控制模板自适应权限控制 REPORT-59681 远程设计控制模板自适应权限控制 CHART-21222 大屏模板中的钻取地图屏蔽钻取目录的超链 REPORT-59959 设计器-设计器操作-11设计器制作的附件模板,10设计器可以打开;但其他的11做的模板,尝试用10打开时都会正常提示弹窗打不开 CHART-20937 fix:不新创建editpane但是要重置lastChartCollection 否则不触发保存 REPORT-59256 填报-填报属性设置-新增自定义提交会带出之前自定义提交设置 和抽之前完全一样 CHART-21076 清楚磁盘缓存 CHART-20411 适配大屏模板关闭 CHART-20411 适配大屏模板另存为 REPORT-60004 远程设计-保存弹窗 目录显示问题 CHART-20686 大屏模板中的图表不支持导出 CHART-20850 fix:大屏模板中 试管型仪表盘切换为横向后 标签颜色就变了 CHART-21014 大屏模板中的cpt组件里面还是要有全部图表类型的 CHART-20939 design fix: 三维组合地图有类型界面 REPORT-59166 韩文设计器设置条件属性 条件属性框体标题显示不全 add executeJavaScriptAndReturnValue function ...final/10.0
superman
3 years ago
50 changed files with 970 additions and 161 deletions
@ -0,0 +1,228 @@
|
||||
package com.fr.design.report.fit; |
||||
|
||||
import com.fr.design.ExtraDesignClassManager; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.gui.ibutton.UIRadioButton; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.report.fit.menupane.FitPreviewPane; |
||||
import com.fr.design.report.fit.menupane.FitRadioGroup; |
||||
import com.fr.design.report.fit.menupane.FontRadioGroup; |
||||
import com.fr.design.report.fit.provider.FitAttrModelProvider; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.report.fit.ReportFitAttr; |
||||
|
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.border.EmptyBorder; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import java.awt.event.ItemListener; |
||||
import java.util.ArrayList; |
||||
import java.util.Arrays; |
||||
import java.util.Comparator; |
||||
import java.util.Set; |
||||
import java.util.stream.Collectors; |
||||
|
||||
import static com.fr.design.i18n.Toolkit.i18nText; |
||||
|
||||
public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> { |
||||
|
||||
protected JPanel contentJPanel; |
||||
protected UIComboBox itemChoose; |
||||
protected java.util.List<FitAttrModel> fitAttrModelList = new ArrayList<>(); |
||||
|
||||
public FontRadioGroup fontRadioGroup; |
||||
public FitRadioGroup adaptRadioGroup; |
||||
public JPanel attrJPanel; |
||||
public FitPreviewPane previewJPanel; |
||||
public FitAttrModel fitAttrModel; |
||||
|
||||
|
||||
protected BaseFitAttrPane() { |
||||
initFitAttrModel(); |
||||
} |
||||
|
||||
private void initFitAttrModel() { |
||||
fitAttrModelList.add(new FrmFitAttrModel()); |
||||
fitAttrModelList.add(new CptFitAttrModel()); |
||||
|
||||
Set<FitAttrModelProvider> fitAttrModelProviders = ExtraDesignClassManager.getInstance().getArray(FitAttrModelProvider.XML_TAG); |
||||
|
||||
for (FitAttrModelProvider fitAttrModelProvider : fitAttrModelProviders) { |
||||
fitAttrModelList.add(fitAttrModelProvider); |
||||
} |
||||
|
||||
fitAttrModelList = fitAttrModelList.stream().sorted(Comparator.comparing(FitAttrModel::getPriority).reversed()).collect(Collectors.toList()); |
||||
} |
||||
|
||||
protected void populateModel(FitAttrModel fitAttrModel) { |
||||
this.fitAttrModel = fitAttrModel; |
||||
if (attrJPanel != null) { |
||||
contentJPanel.remove(attrJPanel); |
||||
} |
||||
if (previewJPanel != null) { |
||||
contentJPanel.remove(previewJPanel); |
||||
} |
||||
|
||||
fontRadioGroup = new FontRadioGroup(); |
||||
adaptRadioGroup = new FitRadioGroup(); |
||||
initAttrJPanel(); |
||||
initPreviewJPanel(); |
||||
} |
||||
|
||||
|
||||
protected void initAttrJPanel() { |
||||
int colCount = fitAttrModel.getFitTypes().length + 1; |
||||
Component[][] components = new Component[2][colCount]; |
||||
initFitRadioGroup(fontRadioGroup, i18nText("Fine-Designer_Fit-Font"), new String[]{i18nText("Fine-Designer_Fit"), i18nText("Fine-Designer_Fit-No")}, components[0]); |
||||
initFitRadioGroup(adaptRadioGroup, fitAttrModel.getFitName(), Arrays.stream(fitAttrModel.getFitTypes()).map(FitType::description).toArray(String[]::new), components[1]); |
||||
|
||||
double[] rowSize = new double[2]; |
||||
double[] columnSize = new double[colCount]; |
||||
for (int i = 0; i < rowSize.length; i++) { |
||||
rowSize[i] = 20; |
||||
} |
||||
for (int i = 0; i < columnSize.length; i++) { |
||||
if (i == 0) { |
||||
columnSize[i] = 80; |
||||
} else { |
||||
columnSize[i] = 100; |
||||
} |
||||
} |
||||
|
||||
attrJPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||
attrJPanel.setBorder(new EmptyBorder(0, 100, 10, 100)); |
||||
contentJPanel.add(attrJPanel); |
||||
} |
||||
|
||||
private void initFitRadioGroup(FitRadioGroup fitRadioGroup, String name, String[] options, Component[] components) { |
||||
components[0] = new UILabel(name); |
||||
for (int i = 0; i < options.length; i++) { |
||||
|
||||
if (options[i] != null) { |
||||
UIRadioButton fontFitRadio = new UIRadioButton(options[i]); |
||||
fitRadioGroup.add(fontFitRadio); |
||||
components[i + 1] = fontFitRadio; |
||||
} else { |
||||
components[i + 1] = null; |
||||
} |
||||
} |
||||
fitRadioGroup.addActionListener(getPreviewActionListener()); |
||||
} |
||||
|
||||
protected ActionListener getPreviewActionListener() { |
||||
return new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
refreshPreviewJPanel(); |
||||
} |
||||
}; |
||||
} |
||||
|
||||
protected void refreshPreviewJPanel() { |
||||
String previewIndex = getPreviewIndex(); |
||||
previewJPanel.refreshPreview(previewIndex, fontRadioGroup.isEnabled()); |
||||
} |
||||
|
||||
protected String getPreviewIndex() { |
||||
return getStateInPC(adaptRadioGroup.getSelectRadioIndex()) + "" + fontRadioGroup.getSelectRadioIndex(); |
||||
} |
||||
|
||||
protected void initPreviewJPanel() { |
||||
previewJPanel = new FitPreviewPane(); |
||||
contentJPanel.add(previewJPanel); |
||||
} |
||||
|
||||
protected int getStateInPC(int index) { |
||||
FitType[] fitTypes = fitAttrModel.getFitTypes(); |
||||
return fitTypes[index].getState(); |
||||
} |
||||
|
||||
protected int getOptionIndex(int state) { |
||||
FitType[] fitTypes = fitAttrModel.getFitTypes(); |
||||
for (int i = 0; i < fitTypes.length; i++) { |
||||
if (ComparatorUtils.equals(state, fitTypes[i].getState())) { |
||||
return i; |
||||
} |
||||
} |
||||
return 0; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void populateBean(ReportFitAttr ob) { |
||||
fontRadioGroup.selectIndexButton(ob.isFitFont() ? 0 : 1); |
||||
adaptRadioGroup.selectIndexButton(getOptionIndex(ob.fitStateInPC())); |
||||
refreshPreviewJPanel(); |
||||
} |
||||
|
||||
@Override |
||||
public ReportFitAttr updateBean() { |
||||
ReportFitAttr reportFitAttr = new ReportFitAttr(); |
||||
reportFitAttr.setFitFont(fontRadioGroup.isFontFit()); |
||||
reportFitAttr.setFitStateInPC(getStateInPC(adaptRadioGroup.getSelectRadioIndex())); |
||||
return reportFitAttr; |
||||
} |
||||
|
||||
|
||||
public void setEnabled(boolean enabled) { |
||||
super.setEnabled(enabled); |
||||
fontRadioGroup.setEnabled(enabled); |
||||
adaptRadioGroup.setEnabled(enabled); |
||||
refreshPreviewJPanel(); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return i18nText("Fine-Designer_PC_Element_Case_Fit_Attr"); |
||||
} |
||||
|
||||
protected abstract String[] getItemNames(); |
||||
|
||||
protected void initComponents() { |
||||
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
||||
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
||||
contentJPanel = new JPanel(); |
||||
contentJPanel.setLayout(FRGUIPaneFactory.createCenterFlowLayout()); |
||||
this.add(contentJPanel); |
||||
initItemChoose(); |
||||
} |
||||
|
||||
|
||||
private void initItemChoose() { |
||||
JPanel chooseJPanel = new JPanel(); |
||||
chooseJPanel.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); |
||||
ItemListener itemListener = getItemListener(); |
||||
itemChoose = new UIComboBox(getItemNames()); |
||||
itemChoose.addItemListener(itemListener); |
||||
UILabel belowSetLabel = new UILabel(i18nText("Fine-Design_Report_Blow_Set")); |
||||
JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[]{ |
||||
belowSetLabel, itemChoose}, FlowLayout.LEFT, 0, 0); |
||||
chooseJPanel.add(buttonPane); |
||||
chooseJPanel.setPreferredSize(new Dimension(500, 50)); |
||||
JPanel jPanel = new JPanel(); |
||||
jPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
jPanel.add(chooseJPanel, BorderLayout.WEST); |
||||
|
||||
contentJPanel.add(jPanel); |
||||
} |
||||
|
||||
|
||||
protected abstract ItemListener getItemListener(); |
||||
|
||||
|
||||
public void populate(ReportFitAttr reportFitAttr) { |
||||
|
||||
} |
||||
|
||||
protected void refresh() { |
||||
validate(); |
||||
repaint(); |
||||
revalidate(); |
||||
} |
||||
} |
@ -0,0 +1,51 @@
|
||||
package com.fr.design.report.fit; |
||||
|
||||
|
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.report.fit.ReportFitAttr; |
||||
import com.fr.report.fit.ReportFitConfig; |
||||
|
||||
|
||||
public class CptFitAttrModel implements FitAttrModel { |
||||
|
||||
@Override |
||||
public FitType[] getFitTypes() { |
||||
return new FitType[]{ |
||||
FitType.HORIZONTAL_FIT, |
||||
FitType.DOUBLE_FIT, |
||||
FitType.NOT_FIT |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
public String getFitName() { |
||||
return Toolkit.i18nText("Fine-Designer_Fit-Element"); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public String getModelName() { |
||||
return Toolkit.i18nText("Fine-Design_Basic_Plain_Report"); |
||||
} |
||||
|
||||
@Override |
||||
public ReportFitAttr getGlobalReportFitAttr() { |
||||
return ReportFitConfig.getInstance().getCptFitAttr(); |
||||
} |
||||
|
||||
@Override |
||||
public void setGlobalReportFitAttr(ReportFitAttr reportFitAttr) { |
||||
ReportFitConfig.getInstance().setCptFitAttr(reportFitAttr); |
||||
} |
||||
|
||||
@Override |
||||
public int getPriority() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public boolean isAvailable(JTemplate jTemplate) { |
||||
return jTemplate.isJWorkBook(); |
||||
} |
||||
} |
@ -0,0 +1,44 @@
|
||||
package com.fr.design.report.fit; |
||||
|
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.report.fit.ReportFitAttr; |
||||
|
||||
public interface FitAttrModel { |
||||
/** |
||||
* @Description 名称,比如:普通报表、决策报表等 |
||||
**/ |
||||
String getModelName(); |
||||
|
||||
/** |
||||
* @Description 自适应选项的名称,比如返回:表格 |
||||
**/ |
||||
String getFitName(); |
||||
|
||||
/** |
||||
* @Description 自适应选项 |
||||
**/ |
||||
FitType[] getFitTypes(); |
||||
|
||||
|
||||
/** |
||||
* @Description 获取全局的自适应属性 |
||||
**/ |
||||
ReportFitAttr getGlobalReportFitAttr(); |
||||
|
||||
/** |
||||
* @Description 设置全局的自适应属性 |
||||
* @param: reportFitAttr |
||||
**/ |
||||
void setGlobalReportFitAttr(ReportFitAttr reportFitAttr); |
||||
|
||||
/** |
||||
* @Description 优先级 |
||||
**/ |
||||
int getPriority(); |
||||
|
||||
/** |
||||
* @Description 是否可用 |
||||
* @param: jTemplate |
||||
**/ |
||||
boolean isAvailable(JTemplate jTemplate); |
||||
} |
@ -0,0 +1,53 @@
|
||||
package com.fr.design.report.fit; |
||||
|
||||
|
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.report.fit.ReportFitAttr; |
||||
import com.fr.report.fit.ReportFitConfig; |
||||
|
||||
|
||||
public class FrmFitAttrModel implements FitAttrModel { |
||||
|
||||
|
||||
@Override |
||||
public String getModelName() { |
||||
return Toolkit.i18nText("Fine-Design_Basic_Decision_Report"); |
||||
} |
||||
|
||||
@Override |
||||
public String getFitName() { |
||||
return Toolkit.i18nText("Fine-Designer_Fit-Element"); |
||||
} |
||||
|
||||
public FitType[] getFitTypes() { |
||||
return new FitType[]{ |
||||
FitType.DEFAULT, |
||||
FitType.HORIZONTAL_FIT, |
||||
FitType.DOUBLE_FIT, |
||||
FitType.NOT_FIT |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
public ReportFitAttr getGlobalReportFitAttr() { |
||||
return ReportFitConfig.getInstance().getFrmFitAttr(); |
||||
} |
||||
|
||||
@Override |
||||
public void setGlobalReportFitAttr(ReportFitAttr reportFitAttr) { |
||||
ReportFitConfig.getInstance().setFrmFitAttr(reportFitAttr); |
||||
} |
||||
|
||||
@Override |
||||
public int getPriority() { |
||||
return 1; |
||||
} |
||||
|
||||
@Override |
||||
public boolean isAvailable(JTemplate jTemplate) { |
||||
return !jTemplate.isJWorkBook(); |
||||
} |
||||
|
||||
|
||||
} |
@ -1,55 +1,91 @@
|
||||
package com.fr.design.report.fit.menupane; |
||||
|
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.file.HistoryTemplateListCache; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.design.report.fit.BaseFitAttrPane; |
||||
import com.fr.design.report.fit.FitAttrModel; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.report.fit.FitProvider; |
||||
import com.fr.report.fit.ReportFitAttr; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.BoxLayout; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
|
||||
/** |
||||
* Created by 夏翔 on 2016/6/24. |
||||
*/ |
||||
public class TemplateFitAttrPane extends BasicBeanPane<ReportFitAttr> { |
||||
private TemplateBrowserFitAttrPane attrPane; |
||||
|
||||
public class TemplateFitAttrPane extends BaseFitAttrPane { |
||||
|
||||
public TemplateFitAttrPane() { |
||||
initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
||||
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
||||
attrPane = new TemplateBrowserFitAttrPane(); |
||||
this.add(attrPane); |
||||
@Override |
||||
protected void initComponents() { |
||||
super.initComponents(); |
||||
for (FitAttrModel fitAttrModel : fitAttrModelList) { |
||||
if (fitAttrModel.isAvailable(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate())) { |
||||
populateModel(fitAttrModel); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(ReportFitAttr reportFitAttr) { |
||||
if (reportFitAttr == null) { |
||||
itemChoose.setSelectedItem(Toolkit.i18nText("Fine-Design_Report_Using_Server_Report_View_Settings")); |
||||
} else { |
||||
itemChoose.setSelectedItem(Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single")); |
||||
} |
||||
populate(reportFitAttr); |
||||
} |
||||
|
||||
public void populate(ReportFitAttr reportFitAttr) { |
||||
if (reportFitAttr == null) { |
||||
reportFitAttr = fitAttrModel.getGlobalReportFitAttr(); |
||||
} |
||||
|
||||
/** |
||||
* 展示界面 |
||||
* |
||||
* @param fitAttr 自适应属性 |
||||
*/ |
||||
public void populateBean(ReportFitAttr fitAttr) { |
||||
attrPane.populateBean(fitAttr); |
||||
super.setEnabled(isTemplateSingleSet()); |
||||
super.populateBean(reportFitAttr); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 提交数据 |
||||
* |
||||
* @return 界面上的更新数据 |
||||
*/ |
||||
public ReportFitAttr updateBean() { |
||||
return attrPane.updateBean(); |
||||
if (!isTemplateSingleSet()) { |
||||
return null; |
||||
} else { |
||||
return super.updateBean(); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected String[] getItemNames() { |
||||
return new String[]{Toolkit.i18nText("Fine-Design_Report_Using_Server_Report_View_Settings"), |
||||
Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single")}; |
||||
} |
||||
|
||||
@Override |
||||
protected ItemListener getItemListener() { |
||||
return new ItemListener() { |
||||
@Override |
||||
public void itemStateChanged(ItemEvent e) { |
||||
if (e.getStateChange() == ItemEvent.SELECTED) { |
||||
if(isTemplateSingleSet()){ |
||||
JTemplate jwb = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); |
||||
if (jwb != null) { |
||||
FitProvider wbTpl = (FitProvider) jwb.getTarget(); |
||||
ReportFitAttr fitAttr = wbTpl.getReportFitAttr(); |
||||
populate(fitAttr); |
||||
} |
||||
}else { |
||||
populate(fitAttrModel.getGlobalReportFitAttr()); |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
} |
||||
|
||||
/** |
||||
* 标题 |
||||
* |
||||
* @return 标题 |
||||
*/ |
||||
protected String title4PopupWindow() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_PC_Fit_Attr"); |
||||
private boolean isTemplateSingleSet() { |
||||
return ComparatorUtils.equals(Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single"), itemChoose.getSelectedItem()); |
||||
} |
||||
} |
@ -0,0 +1,18 @@
|
||||
package com.fr.design.report.fit.provider; |
||||
|
||||
import com.fr.stable.fun.mark.API; |
||||
|
||||
|
||||
@API(level = FitAttrModelProvider.CURRENT_LEVEL) |
||||
public abstract class AbstractFitAttrModelProvider implements FitAttrModelProvider { |
||||
|
||||
@Override |
||||
public int currentAPILevel() { |
||||
return CURRENT_LEVEL; |
||||
} |
||||
|
||||
@Override |
||||
public String mark4Provider() { |
||||
return getClass().getName(); |
||||
} |
||||
} |
@ -0,0 +1,11 @@
|
||||
package com.fr.design.report.fit.provider; |
||||
|
||||
|
||||
import com.fr.design.report.fit.FitAttrModel; |
||||
import com.fr.stable.fun.mark.Mutable; |
||||
|
||||
|
||||
public interface FitAttrModelProvider extends Mutable, FitAttrModel { |
||||
String XML_TAG = "FitAttrModelProvider"; |
||||
int CURRENT_LEVEL = 1; |
||||
} |
@ -0,0 +1,46 @@
|
||||
package com.fr.design.utils.gui; |
||||
|
||||
import com.fr.base.Style; |
||||
import com.fr.base.background.ColorBackground; |
||||
import com.fr.design.base.mode.DesignModeContext; |
||||
import com.fr.report.cell.CellElement; |
||||
import com.fr.report.cell.FloatElement; |
||||
|
||||
import java.awt.Color; |
||||
|
||||
/** |
||||
* @author shine |
||||
* @version 10.0 |
||||
* Created by shine on 2021/9/6 |
||||
*/ |
||||
public class AdjustWorkBookDefaultStyleUtils { |
||||
|
||||
private static final Color TEMPLATE_BACKGROUND = new Color(16, 11, 43); |
||||
private static final Color CELL_ELEMENT_BORDER = new Color(110, 110, 110); |
||||
|
||||
public static void adjustCellElement(CellElement cellElement) { |
||||
if (DesignModeContext.isDuchampMode()) { |
||||
Style style = cellElement.getStyle(); |
||||
style = style.deriveFRFont(style.getFRFont().applyForeground(Color.WHITE)); |
||||
style = style.deriveBorder(0, CELL_ELEMENT_BORDER, |
||||
0, CELL_ELEMENT_BORDER, |
||||
0, CELL_ELEMENT_BORDER, |
||||
0, CELL_ELEMENT_BORDER); |
||||
cellElement.setStyle(style); |
||||
} |
||||
} |
||||
|
||||
public static void adjustFloatElement(FloatElement floatElement) { |
||||
if (DesignModeContext.isDuchampMode()) { |
||||
Style style = floatElement.getStyle(); |
||||
style = style.deriveBackground(ColorBackground.getInstance(TEMPLATE_BACKGROUND)); |
||||
style = style.deriveFRFont(style.getFRFont().applyForeground(Color.WHITE)); |
||||
floatElement.setStyle(style); |
||||
} |
||||
} |
||||
|
||||
public static Color adjustBack(Color color) { |
||||
return DesignModeContext.isDuchampMode() ? TEMPLATE_BACKGROUND : color; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,78 @@
|
||||
package com.fr.design.webattr; |
||||
|
||||
import com.fr.config.Configuration; |
||||
import com.fr.design.report.fit.BaseFitAttrPane; |
||||
import com.fr.design.report.fit.FitAttrModel; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.report.fit.ReportFitAttr; |
||||
import com.fr.report.fit.ReportFitConfig; |
||||
import com.fr.transaction.Configurations; |
||||
import com.fr.transaction.Worker; |
||||
|
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
|
||||
|
||||
public class ServerFitAttrPane extends BaseFitAttrPane { |
||||
|
||||
public ServerFitAttrPane() { |
||||
super(); |
||||
initComponents(); |
||||
} |
||||
|
||||
@Override |
||||
protected void initComponents() { |
||||
super.initComponents(); |
||||
populateModel(fitAttrModelList.get(0)); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void populateBean(ReportFitAttr reportFitAttr) { |
||||
reportFitAttr = fitAttrModel.getGlobalReportFitAttr(); |
||||
super.populateBean(reportFitAttr); |
||||
} |
||||
|
||||
|
||||
public ReportFitAttr updateBean() { |
||||
ReportFitAttr reportFitAttr = super.updateBean(); |
||||
Configurations.update(new Worker() { |
||||
@Override |
||||
public void run() { |
||||
fitAttrModel.setGlobalReportFitAttr(reportFitAttr); |
||||
} |
||||
|
||||
@Override |
||||
public Class<? extends Configuration>[] targets() { |
||||
return new Class[]{ReportFitConfig.class}; |
||||
} |
||||
}); |
||||
return null; |
||||
|
||||
} |
||||
|
||||
@Override |
||||
protected String[] getItemNames() { |
||||
return fitAttrModelList.stream().map(FitAttrModel::getModelName).toArray(String[]::new); |
||||
} |
||||
|
||||
@Override |
||||
protected ItemListener getItemListener() { |
||||
ServerFitAttrPane self = this; |
||||
return new ItemListener() { |
||||
@Override |
||||
public void itemStateChanged(ItemEvent e) { |
||||
if (e.getStateChange() == ItemEvent.SELECTED) { |
||||
for (FitAttrModel fitAttrModel : fitAttrModelList) { |
||||
if (ComparatorUtils.equals(e.getItem(), fitAttrModel.getModelName())) { |
||||
self.populateModel(fitAttrModel); |
||||
populateBean(null); |
||||
refresh(); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue