diff --git a/designer/src/com/fr/design/mainframe/ElementCasePane.java b/designer/src/com/fr/design/mainframe/ElementCasePane.java index a04de9538..94fdcead8 100644 --- a/designer/src/com/fr/design/mainframe/ElementCasePane.java +++ b/designer/src/com/fr/design/mainframe/ElementCasePane.java @@ -1325,7 +1325,7 @@ public abstract class ElementCasePane 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 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 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(); } diff --git a/designer/src/com/fr/design/mainframe/JWorkBook.java b/designer/src/com/fr/design/mainframe/JWorkBook.java index 73edf7107..8d2854de7 100644 --- a/designer/src/com/fr/design/mainframe/JWorkBook.java +++ b/designer/src/com/fr/design/mainframe/JWorkBook.java @@ -129,6 +129,11 @@ public class JWorkBook extends JTemplate { return getEditingElementCasePane(); } + @Override + public JComponent getCurrentReportComponentPane() { + return reportComposite; + } + @Override protected UIModeControlContainer createCenterPane() { parameterPane = ModuleContext.isModuleStarted(Module.FORM_MODULE) ? new ParameterDefinitePane() : null; diff --git a/designer/src/com/fr/design/mainframe/ReportComponent.java b/designer/src/com/fr/design/mainframe/ReportComponent.java index 6ca268545..699f6c1c5 100644 --- a/designer/src/com/fr/design/mainframe/ReportComponent.java +++ b/designer/src/com/fr/design/mainframe/ReportComponent.java @@ -44,6 +44,11 @@ public abstract class ReportComponent { + private static final int HUND = 100; + public WorkSheetDesigner(WorkSheet sheet) { super(sheet); @@ -166,6 +170,13 @@ public class WorkSheetDesigner extends ReportComponent extends ExtendedComboBox { + private Filter filter; + + public TextFontComboBox() { + this(new ArrayList()); + this.setEditable(true); + } + + public TextFontComboBox(List itemList) { + this(new StartsWithFilter(), itemList); + } + + public TextFontComboBox(Filter filter, List itemList) { + this.filter = filter; + + setModel(new FilterableComboBoxModel(itemList)); + setEditor(new TextFontComboBox.FilterComboBoxEditor()); + setEditable(true); + } + + public void setItemArray(T[] objectArray) { + List itemList = new ArrayList(); + if (objectArray != null) { + for (int i = 0; i < objectArray.length; i++) { + itemList.add(objectArray[i]); + } + } + + this.setItemList(itemList); + } + + public void setItemList(List 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; + } + } +} diff --git a/designer_base/src/com/fr/design/gui/style/FormatPane.java b/designer_base/src/com/fr/design/gui/style/FormatPane.java index 0b810b7ae..d15e391cd 100644 --- a/designer_base/src/com/fr/design/gui/style/FormatPane.java +++ b/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"); } diff --git a/designer_base/src/com/fr/design/mainframe/JSliderPane.java b/designer_base/src/com/fr/design/mainframe/JSliderPane.java index 74745c0ed..1583ca770 100644 --- a/designer_base/src/com/fr/design/mainframe/JSliderPane.java +++ b/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)); diff --git a/designer_base/src/com/fr/design/mainframe/JTemplate.java b/designer_base/src/com/fr/design/mainframe/JTemplate.java index 633fc066b..eaf8e76c9 100644 --- a/designer_base/src/com/fr/design/mainframe/JTemplate.java +++ b/designer_base/src/com/fr/design/mainframe/JTemplate.java @@ -114,6 +114,8 @@ public abstract class JTemplate> ex public abstract TargetComponent getCurrentElementCasePane(); + public abstract JComponent getCurrentReportComponentPane(); + // 为收集模版信息作准备 private void initForCollect() { template.initTemplateID(); // 为新模板设置 templateID 属性 diff --git a/designer_form/src/com/fr/design/mainframe/FormArea.java b/designer_form/src/com/fr/design/mainframe/FormArea.java index e35657c23..cdf92edfe 100644 --- a/designer_form/src/com/fr/design/mainframe/FormArea.java +++ b/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(); } diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java index e6432bf1e..2effa34ba 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -103,6 +103,11 @@ public class JForm extends JTemplate implements BaseJForm { return elementCaseDesign.getEditingElementCasePane(); } + @Override + public JComponent getCurrentReportComponentPane() { + return null; + } + public int getMenuState() { return DesignState.JFORM;