Browse Source

Merge pull request #1180 in BA/design from ~MOMEAK/design9.0:release/9.0 to release/9.0

* commit 'b68082f4e4731a7661f497f307abe6146b3817cf':
  REPORT-2897 9.0设计器修改 缩放条在不同的sheet切换不应该继承 PMD
  REPORT-4308 单元格属性-样式,修改文本自定义样式无法实时生效
  代码质量
  REPORT-2897 9.0设计器修改 缩放条在不同的sheet切换不应该继承
  rollback UIToggleButton
  rollback UIToggleButton
  REPORT-2897 9.0设计器修改 缩放条在不同的sheet切换不应该继承 去掉表单缩放条
  rollback
  提交
master
superman 7 years ago
parent
commit
65f3870e85
  1. 10
      designer/src/com/fr/design/mainframe/ElementCasePane.java
  2. 5
      designer/src/com/fr/design/mainframe/JWorkBook.java
  3. 5
      designer/src/com/fr/design/mainframe/ReportComponent.java
  4. 9
      designer/src/com/fr/design/mainframe/ReportComponentComposite.java
  5. 11
      designer/src/com/fr/design/mainframe/WorkSheetDesigner.java
  6. 15
      designer/src/com/fr/poly/PolyDesigner.java
  7. 126
      designer_base/src/com/fr/design/gui/icombobox/TextFontComboBox.java
  8. 15
      designer_base/src/com/fr/design/gui/style/FormatPane.java
  9. 4
      designer_base/src/com/fr/design/mainframe/JSliderPane.java
  10. 2
      designer_base/src/com/fr/design/mainframe/JTemplate.java
  11. 6
      designer_form/src/com/fr/design/mainframe/FormArea.java
  12. 5
      designer_form/src/com/fr/design/mainframe/JForm.java

10
designer/src/com/fr/design/mainframe/ElementCasePane.java

