Browse Source

REPORT-60561 全局自适应-样式细节优化

bugfix/11.0
Henry.Wang 3 years ago
parent
commit
02b4a2b1ff
  1. 40
      designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java
  2. 23
      designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java
  3. 78
      designer-form/src/main/java/com/fr/design/actions/FormFitAttrAction.java
  4. 13
      designer-form/src/main/java/com/fr/design/fit/NewJForm.java
  5. 10
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  6. 12
      designer-realize/src/main/java/com/fr/design/webattr/ServerFitAttrPane.java

40
designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java

@ -16,7 +16,6 @@ import com.fr.general.ComparatorUtils;
import com.fr.report.fit.ReportFitAttr; import com.fr.report.fit.ReportFitAttr;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -32,6 +31,7 @@ import static com.fr.design.i18n.Toolkit.i18nText;
public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> { public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
protected JPanel contentJPanel; protected JPanel contentJPanel;
protected UILabel belowSetLabel;
protected UIComboBox itemChoose; protected UIComboBox itemChoose;
protected java.util.List<FitAttrModel> fitAttrModelList = new ArrayList<>(); protected java.util.List<FitAttrModel> fitAttrModelList = new ArrayList<>();
@ -40,6 +40,7 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
public JPanel attrJPanel; public JPanel attrJPanel;
public FitPreviewPane previewJPanel; public FitPreviewPane previewJPanel;
public FitAttrModel fitAttrModel; public FitAttrModel fitAttrModel;
private static final int BELOW_SET_COMPONENT_HSPACE = 8;
protected BaseFitAttrPane() { protected BaseFitAttrPane() {
@ -96,7 +97,7 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
} }
attrJPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); attrJPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
attrJPanel.setBorder(new EmptyBorder(0, 100, 10, 100)); attrJPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0));
contentJPanel.add(attrJPanel); contentJPanel.add(attrJPanel);
} }
@ -135,9 +136,18 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
protected void initPreviewJPanel() { protected void initPreviewJPanel() {
previewJPanel = new FitPreviewPane(); previewJPanel = new FitPreviewPane();
previewJPanel.setBorder(BorderFactory.createEmptyBorder(0, getPreviewJPanelLeft(), 0, 0));
contentJPanel.add(previewJPanel); contentJPanel.add(previewJPanel);
} }
private int getPreviewJPanelLeft() {
int left = 0;
if (belowSetLabel.getPreferredSize() != null) {
left = belowSetLabel.getPreferredSize().width + BELOW_SET_COMPONENT_HSPACE;
}
return left;
}
protected int getStateInPC(int index) { protected int getStateInPC(int index) {
FitType[] fitTypes = fitAttrModel.getFitTypes(); FitType[] fitTypes = fitAttrModel.getFitTypes();
return fitTypes[index].getState(); return fitTypes[index].getState();
@ -179,7 +189,7 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return i18nText("Fine-Designer_PC_Element_Case_Fit_Attr"); return i18nText("Fine-Designer_PC_Fit_Attr");
} }
protected abstract String[] getItemNames(); protected abstract String[] getItemNames();
@ -187,29 +197,26 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
protected void initComponents() { protected void initComponents() {
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
contentJPanel = new JPanel(); contentJPanel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(false, FlowLayout.LEFT, 0, 0);
contentJPanel.setLayout(FRGUIPaneFactory.createCenterFlowLayout());
this.add(contentJPanel); this.add(contentJPanel);
initItemChoose(); initItemChoose();
initPrompt();
} }
private void initItemChoose() { private void initItemChoose() {
JPanel chooseJPanel = new JPanel(); JPanel chooseJPanel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
chooseJPanel.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
ItemListener itemListener = getItemListener(); ItemListener itemListener = getItemListener();
itemChoose = new UIComboBox(getItemNames()); itemChoose = new UIComboBox(getItemNames());
itemChoose.addItemListener(itemListener); itemChoose.addItemListener(itemListener);
UILabel belowSetLabel = new UILabel(i18nText("Fine-Design_Report_Blow_Set")); belowSetLabel = new UILabel(i18nText("Fine-Design_Report_Blow_Set"));
JPanel hSpaceLabel = new JPanel();
hSpaceLabel.setSize(BELOW_SET_COMPONENT_HSPACE, 0);
JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[]{ JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[]{
belowSetLabel, itemChoose}, FlowLayout.LEFT, 0, 0); belowSetLabel, hSpaceLabel, itemChoose}, FlowLayout.LEFT);
chooseJPanel.add(buttonPane); chooseJPanel.add(buttonPane);
chooseJPanel.setPreferredSize(new Dimension(500, 50)); chooseJPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
JPanel jPanel = new JPanel(); contentJPanel.add(chooseJPanel);
jPanel.setLayout(FRGUIPaneFactory.createBorderLayout());
jPanel.add(chooseJPanel, BorderLayout.WEST);
contentJPanel.add(jPanel);
} }
@ -220,6 +227,9 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
} }
protected void initPrompt() {
}
protected void refresh() { protected void refresh() {
validate(); validate();
repaint(); repaint();

23
designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java

@ -34,22 +34,6 @@ public class ReportFitAttrAction extends JTemplateAction {
return null; return null;
} }
}; };
private static final MenuKeySet REPORT_FIT_ATTR_ELEMENTCASE = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'T';
}
@Override
public String getMenuName() {
return Toolkit.i18nText("Fine-Designer_PC_Element_Case_Fit_Attr");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
public ReportFitAttrAction(JTemplate jTemplate) { public ReportFitAttrAction(JTemplate jTemplate) {
super(jTemplate); super(jTemplate);
@ -57,12 +41,7 @@ public class ReportFitAttrAction extends JTemplateAction {
} }
private void initMenuStyle() { private void initMenuStyle() {
JTemplate jTemplate = getEditingComponent(); this.setMenuKeySet(REPORT_FIT_ATTR);
if (jTemplate.isJWorkBook()) {
this.setMenuKeySet(REPORT_FIT_ATTR);
} else {
this.setMenuKeySet(REPORT_FIT_ATTR_ELEMENTCASE);
}
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon("/com/fr/design/images/reportfit/fit"); this.setSmallIcon("/com/fr/design/images/reportfit/fit");

78
designer-form/src/main/java/com/fr/design/actions/FormFitAttrAction.java

@ -1,78 +0,0 @@
package com.fr.design.actions;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.UIDialog;
import com.fr.design.fit.DesignerUIModeConfig;
import com.fr.design.fit.NewJForm;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.report.fit.menupane.TemplateFitAttrPane;
import com.fr.report.fit.FitProvider;
import com.fr.report.fit.ReportFitAttr;
import javax.swing.KeyStroke;
import java.awt.event.ActionEvent;
/**
* Created by Administrator on 2015/7/6 0006.
*/
public class FormFitAttrAction extends JTemplateAction {
private static final MenuKeySet REPORT_FIT_ATTR_ELEMENTCASE = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'T';
}
@Override
public String getMenuName() {
return DesignerUIModeConfig.getInstance().newUIMode() ?
com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_PC_Adaptive_Attr") :
com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_PC_Element_Case_Fit_Attr");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
public FormFitAttrAction(JTemplate jTemplate) {
super(jTemplate);
initMenuStyle();
}
private void initMenuStyle() {
this.setMenuKeySet(REPORT_FIT_ATTR_ELEMENTCASE);
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(DesignerUIModeConfig.getInstance().newUIMode() ?
"/com/fr/design/images/reportfit/fit.png" :
"/com/fr/design/images/reportfit/fit");
}
@Override
public void actionPerformed(ActionEvent e) {
final JTemplate jwb = getEditingComponent();
if (jwb == null) {
return;
}
final FitProvider wbTpl = (FitProvider) jwb.getTarget();
ReportFitAttr fitAttr = wbTpl.getReportFitAttr();
TemplateFitAttrPane templateFitAttrPane = new TemplateFitAttrPane();
showFitDialog(fitAttr, jwb, wbTpl, templateFitAttrPane);
}
private void showFitDialog(ReportFitAttr fitAttr, final JTemplate jwb, final FitProvider wbTpl, final BasicBeanPane<ReportFitAttr> attrPane) {
attrPane.populateBean(fitAttr);
UIDialog dialog = attrPane.showMediumWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
wbTpl.setReportFitAttr(attrPane.updateBean());
jwb.fireTargetModified();
}
});
dialog.setVisible(true);
}
}

13
designer-form/src/main/java/com/fr/design/fit/NewJForm.java

@ -2,6 +2,7 @@ package com.fr.design.fit;
import com.fr.base.DynamicUnitList; import com.fr.base.DynamicUnitList;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.design.actions.FormMobileAttrAction;
import com.fr.design.actions.TemplateParameterAction; import com.fr.design.actions.TemplateParameterAction;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.LayoutAdapter;
@ -13,7 +14,6 @@ import com.fr.design.fit.common.AdaptiveSwitchUtil;
import com.fr.design.fit.common.LayoutTool; import com.fr.design.fit.common.LayoutTool;
import com.fr.form.fit.NewFormMarkAttr; import com.fr.form.fit.NewFormMarkAttr;
import com.fr.design.fit.common.TemplateTool; import com.fr.design.fit.common.TemplateTool;
import com.fr.design.actions.FormFitAttrAction;
import com.fr.design.actions.NewFormMobileAttrAction; import com.fr.design.actions.NewFormMobileAttrAction;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.preview.DeveloperPreview; import com.fr.design.preview.DeveloperPreview;
@ -86,7 +86,7 @@ public class NewJForm extends JForm {
Rectangle rectangle = LayoutTool.getAbsoluteBodySize(this); Rectangle rectangle = LayoutTool.getAbsoluteBodySize(this);
if (!isNewJFrom() && (rectangle.width != bodyWidth || rectangle.height != bodyHeight)) { if (!isNewJFrom() && (rectangle.width != bodyWidth || rectangle.height != bodyHeight)) {
TemplateTool.onlyChangeAbsoluteBodySize(bodyHeight, bodyWidth, this); TemplateTool.onlyChangeAbsoluteBodySize(bodyHeight, bodyWidth, this);
} else if(isNewJFrom()){ } else if (isNewJFrom()) {
if (rectangle.width > bodyWidth && rectangle.height > bodyHeight) { if (rectangle.width > bodyWidth && rectangle.height > bodyHeight) {
TemplateTool.onlyChangeAbsoluteBodySize(rectangle.height, rectangle.width, this); TemplateTool.onlyChangeAbsoluteBodySize(rectangle.height, rectangle.width, this);
} else if (rectangle.width > bodyWidth) { } else if (rectangle.width > bodyWidth) {
@ -123,9 +123,9 @@ public class NewJForm extends JForm {
@Override @Override
public ShortCut[] shortcut4TemplateMenu() { public ShortCut[] shortcut4TemplateMenu() {
if (this.index == FORM_TAB) { if (this.index == FORM_TAB) {
return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new NewFormMobileAttrAction(this), new FormFitAttrAction(this)}, new ShortCut[0]); return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new NewFormMobileAttrAction(this), getReportFitAttrAction()}, new ShortCut[0]);
} else { } else {
return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new NewFormMobileAttrAction(this), new FormFitAttrAction(this)}, this.getElementCaseDesign().shortcut4TemplateMenu()); return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new NewFormMobileAttrAction(this), getReportFitAttrAction()}, this.getElementCaseDesign().shortcut4TemplateMenu());
} }
} }
@ -177,7 +177,8 @@ public class NewJForm extends JForm {
private void processColumnAbsorbingEffect(XWTitleLayout xwTitleLayout, DynamicUnitList columnUnitList, Dimension bound) { private void processColumnAbsorbingEffect(XWTitleLayout xwTitleLayout, DynamicUnitList columnUnitList, Dimension bound) {
int temp = 0; int temp = 0;
int resolution = DesignerUIModeConfig.getInstance().getScreenResolution();; int resolution = DesignerUIModeConfig.getInstance().getScreenResolution();
;
int difference = 0; int difference = 0;
int i = 0; int i = 0;
while (true) { while (true) {
@ -201,7 +202,7 @@ public class NewJForm extends JForm {
private void processRowAbsorbingEffect(XWTitleLayout xwTitleLayout, DynamicUnitList rowUnitList, Dimension bound) { private void processRowAbsorbingEffect(XWTitleLayout xwTitleLayout, DynamicUnitList rowUnitList, Dimension bound) {
int temp = hasTitle(xwTitleLayout) ? TITLE_HEIGHT : 0; int temp = hasTitle(xwTitleLayout) ? TITLE_HEIGHT : 0;
int resolution =DesignerUIModeConfig.getInstance().getScreenResolution(); int resolution = DesignerUIModeConfig.getInstance().getScreenResolution();
int difference = 0; int difference = 0;
int i = 0; int i = 0;
while (true) { while (true) {

10
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -598,7 +598,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
} }
private ShortCut getReportFitAttrAction() { protected ShortCut getReportFitAttrAction() {
FormAdaptiveConfigUIProcessor adaptiveConfigUI = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUIProcessor.MARK_STRING); FormAdaptiveConfigUIProcessor adaptiveConfigUI = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUIProcessor.MARK_STRING);
if (adaptiveConfigUI != null) { if (adaptiveConfigUI != null) {
return adaptiveConfigUI.getConfigShortCut(this); return adaptiveConfigUI.getConfigShortCut(this);
@ -828,7 +828,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
provider.onClick(JForm.this); provider.onClick(JForm.this);
} }
}); });
if(StringUtils.isNotEmpty(provider.tooltipForPopItem())){ if (StringUtils.isNotEmpty(provider.tooltipForPopItem())) {
item.setToolTipText(provider.tooltipForPopItem()); item.setToolTipText(provider.tooltipForPopItem());
} }
menuItems.add(item); menuItems.add(item);
@ -1187,12 +1187,12 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
@Override @Override
public void setTemplateTheme(TemplateTheme newTheme, TemplateThemeCompatible compatible) { public void setTemplateTheme(TemplateTheme newTheme, TemplateThemeCompatible compatible) {
FormTheme oldTheme = getTarget().getTemplateTheme(); FormTheme oldTheme = getTarget().getTemplateTheme();
boolean shouldCreateUndoState = compatible == TemplateThemeCompatible.NONE && !StringUtils.equals(oldTheme.getName(), newTheme.getName()); boolean shouldCreateUndoState = compatible == TemplateThemeCompatible.NONE && !StringUtils.equals(oldTheme.getName(), newTheme.getName());
FormArea formArea = formDesign.getArea(); FormArea formArea = formDesign.getArea();
int horizontalValue = formArea.getHorizontalValue(); int horizontalValue = formArea.getHorizontalValue();
int verticalValue= formArea.getVerticalValue(); int verticalValue = formArea.getVerticalValue();
Dimension areaSize = formArea.getAreaSize(); Dimension areaSize = formArea.getAreaSize();
double widthValue = formArea.getWidthPaneValue(); double widthValue = formArea.getWidthPaneValue();
double heightValue = formArea.getHeightPaneValue(); double heightValue = formArea.getHeightPaneValue();

12
designer-realize/src/main/java/com/fr/design/webattr/ServerFitAttrPane.java

@ -1,6 +1,9 @@
package com.fr.design.webattr; package com.fr.design.webattr;
import com.fr.config.Configuration; import com.fr.config.Configuration;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.report.fit.BaseFitAttrPane; import com.fr.design.report.fit.BaseFitAttrPane;
import com.fr.design.report.fit.FitAttrModel; import com.fr.design.report.fit.FitAttrModel;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -9,6 +12,8 @@ import com.fr.report.fit.ReportFitConfig;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.Worker; import com.fr.transaction.Worker;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
@ -74,5 +79,12 @@ public class ServerFitAttrPane extends BaseFitAttrPane {
} }
}; };
} }
@Override
protected void initPrompt() {
UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Designer_Fit_Attr_Pane_Hint"));
uiLabel.setForeground(Color.lightGray);
contentJPanel.add(uiLabel);
}
} }

Loading…
Cancel
Save