@ -1325,7 +1325,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
* @return 返回正在编辑的状态.
*/
public EditingState createEditingState() {
return new ElementCaseEditingState(this.selection, this.verScrollBar.getValue(), this.horScrollBar.getValue());
return new ElementCaseEditingState(this.selection, this.verScrollBar.getValue(), this.horScrollBar.getValue(), this.resolution);
}
public void setCellNeedTOFormat(CellSelection selection) {
@ -1341,15 +1341,18 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
protected Selection selection;
protected int verticalValue = 0;
protected int horizontalValue = 0;
protected int resolution = ScreenResolution.getScreenResolution();
protected ElementCaseEditingState(Selection selection, int verticalValue, int horizontalValue) {
protected ElementCaseEditingState(Selection selection, int verticalValue, int horizontalValue, int resolution) {
try {
this.selection = selection.clone();
this.resolution = resolution;
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
this.verticalValue = verticalValue;
this.horizontalValue = horizontalValue;
this.resolution = resolution;
}
@Override
@ -1363,7 +1366,8 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
ElementCasePane.this.getVerticalScrollBar().setValue(this.verticalValue);
ElementCasePane.this.getHorizontalScrollBar().setValue(this.horizontalValue);
// ElementCasePane.this.setResolution(this.resolution);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(this.resolution);
// 重绘.
ElementCasePane.this.repaint();
}

5
designer/src/com/fr/design/mainframe/JWorkBook.java

@ -129,6 +129,11 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
return getEditingElementCasePane();
}
@Override
public JComponent getCurrentReportComponentPane() {
return reportComposite;
}
@Override
protected UIModeControlContainer createCenterPane() {
parameterPane = ModuleContext.isModuleStarted(Module.FORM_MODULE) ? new ParameterDefinitePane() : null;

5
designer/src/com/fr/design/mainframe/ReportComponent.java

@ -44,6 +44,11 @@ public abstract class ReportComponent<T extends TemplateReport, E extends Elemen
public abstract S getDefaultSelectElement();
/**
* 更新JSliderPane
*/
public abstract void updateJSliderValue();
@Override
public ShortCut[] shortcut4TemplateMenu() {

9
designer/src/com/fr/design/mainframe/ReportComponentComposite.java

@ -111,7 +111,6 @@ public class ReportComponentComposite extends JComponent {
return;
}
centerCardPane.populate(workbook.getTemplateReport(newIndex));
if (parentContainer != null) {
parentContainer.setDownPane(ReportComponentComposite.this);
}
@ -120,12 +119,16 @@ public class ReportComponentComposite extends JComponent {
EditingState reportPaneEditState = templateStateList.get(newIndex);
if (reportPaneEditState != null) {
reportPaneEditState.revert();
updateJSlider();
}
} else {
while (templateStateList.size() <= newIndex) {
templateStateList.add(null);
}
centerCardPane.editingComponet.setSelection(centerCardPane.editingComponet.getDefaultSelectElement());
if (jSliderContainer != null){
jSliderContainer.reset();
}
}
if (centerCardPane.editingComponet.elementCasePane == null) {
@ -141,6 +144,10 @@ public class ReportComponentComposite extends JComponent {
}
}
private void updateJSlider(){
centerCardPane.editingComponet.updateJSliderValue();
}
/**
* 移除选中状态
*

11
designer/src/com/fr/design/mainframe/WorkSheetDesigner.java

@ -4,11 +4,13 @@ import java.awt.BorderLayout;
import javax.swing.*;
import com.fr.base.ScreenResolution;
import com.fr.design.DesignState;
import com.fr.design.actions.report.*;
import com.fr.design.designer.EditingState;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.menu.*;
import com.fr.grid.selection.CellSelection;
@ -21,6 +23,8 @@ import com.fr.stable.ArrayUtils;
public class WorkSheetDesigner extends ReportComponent<WorkSheet, ElementCasePaneDelegate, Selection> {
private static final int HUND = 100;
public WorkSheetDesigner(WorkSheet sheet) {
super(sheet);
@ -166,6 +170,13 @@ public class WorkSheetDesigner extends ReportComponent<WorkSheet, ElementCasePan
return cellElement == null ? new CellSelection() : new CellSelection(0, 0, cellElement.getColumnSpan(), cellElement.getRowSpan());
}
@Override
public void updateJSliderValue() {
ReportComponentComposite reportComposite = (ReportComponentComposite) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentReportComponentPane();
JSliderPane jSliderContainer = reportComposite.getjSliderContainer();
jSliderContainer.getShowVal().setValue((int)Math.ceil((double) this.elementCasePane.getResolution() * HUND / ScreenResolution.getScreenResolution()));
}
@Override
public void addSelectionChangeListener(SelectionListener selectionListener) {
elementCasePane.addSelectionChangeListener(selectionListener);

15
designer/src/com/fr/poly/PolyDesigner.java

@ -87,6 +87,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
// richer:鼠标滚轮每滚动一下,PolyDesignPane的尺寸就改变ROTATIONS这么多
private static final int ROTATIONS = 50;
private static final int MIN = 10;
private static final int HUND = 100;
private JScrollBar verScrollBar;
private JScrollBar horScrollBar;
@ -687,14 +688,16 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
* @return 返回正在编辑的状态.
*/
public EditingState createEditingState() {
return new PolyDesignerEditingState(selection);
return new PolyDesignerEditingState(selection, resolution);
}
private class PolyDesignerEditingState implements EditingState {
private String blockName;
private Selection select;
protected int resolution = ScreenResolution.getScreenResolution();
public PolyDesignerEditingState(BlockCreator creator) {
public PolyDesignerEditingState(BlockCreator creator, int resolution) {
this.resolution = resolution;
if (creator == null) {
return;
}
@ -710,6 +713,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
public void revert() {
PolyDesigner.this.addedData = new AddedData(PolyDesigner.this);
stopEditingState();
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(this.resolution);
initPolyBlocks();
startEditing(blockName);
if (selection == null) {
@ -842,6 +846,13 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
return null;
}
@Override
public void updateJSliderValue() {
ReportComponentComposite reportComposite = (ReportComponentComposite) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentReportComponentPane();
JSliderPane jSliderContainer = reportComposite.getjSliderContainer();
jSliderContainer.getShowVal().setValue((int)Math.ceil((double)this.resolution * HUND / ScreenResolution.getScreenResolution()));
}
/**
* @return

126
designer_base/src/com/fr/design/gui/icombobox/TextFontComboBox.java

@ -0,0 +1,126 @@
package com.fr.design.gui.icombobox;
import com.fr.design.gui.icombobox.filter.Filter;
import com.fr.design.gui.icombobox.filter.StartsWithFilter;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.*;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
/**
* Created by MoMeak on 2017/9/5.
*/
public class TextFontComboBox<T> extends ExtendedComboBox {
private Filter filter;
public TextFontComboBox() {
this(new ArrayList<T>());
this.setEditable(true);
}
public TextFontComboBox(List<T> itemList) {
this(new StartsWithFilter(), itemList);
}
public TextFontComboBox(Filter filter, List<T> itemList) {
this.filter = filter;
setModel(new FilterableComboBoxModel(itemList));
setEditor(new TextFontComboBox.FilterComboBoxEditor());
setEditable(true);
}
public void setItemArray(T[] objectArray) {
List<T> itemList = new ArrayList<T>();
if (objectArray != null) {
for (int i = 0; i < objectArray.length; i++) {
itemList.add(objectArray[i]);
}
}
this.setItemList(itemList);
}
public void setItemList(List<T> itemList) {
((FilterableComboBoxModel) this.getModel()).setPrefix(StringUtils.EMPTY);
((FilterableComboBoxModel) this.getModel()).setItemList(itemList);
}
class FilterComboBoxEditor implements ComboBoxEditor, DocumentListener {
private Object item;
public UITextField textField;
private volatile boolean filtering = false;
private volatile boolean setting = false;
public FilterComboBoxEditor() {
textField = new UITextField(15);
textField.getDocument().addDocumentListener(this);
}
public Component getEditorComponent() {
return textField;
}
public void setItem(Object item) {
if (filtering) {
return;
}
this.item = item;
this.setting = true;
String newText = (item == null) ? StringUtils.EMPTY : item.toString();
textField.setText(newText);
this.setting = false;
}
public Object getItem() {
return this.item;
}
public void selectAll() {
textField.selectAll();
}
public void addActionListener(ActionListener l) {
textField.addActionListener(l);
}
public void removeActionListener(ActionListener l) {
textField.removeActionListener(l);
}
public void insertUpdate(DocumentEvent e) {
handleChange();
}
public void removeUpdate(DocumentEvent e) {
handleChange();
}
public void changedUpdate(DocumentEvent e) {
handleChange();
}
protected void handleChange() {
if (setting) {
return;
}
filtering = true;
((FilterableComboBoxModel) getModel()).setSelectedItem(textField.getText());
this.item = textField.getText();
setPopupVisible(true);
filtering = false;
}
}
}

15
designer_base/src/com/fr/design/gui/style/FormatPane.java

@ -9,8 +9,7 @@ import com.fr.data.core.FormatField.FormatContents;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.gui.icombobox.*;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
@ -22,6 +21,8 @@ import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.text.Format;
@ -51,7 +52,7 @@ public class FormatPane extends AbstractBasicStylePane {
private Format format;
private UIComboBox typeComboBox;
private UIComboBox textField;
private TextFontComboBox textField;
private UILabel sampleLabel;
private JPanel contentPane;
private JPanel txtCenterPane;
@ -89,7 +90,8 @@ public class FormatPane extends AbstractBasicStylePane {
contentPane.add(sampleLabel, BorderLayout.NORTH);
txtCenterPane = new JPanel(new BorderLayout());
textField = new UIComboBox(FormatField.getInstance().getFormatArray(getFormatContents()));
textField = new TextFontComboBox();
// textField.setItemArray(FormatField.getInstance().getFormatArray(getFormatContents()));
textField.addItemListener(textFieldItemListener);
textField.setEditable(true);
txtCenterPane.add(textField, BorderLayout.NORTH);
@ -322,9 +324,8 @@ public class FormatPane extends AbstractBasicStylePane {
cardLayout.show(centerPane, "hide");
} else {
textField.removeAllItems();
for (int i = 0; i < items.length; i++) {
textField.addItem(items[i]);
}
textField.setItemArray(items);
textField.setSelectedIndex(0);
centerPane.setPreferredSize(new Dimension(270, 65));
cardLayout.show(centerPane, "show");
}

4
designer_base/src/com/fr/design/mainframe/JSliderPane.java

@ -337,6 +337,10 @@ public class JSliderPane extends JPanel {
return this.showValue;
}
public void reset(){
this.showValSpinner.setValue(HUNDRED);
}
public static double divide(double v1, double v2, int scale) {
BigDecimal b1 = new BigDecimal(Double.toString(v1));
BigDecimal b2 = new BigDecimal(Double.toString(v2));

2
designer_base/src/com/fr/design/mainframe/JTemplate.java

@ -114,6 +114,8 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
public abstract TargetComponent getCurrentElementCasePane();
public abstract JComponent getCurrentReportComponentPane();
// 为收集模版信息作准备
private void initForCollect() {
template.initTemplateID(); // 为新模板设置 templateID 属性

6
designer_form/src/com/fr/design/mainframe/FormArea.java

@ -119,7 +119,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
// slidePane = new UINumberSlidePane(SLIDER_MIN, SLIDER_FLOAT);
// slidePane.setPreferredSize(new Dimension(260,20));
slidePane = JFormSliderPane.getInstance();
slidePane.setPreferredSize(new Dimension(350, 20));
slidePane.setPreferredSize(new Dimension(200, 20));
JPanel resizePane = TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{
@ -130,8 +130,8 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
setWidgetsConfig();
// 先初始话滑块及对应事件,然后获取分辨率调整容器的显示大小
slidePane.setEnabled(false);
slidePane.setVisible(true);
initTransparent();
slidePane.setVisible(false);
// initTransparent();
initCalculateSize();
}

5
designer_form/src/com/fr/design/mainframe/JForm.java

@ -103,6 +103,11 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
return elementCaseDesign.getEditingElementCasePane();
}
@Override
public JComponent getCurrentReportComponentPane() {
return null;
}
public int getMenuState() {
return DesignState.JFORM;

Loading…
Cancel
Save