diff --git a/designer/src/com/fr/design/widget/ui/ButtonGroupDictPane.java b/designer/src/com/fr/design/widget/ui/ButtonGroupDictPane.java index b02ef38f4..b7ead75f7 100644 --- a/designer/src/com/fr/design/widget/ui/ButtonGroupDictPane.java +++ b/designer/src/com/fr/design/widget/ui/ButtonGroupDictPane.java @@ -1,63 +1,80 @@ -package com.fr.design.widget.ui; - - -import java.awt.*; -import java.awt.event.ActionEvent; -import com.fr.design.gui.ispinner.UIBasicSpinner; -import java.awt.event.ActionListener; - -import com.fr.design.gui.ilable.UILabel; -import javax.swing.JPanel; -import javax.swing.SpinnerNumberModel; - -import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.form.ui.ButtonGroup; -import com.fr.general.Inter; - - -public class ButtonGroupDictPane extends JPanel { - private UIBasicSpinner columnSpinner; - private UICheckBox adaptiveCheckbox; - private UILabel columnLabel; - - public ButtonGroupDictPane() { - this.initComponents(); - } - - /** - * - */ - public void initComponents() { - this.setLayout(new FlowLayout(0)); - JPanel pane = new JPanel(new FlowLayout()); - adaptiveCheckbox = new UICheckBox(Inter.getLocText("Adaptive"), true); - adaptiveCheckbox.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); - columnLabel.setVisible(!adaptiveCheckbox.isSelected()); - } - }); - - this.columnLabel = new UILabel(Inter.getLocText("Button-Group-Display-Columns")); - columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1)); - pane.add(adaptiveCheckbox); - pane.add(columnLabel); - pane.add(columnSpinner); - - this.add(pane); - } - - public void populate(ButtonGroup buttonGroup) { - adaptiveCheckbox.setSelected(buttonGroup.isAdaptive()); - columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); - columnLabel.setVisible(!adaptiveCheckbox.isSelected()); - columnSpinner.setValue(buttonGroup.getColumnsInRow()); - } - - public void update(ButtonGroup buttonGroup) { - buttonGroup.setAdaptive(adaptiveCheckbox.isSelected()); - buttonGroup.setColumnsInRow((Integer)(columnSpinner.getValue())); - } - +package com.fr.design.widget.ui; + + +import java.awt.*; +import java.awt.event.ActionEvent; + +import com.fr.data.Dictionary; +import com.fr.design.gui.ispinner.UIBasicSpinner; +import java.awt.event.ActionListener; + +import com.fr.design.gui.ilable.UILabel; + +import javax.swing.*; + +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor; +import com.fr.form.ui.ButtonGroup; +import com.fr.general.Inter; + + +public class ButtonGroupDictPane extends JPanel { + private UIBasicSpinner columnSpinner; + private UICheckBox adaptiveCheckbox; + private UILabel columnLabel; + private AccessibleDictionaryEditor dictPane; + + + public ButtonGroupDictPane() { + this.initComponents(); + } + + /** + * + */ + public void initComponents() { + dictPane = new AccessibleDictionaryEditor(); + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + adaptiveCheckbox = new UICheckBox(Inter.getLocText("Adaptive"), true); + adaptiveCheckbox.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); + columnLabel.setVisible(!adaptiveCheckbox.isSelected()); + } + }); + this.columnLabel = new UILabel(Inter.getLocText("Button-Group-Display-Columns") + ":"); + columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1)); + + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double rowSize[] = {p, p}; + double columnSize[] = {p, p, f}; + Component[][] n_components = { + {new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), dictPane, null}, + {adaptiveCheckbox, columnLabel, columnSpinner} + }; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, 16, 8); + panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + this.add(panel); + + + } + + public void populate(ButtonGroup buttonGroup) { + dictPane.setValue(buttonGroup.getDictionary()); + adaptiveCheckbox.setSelected(buttonGroup.isAdaptive()); + columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); + columnLabel.setVisible(!adaptiveCheckbox.isSelected()); + columnSpinner.setValue(buttonGroup.getColumnsInRow()); + } + + public void update(ButtonGroup buttonGroup) { + buttonGroup.setDictionary((Dictionary) this.dictPane.getValue()); + buttonGroup.setAdaptive(adaptiveCheckbox.isSelected()); + buttonGroup.setColumnsInRow((Integer)(columnSpinner.getValue())); + } + } \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/ui/CheckBoxDictPane.java b/designer/src/com/fr/design/widget/ui/CheckBoxDictPane.java index 3648f504d..1dd028e6c 100644 --- a/designer/src/com/fr/design/widget/ui/CheckBoxDictPane.java +++ b/designer/src/com/fr/design/widget/ui/CheckBoxDictPane.java @@ -1,9 +1,10 @@ package com.fr.design.widget.ui; -import java.awt.BorderLayout; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ilable.UILabel; import javax.swing.JPanel; @@ -11,6 +12,7 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.DictionaryComboBox; import com.fr.design.gui.icombobox.DictionaryConstants; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.CheckBoxGroup; import com.fr.form.ui.ComboCheckBox; import com.fr.general.Inter; @@ -18,7 +20,7 @@ import com.fr.general.Inter; public class CheckBoxDictPane extends JPanel { private DictionaryComboBox delimiterComboBox; - private UIComboBox returnTypeComboBox; + private UIHeadGroup returnTypeComboBox; private DictionaryComboBox startComboBox; private DictionaryComboBox endComboBox; @@ -27,42 +29,38 @@ public class CheckBoxDictPane extends JPanel { private JPanel endPane; public CheckBoxDictPane() { - JPanel returnTypePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - returnTypePane.add(new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), BorderLayout.WEST); - returnTypeComboBox = new UIComboBox(new String[]{Inter.getLocText("Widget-Array"), Inter.getLocText("String")}); - returnTypePane.add(returnTypeComboBox, BorderLayout.CENTER); - this.add(returnTypePane); - + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel returnTypePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); delimiterPane =FRGUIPaneFactory.createBorderLayout_S_Pane(); UILabel label = new UILabel(Inter.getLocText("Form-Delimiter") + ":"); delimiterPane.add(label, BorderLayout.WEST); delimiterPane.add(delimiterComboBox = new DictionaryComboBox(DictionaryConstants.delimiters, DictionaryConstants.delimiterDisplays), BorderLayout.CENTER); delimiterComboBox.setEditable(true); - this.add(delimiterPane); - + startPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); startPane.add(new UILabel(Inter.getLocText("ComboCheckBox-Start_Symbol") + ":"), BorderLayout.WEST); startPane.add(startComboBox = new DictionaryComboBox(DictionaryConstants.symbols, DictionaryConstants.symbolDisplays), BorderLayout.CENTER); startComboBox.setEditable(true); - this.add(startPane); - + endPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); endPane.add(new UILabel(Inter.getLocText("ComboCheckBox-End_Symbol") + ":"), BorderLayout.WEST); endPane.add(endComboBox = new DictionaryComboBox(DictionaryConstants.symbols, DictionaryConstants.symbolDisplays), BorderLayout.CENTER); endComboBox.setEditable(true); - this.add(endPane); - - returnTypeComboBox.addActionListener(new ActionListener(){ - public void actionPerformed(ActionEvent e) { - checkVisible(); - } - }); + returnTypeComboBox = new UIHeadGroup(new String[]{Inter.getLocText("Widget-Array"), Inter.getLocText("String")}){ + protected void tabChanged(int newSelectedIndex) { +// checkVisible(newSelectedIndex); + //todo + } + }; + returnTypePane.add(returnTypeComboBox, BorderLayout.CENTER); + JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), returnTypePane}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7); + this.add(jPanel); } - private void checkVisible(){ - delimiterPane.setVisible(returnTypeComboBox.getSelectedIndex() == 1); - startPane.setVisible(returnTypeComboBox.getSelectedIndex() == 1); - endPane.setVisible(returnTypeComboBox.getSelectedIndex() == 1); + private void checkVisible(int selectIndex){ + delimiterPane.setVisible(selectIndex == 1); + startPane.setVisible(selectIndex == 1); + endPane.setVisible(selectIndex == 1); } public void populate(ComboCheckBox comboCheckBox) { @@ -70,7 +68,7 @@ public class CheckBoxDictPane extends JPanel { this.returnTypeComboBox.setSelectedIndex(comboCheckBox.isReturnString() ? 1 : 0); this.startComboBox.setSelectedItem(comboCheckBox.getStartSymbol()); this.endComboBox.setSelectedItem(comboCheckBox.getEndSymbol()); - checkVisible(); + checkVisible(this.returnTypeComboBox.getSelectedIndex()); } public void update(ComboCheckBox comboCheckBox) { comboCheckBox.setDelimiter((String)this.delimiterComboBox.getSelectedItem()); @@ -83,7 +81,7 @@ public class CheckBoxDictPane extends JPanel { this.returnTypeComboBox.setSelectedIndex(checkBoxGroup.isReturnString() ? 1 : 0); this.startComboBox.setSelectedItem(checkBoxGroup.getStartSymbol()); this.endComboBox.setSelectedItem(checkBoxGroup.getEndSymbol()); - checkVisible(); + checkVisible(this.returnTypeComboBox.getSelectedIndex()); } public void update(CheckBoxGroup checkBoxGroup) { checkBoxGroup.setDelimiter((String)this.delimiterComboBox.getSelectedItem()); diff --git a/designer/src/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java b/designer/src/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java index 3d8344e3c..3f6a407a9 100644 --- a/designer/src/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java @@ -1,7 +1,6 @@ package com.fr.design.widget.ui; -import java.awt.BorderLayout; -import java.awt.FlowLayout; +import java.awt.*; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -9,9 +8,13 @@ import javax.swing.JPanel; import com.fr.data.Dictionary; import com.fr.design.data.DataCreatorUI; import com.fr.design.gui.icheckbox.UICheckBox; +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.design.mainframe.widget.accessibles.AccessibleDictionaryEditor; import com.fr.design.present.dict.DictionaryPane; +import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; import com.fr.form.ui.CheckBoxGroup; import com.fr.general.Inter; @@ -31,7 +34,6 @@ public class CheckBoxGroupDefinePane extends FieldEditorDefinePane { - protected DictionaryPane dictPane; + protected AccessibleDictionaryEditor dictPane; public ComboBoxDefinePane() { this.initComponents(); @@ -16,20 +23,22 @@ public class ComboBoxDefinePane extends CustomWritableRepeatEditorPane @Override protected void initComponents() { super.initComponents(); - dictPane = new DictionaryPane(); } protected JPanel setForthContentPane () { - return null; + dictPane = new AccessibleDictionaryEditor(); + JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), dictPane}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7); + jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); + return jPanel; } protected void populateSubCustomWritableRepeatEditorBean(ComboBox e) { - this.dictPane.populateBean(e.getDictionary()); + this.dictPane.setValue(e.getDictionary()); } protected ComboBox updateSubCustomWritableRepeatEditorBean() { ComboBox combo = new ComboBox(); - combo.setDictionary(this.dictPane.updateBean()); + combo.setDictionary((Dictionary) this.dictPane.getValue()); return combo; } @@ -41,6 +50,6 @@ public class ComboBoxDefinePane extends CustomWritableRepeatEditorPane @Override public DataCreatorUI dataUI() { - return dictPane; + return null; } } \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/ui/ComboCheckBoxDefinePane.java b/designer/src/com/fr/design/widget/ui/ComboCheckBoxDefinePane.java index 9f5ed270d..33f73584f 100644 --- a/designer/src/com/fr/design/widget/ui/ComboCheckBoxDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/ComboCheckBoxDefinePane.java @@ -1,47 +1,56 @@ package com.fr.design.widget.ui; +import com.fr.data.Dictionary; import com.fr.design.data.DataCreatorUI; import com.fr.design.gui.icheckbox.UICheckBox; +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.design.mainframe.widget.accessibles.AccessibleDictionaryEditor; import com.fr.design.present.dict.DictionaryPane; import com.fr.form.ui.ComboCheckBox; import com.fr.general.Inter; +import com.fr.third.fr.pdf.layout.border.Border; import javax.swing.*; import java.awt.*; public class ComboCheckBoxDefinePane extends CustomWritableRepeatEditorPane { private CheckBoxDictPane checkBoxDictPane; - private DictionaryPane dictPane; + private AccessibleDictionaryEditor dictPane; private UICheckBox supportTagCheckBox; public ComboCheckBoxDefinePane() { super.initComponents(); - dictPane = new DictionaryPane(); } @Override protected JPanel setForthContentPane() { - JPanel attrPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); - attrPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - JPanel contenter = FRGUIPaneFactory.createBorderLayout_L_Pane(); - contenter.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + dictPane = new AccessibleDictionaryEditor(); + checkBoxDictPane = new CheckBoxDictPane(); + supportTagCheckBox = new UICheckBox(Inter.getLocText("Form-SupportTag"), true); + JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + Component[][] components = new Component[][]{ + new Component[]{supportTagCheckBox, null }, + new Component[]{new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), dictPane }, + new Component[]{checkBoxDictPane, null }, - checkBoxDictPane = new CheckBoxDictPane(); - attrPane.add(contenter); - //是否以标签形式显示 - JPanel tagPane = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane(); - supportTagCheckBox = new UICheckBox(Inter.getLocText("Form-SupportTag"), true); - tagPane.add(supportTagCheckBox); - contenter.add(tagPane, BorderLayout.NORTH); - - contenter.add(checkBoxDictPane, BorderLayout.WEST); - return attrPane; + }; + double[] rowSize = {p, p, p, p}; + double[] columnSize = {p, f}; + int[][] rowCount = {{1, 1},{1, 1},{1,1},{1,1}}; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); + panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + advancePane.add(panel); + return advancePane; } @Override protected void populateSubCustomWritableRepeatEditorBean(ComboCheckBox e) { - this.dictPane.populateBean(e.getDictionary()); + this.dictPane.setValue(e.getDictionary()); this.checkBoxDictPane.populate(e); this.supportTagCheckBox.setSelected(e.isSupportTag()); } @@ -50,14 +59,14 @@ public class ComboCheckBoxDefinePane extends CustomWritableRepeatEditorPane extends WritableRepeatEditorPane { private UICheckBox customDataCheckBox; private static final int CUSTOM_DATA_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("Form-Allow_CustomData") + 30; private static final int CUSTOM_DATA_CHECK_BOX_HEIGHT = 30; public CustomWritableRepeatEditorPane() { this.initComponents(); } @Override protected JPanel setThirdContentPane() { JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); this.customDataCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_CustomData"), false); this.customDataCheckBox.setPreferredSize( new Dimension(CUSTOM_DATA_CHECK_BOX_WIDTH, CUSTOM_DATA_CHECK_BOX_HEIGHT)); JPanel otherContentPane = this.setForthContentPane(); if (otherContentPane != null) { contentPane.add(otherContentPane,BorderLayout.CENTER); } return contentPane; } public JPanel setValidatePane(){ JPanel otherContentPane = super.setValidatePane(); otherContentPane.add(GUICoreUtils.createFlowPane(new JComponent[]{customDataCheckBox}, FlowLayout.LEFT, 5)); return otherContentPane; } protected abstract JPanel setForthContentPane(); protected void populateSubWritableRepeatEditorBean(T e) { this.customDataCheckBox.setSelected(e.isCustomData()); populateSubCustomWritableRepeatEditorBean(e); } protected abstract void populateSubCustomWritableRepeatEditorBean(T e); protected T updateSubWritableRepeatEditorBean() { T e = updateSubCustomWritableRepeatEditorBean(); e.setCustomData(this.customDataCheckBox.isSelected()); return e; } protected abstract T updateSubCustomWritableRepeatEditorBean(); } \ No newline at end of file +package com.fr.design.widget.ui; + +import com.fr.base.GraphHelper; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.form.ui.CustomWriteAbleRepeatEditor; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * Author : Shockway + * Date: 13-9-18 + * Time: 下午2:17 + */ +public abstract class CustomWritableRepeatEditorPane extends WritableRepeatEditorPane { + + private UICheckBox customDataCheckBox; + private static final int CUSTOM_DATA_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("Form-Allow_CustomData") + 30; + private static final int CUSTOM_DATA_CHECK_BOX_HEIGHT = 30; + + public CustomWritableRepeatEditorPane() { + this.initComponents(); + } + + @Override + protected JPanel setThirdContentPane() { + JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + this.customDataCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_CustomData"), false); + this.customDataCheckBox.setPreferredSize( + new Dimension(CUSTOM_DATA_CHECK_BOX_WIDTH, CUSTOM_DATA_CHECK_BOX_HEIGHT)); + JPanel otherContentPane = this.setForthContentPane(); + return otherContentPane; + } + + + public JPanel setValidatePane(){ + JPanel otherContentPane = super.setValidatePane(); + otherContentPane.add(GUICoreUtils.createFlowPane(new JComponent[]{customDataCheckBox}, FlowLayout.LEFT, 5)); + return otherContentPane; + } + + + protected abstract JPanel setForthContentPane(); + + protected void populateSubWritableRepeatEditorBean(T e) { + this.customDataCheckBox.setSelected(e.isCustomData()); + populateSubCustomWritableRepeatEditorBean(e); + } + + protected abstract void populateSubCustomWritableRepeatEditorBean(T e); + + protected T updateSubWritableRepeatEditorBean() { + T e = updateSubCustomWritableRepeatEditorBean(); + e.setCustomData(this.customDataCheckBox.isSelected()); + return e; + } + + protected abstract T updateSubCustomWritableRepeatEditorBean(); + +} \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java index 43405fa91..582c0e2ab 100644 --- a/designer/src/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java @@ -1,7 +1,10 @@ package com.fr.design.widget.ui; import com.fr.design.gui.icheckbox.UICheckBox; +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.design.utils.gui.GUICoreUtils; import com.fr.form.ui.DirectWriteEditor; import com.fr.general.Inter; @@ -12,7 +15,7 @@ import java.awt.*; //richer:需要提供能否直接编辑的控件设置面板——下拉框、复选框、时间、日期、下拉树 public abstract class DirectWriteEditorDefinePane extends FieldEditorDefinePane { public UICheckBox directWriteCheckBox; - private WaterMarkDictPane waterMarkDictPane; + protected WaterMarkDictPane waterMarkDictPane; public DirectWriteEditorDefinePane() { this.initComponents(); @@ -21,16 +24,17 @@ public abstract class DirectWriteEditorDefinePane e @Override protected JPanel setFirstContentPane() { - JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); - contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); directWriteCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_Edit"), false); + directWriteCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); directWriteCheckBox.setPreferredSize(new Dimension(100, 30)); waterMarkDictPane = new WaterMarkDictPane(); - contentPane.add(waterMarkDictPane); + contentPane.add(waterMarkDictPane, BorderLayout.NORTH); JPanel otherContentPane = this.setSecondContentPane(); if (otherContentPane != null) { - contentPane.add(otherContentPane); + contentPane.add(otherContentPane, BorderLayout.CENTER); } return contentPane; } diff --git a/designer/src/com/fr/design/widget/ui/ListEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/ListEditorDefinePane.java index 1f23e18dd..01d946be9 100644 --- a/designer/src/com/fr/design/widget/ui/ListEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/ListEditorDefinePane.java @@ -2,16 +2,21 @@ package com.fr.design.widget.ui; import javax.swing.JPanel; +import com.fr.data.Dictionary; import com.fr.design.data.DataCreatorUI; import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor; import com.fr.design.present.dict.DictionaryPane; import com.fr.form.ui.ListEditor; import com.fr.general.Inter; +import java.awt.*; + public class ListEditorDefinePane extends WriteUnableRepeatEditorPane { private UICheckBox needHeadCheckBox; - private DictionaryPane dictPane; + private AccessibleDictionaryEditor dictPane; public ListEditorDefinePane() { this.initComponents(); @@ -20,9 +25,14 @@ public class ListEditorDefinePane extends WriteUnableRepeatEditorPane { - private DictionaryPane dictPane; - - private ButtonGroupDictPane buttonGroupDictPane; - - public RadioGroupDefinePane() { - this.initComponents(); - } - - @Override - protected void initComponents() { - super.initComponents(); - - dictPane = new DictionaryPane(); - } - - @Override - protected JPanel setFirstContentPane() { - - JPanel centerPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - buttonGroupDictPane = new ButtonGroupDictPane(); - buttonGroupDictPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); - centerPane.add(buttonGroupDictPane); - return centerPane; - } - - @Override - protected RadioGroup updateSubFieldEditorBean() { - RadioGroup ob = new RadioGroup(); - - ob.setDictionary(this.dictPane.updateBean()); - this.buttonGroupDictPane.update(ob); - - return ob; - } - - @Override - protected String title4PopupWindow() { - return "radiogroup"; - } - - @Override - protected void populateSubFieldEditorBean(RadioGroup ob) { - this.dictPane.populateBean(ob.getDictionary()); - this.buttonGroupDictPane.populate(ob); - } - - @Override - public DataCreatorUI dataUI() { - return dictPane; - } +package com.fr.design.widget.ui; + +import javax.swing.JPanel; +import com.fr.design.data.DataCreatorUI; +import com.fr.form.ui.RadioGroup; + +public class RadioGroupDefinePane extends FieldEditorDefinePane { + + private ButtonGroupDictPane buttonGroupDictPane; + + public RadioGroupDefinePane() { + this.initComponents(); + } + + @Override + protected void initComponents() { + super.initComponents(); + + } + + @Override + protected JPanel setFirstContentPane() { + buttonGroupDictPane = new ButtonGroupDictPane(); + return buttonGroupDictPane; + } + + @Override + protected RadioGroup updateSubFieldEditorBean() { + RadioGroup ob = new RadioGroup(); + + this.buttonGroupDictPane.update(ob); + + return ob; + } + + @Override + protected String title4PopupWindow() { + return "radiogroup"; + } + + @Override + protected void populateSubFieldEditorBean(RadioGroup ob) { + this.buttonGroupDictPane.populate(ob); + } + + @Override + public DataCreatorUI dataUI() { + return null; + } } \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/ui/WritableRepeatEditorPane.java b/designer/src/com/fr/design/widget/ui/WritableRepeatEditorPane.java index f27b30857..8bb502d18 100644 --- a/designer/src/com/fr/design/widget/ui/WritableRepeatEditorPane.java +++ b/designer/src/com/fr/design/widget/ui/WritableRepeatEditorPane.java @@ -15,7 +15,7 @@ public abstract class WritableRepeatEditorPane @Override protected JPanel setSecondContentPane() { - JPanel contentPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0(); + JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); JPanel otherContentPane = this.setThirdContentPane(); if (otherContentPane != null) { diff --git a/designer/src/com/fr/design/widget/ui/WriteUnableRepeatEditorPane.java b/designer/src/com/fr/design/widget/ui/WriteUnableRepeatEditorPane.java index 33b8e3f88..d292bb45d 100644 --- a/designer/src/com/fr/design/widget/ui/WriteUnableRepeatEditorPane.java +++ b/designer/src/com/fr/design/widget/ui/WriteUnableRepeatEditorPane.java @@ -1,12 +1,15 @@ package com.fr.design.widget.ui; -import java.awt.BorderLayout; +import java.awt.*; import javax.swing.BorderFactory; import javax.swing.JPanel; import com.fr.design.gui.icheckbox.UICheckBox; +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.form.ui.WriteUnableRepeatEditor; import com.fr.general.Inter; @@ -21,15 +24,33 @@ public abstract class WriteUnableRepeatEditorPane= 0) { for (Enumeration e = node.children(); e.hasMoreElements(); ) { TreeNode n = (TreeNode) e.nextElement(); TreePath path = parent.pathByAddingChild(n); expandAll(tree, path, expand); } } if (expand) { tree.expandPath(parent); } else { tree.collapsePath(parent); } } } \ No newline at end of file +package com.fr.design.roleAuthority; + +import com.fr.base.BaseUtils; +import com.fr.base.FRCoreContext; +import com.fr.design.actions.UpdateAction; +import com.fr.design.constants.UIConstants; +import com.fr.design.data.DesignTableDataManager; +import com.fr.design.data.tabledata.Prepare4DataSourceChange; +import com.fr.design.gui.ibutton.UIHeadGroup; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.itoolbar.UIToolbar; +import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.DockingView; +import com.fr.design.menu.ToolBarDef; +import com.fr.general.Inter; +import com.fr.general.VT4FR; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.tree.TreeNode; +import javax.swing.tree.TreePath; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.Enumeration; + +/** + * 设计器左下角面板,用于在权限编辑时存放角色 + * Author : daisy + * Date: 13-8-30 + * Time: 下午2:22 + */ +public class ReportAndFSManagePane extends DockingView implements Prepare4DataSourceChange { + + private static final int REPORT_PLATEFORM_MANAGE = 0; + private static final int FS_MANAGE = 1; + private static final int LEFT_GAP = -125; + private static boolean isSupportFS = false; + private TreePath treePath = null; + + private static ReportAndFSManagePane singleton = new ReportAndFSManagePane(); + + private static RoleTree roleTree; + // carl:我先屏了,现在半拉子,等客户要了再好好做 +// private AddAction addAction = new AddAction(); +// private RemoveAction removeAction = new RemoveAction(); + private RefreshAction refreshAction = new RefreshAction(); + private UIHeadGroup buttonGroup; + private RoleSourceOP op; + protected String[] roleNames = new String[2]; + + public synchronized static ReportAndFSManagePane getInstance() { + singleton.op = new RoleSourceOP(); + singleton.op.setDataMode(isSupportFS ? FS_MANAGE : REPORT_PLATEFORM_MANAGE); + singleton.setDefaultSelectedRole(); + return singleton; + + } + + public ReportAndFSManagePane() { + initRoleTree(); + this.setLayout(new BorderLayout(4, 0)); + this.setBorder(null); + this.add(iniToolBarPane(), BorderLayout.NORTH); + refreshAction.setEnabled(true); + UIScrollPane scrollPane = new UIScrollPane(roleTree); + scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 0)); + scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); + initbuttonGroup(); + JPanel jPanel = new JPanel(new BorderLayout(4, 4)); + JPanel buttonPane = new JPanel(new GridLayout()); + buttonPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.LINE_COLOR)); + buttonPane.add(buttonGroup, BorderLayout.CENTER); + jPanel.add(buttonPane, BorderLayout.NORTH); + jPanel.add(scrollPane, BorderLayout.CENTER); + this.add(jPanel, BorderLayout.CENTER); + registerDSChangeListener(); + } + + private void initRoleTree() { + roleTree = new RoleTree() { + public void refreshRoleTree(String selectedRole) { + super.refreshRoleTree(selectedRole); + changeAlreadyEditedPaneRole(selectedRole); + } + + + protected void doWithValueChanged(TreeSelectionEvent e) { + super.doWithValueChanged(e); + TreeNode root = (TreeNode) roleTree.getModel().getRoot(); + TreePath parent = new TreePath(root); + setSelectedRole(roleTree.getSelectedRoleName(), parent); + + } + + protected void setTabRoleName(String roleName) { + roleNames[getMode()] = roleTree.getSelectedRoleName(); + } + }; + roleTree.setEnabled(true); + roleTree.setEditable(false); +// RoleTreeCellEditor treeCellEditor = new RoleTreeCellEditor(new UITextField()); +// treeCellEditor.addCellEditorListener(treeCellEditor); +// roleTree.setCellEditor(treeCellEditor); + roleTree.addMouseListener(new MouseAdapter() { + public void mouseClicked(MouseEvent e) { + super.mouseClicked(e); + roleTree.setEditable(false); +// int row = roleTree.getRowForLocation(e.getX(), e.getY()); +// TreePath path = roleTree.getPathForLocation(e.getX(), e.getY()); +// if (e.getClickCount() == 2 && buttonGroup.getSelectedIndex() == REPORT_PLATEFORM_MANAGE) { +// PrivilegeManagerProvider pm = PrivilegeManager.getProviderInstance(); +// AuthenticationProvider ap = pm.getAuthenticationProvider(); +// if (!(ap instanceof DaoAuthenticationProvider)) { +// roleTree.setEditable(true); +// roleTree.startEditingAtPath(path); +// treePath = path; +// } +// } + } + }); + } + + private void changeAlreadyEditedPaneRole(String selectedRole) { + RolesAlreadyEditedPane.getInstance().refreshDockingView(); + RoleTree roleTree = RolesAlreadyEditedPane.getInstance().getRoleTree(); + TreeNode root = (TreeNode) roleTree.getModel().getRoot(); + TreePath parent = new TreePath(root); + roleTree.setSelectedRole(selectedRole, parent); + } + + public void setDefaultSelectedRole() { + //设置选中的节点 + TreeNode root = (TreeNode) roleTree.getModel().getRoot(); + TreePath parent = new TreePath(root); + ExpandMutableTreeNode node = (ExpandMutableTreeNode) parent.getLastPathComponent(); + String selectedRole = null; + if (singleton != null) { + selectedRole = roleNames[getMode()]; + } + if (selectedRole == null) { + if (node.getChildCount() <= 0 || node.getFirstChild().getChildCount() <= 0) { + return; + } + selectedRole = node.getFirstChild().getChildAt(0).toString(); + } + roleTree.setSelectedRole(selectedRole, parent); + } + + + public RoleTree getRoleTree() { + return roleTree; + } + + /** + * 检查f) 每增删改一个角色信息(及时保存),先对比下privilege下之前的角色信息有没有发生变化(即在此期间有没有在其他途径中修改过) + */ + private void checkChanges() { + //如若有变化,则弹出下面的对话框 + int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Role_changed_isRefresh") + "?", + Inter.getLocText("FR-Designer_Refresh"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); + if (returnVal == JOptionPane.OK_OPTION) { + roleTree.refreshTreeNode(); + expandTree(roleTree, true); + roleTree.updateUI(); + } + + } + + private JPanel iniToolBarPane() { + ToolBarDef toolbarDef = new ToolBarDef(); + toolbarDef.addShortCut(refreshAction); + UIToolbar toolBar = ToolBarDef.createJToolBar(); + toolbarDef.updateToolBar(toolBar); + JPanel toolbarPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + toolbarPane.add(toolBar, BorderLayout.CENTER); + return toolbarPane; + } + + private void initbuttonGroup() { + isSupportFS = VT4FR.isLicAvailable(FRCoreContext.getBytes()) && VT4FR.FS_BI.support(); + Icon[] iconArray = null; + String[] textArray = null; + if (isSupportFS) { + iconArray = new Icon[]{BaseUtils.readIcon("/com/fr/web/images/platform/demo.png")}; + textArray = new String[]{Inter.getLocText("FR-Designer_FS_Name")}; + } else { + iconArray = new Icon[]{BaseUtils.readIcon("/com/fr/web/images/platform/platform_16_16.png")}; + textArray = new String[]{Inter.getLocText("M_Server-Platform_Manager")}; + } + buttonGroup = new UIHeadGroup(iconArray, textArray) { + public void tabChanged(int index) { + roleTree.setEditable(false); + if (op != null) { + op.setDataMode(getMode()); + //判断是否可编辑 + refreshDockingView(); + } + setDefaultSelectedRole(); + if (singleton != null) { + changeAlreadyEditedPaneRole(roleNames[getMode()]); + } + } + }; + buttonGroup.setBorder(BorderFactory.createMatteBorder(1, LEFT_GAP, 0, 0, UIConstants.LINE_COLOR)); + buttonGroup.setNeedLeftRightOutLine(false); + } + + private int getMode(){ + return isSupportFS?FS_MANAGE: REPORT_PLATEFORM_MANAGE; + } + + +// /** +// * 检查看看是否可以增删刷新按钮是都可以编辑,并且检查角色树是不是可以编辑 +// */ +// public void checkToolButtonsEnabled() { +// if (buttonGroup.getSelectedIndex() == REPORT_PLATEFORM_MANAGE) { +// PrivilegeManagerProvider pm = PrivilegeManager.getProviderInstance(); +// AuthenticationProvider ap = pm.getAuthenticationProvider(); +// PrivilegeFilter pf = pm.getPrivilegeFilter(); +// boolean isClickable = !(ap instanceof DaoAuthenticationProvider) +// && pf instanceof AuthorityControlFilter; +// addAction.setEnabled(isClickable); +// removeAction.setEnabled(isClickable); +// } else { +// addAction.setEnabled(false); +// removeAction.setEnabled(false); +// } +// +// } + + + /** + * 刷新界面 + */ + public void refreshDockingView() { + populate(new RoleSourceOP()); +// this.checkToolButtonsEnabled(); + } + + private void populate(RoleSourceOP op) { + this.op = op; + roleTree.populate(op); + expandTree(roleTree, true); + } + + public String getViewTitle() { + return null; + } + + public Icon getViewIcon() { + return null; + } + + /** + * 最佳定位 + * @return 定位 + */ + public Location preferredLocation() { + return null; + } + + /** + * 注册数据库改变的响应的Listener + */ + public void registerDSChangeListener() { + DesignTableDataManager.addDsChangeListener(new ChangeListener() { + + public void stateChanged(ChangeEvent e) { + roleTree.refreshTreeNode(); + expandTree(roleTree, true); + roleTree.updateUI(); + } + }); + + } + +// private class AddAction extends UpdateAction { +// public AddAction() { +// this.setName(Inter.getLocText("Add")); +// this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png")); +// } +// +// @Override +// public void actionPerformed(ActionEvent e) { +// refreshDockingView(); +// +// DefaultTreeModel treeModel = (DefaultTreeModel) roleTree.getModel(); +// ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot(); +// ExpandMutableTreeNode parentNode = (ExpandMutableTreeNode) root.getChildAt(0); +// String newName = Inter.getLocText("newNode") + (++newIndex); +// parentNode.add(new ExpandMutableTreeNode(newName)); +// op.addAction(newName); +// roleTree.updateUI(); +// +// try { +// synchronized (AuthorityRoleDAOManager.class) { +// AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(true); +// +// if (AuthorityRoleDAOManager.getAuthorityAllocation(pf, newName) != null) { +// newName = Inter.getLocText("newNode") + (++newIndex); +// roleTree.refreshTreeNode(); +// expandTree(roleTree, true); +// } +// +// AuthorityRoleDAOManager.addAuthorityRole(pf, new Authority(newName), new Allocation(), false, true); +// +// AuthorityRoleDAOManager.doEnd(pf); +// } +// } catch (Exception e1) { +// FRContext.getLogger().error(e1.getMessage(), e1); +// } +// } +// } + +// private class RemoveAction extends UpdateAction { +// +// public RemoveAction() { +// this.setName(Inter.getLocText("Remove")); +// this.setSmallIcon(UIConstants.CLEAR_ICON); +// } +// +// @Override +// public void actionPerformed(ActionEvent e) { +// +// +// NameObject selectedNO = roleTree.getSelectedNameObject(); +// +// if (selectedNO == null) { +// return; +// } +// +// int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Utils-Are_you_sure_to_remove_the_selected_item") + ":" + selectedNO.getName() + "?", +// Inter.getLocText("Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); +// if (returnVal == JOptionPane.OK_OPTION) { +// op.removeAction(selectedNO.getName()); +// +// try { +// AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(true); +// +// AuthorityRoleDAOManager.removeAuthorityRole(pf, new Authority(selectedNO.getName()), true); +// AuthorityRoleDAOManager.doEnd(pf); +// } catch (Exception e1) { +// FRContext.getLogger().error(e1.getMessage(), e1); +// } +// +// roleTree.refreshTreeNode(); +// expandTree(roleTree, true); +// roleTree.updateUI(); +// roleTree.requestFocus(); +// roleTree.setSelectionRow(roleTree.getRowCount() - 1); +// } +// } +// } + + + /* + * 刷新ReportletsTree + */ + private class RefreshAction extends UpdateAction { + + public RefreshAction() { + this.setName(Inter.getLocText("FR-Designer_Refresh")); + this.setSmallIcon(UIConstants.REFRESH_ICON); + } + + @Override + public void actionPerformed(ActionEvent evt) { + roleTree.refreshTreeNode(); + expandTree(roleTree, true); + roleTree.updateUI(); + } + } + + +// private class RoleTreeCellEditor extends DefaultCellEditor implements TreeCellEditor, CellEditorListener { +// +// private NameObject editingNO; +// private String oldName; +// private String newName; +// private UITextField jTextField; +// +// public RoleTreeCellEditor(final UITextField textField) { +// super(textField); +// this.jTextField = textField; +// this.jTextField.setPreferredSize(new Dimension(DesignerEnvManager.getEnvManager().getLastWestRegionContainerWidth() - 5, this.jTextField.getHeight())); +// } +// +// @Override +// public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row) { +// editingNO = ReportAndFSManagePane.this.roleTree.getSelectedNameObject(); +// oldName = editingNO.getName(); +// +// delegate.setValue(oldName); +// +// editorComponent.setPreferredSize(new java.awt.Dimension(ReportAndFSManagePane.this.getPreferredSize().width, editorComponent.getPreferredSize().height)); +// +// return editorComponent; +// } +// +// @Override +// +// public boolean isCellEditable(EventObject anEvent) { +// NameObject no = ReportAndFSManagePane.this.roleTree.getSelectedNameObject(); +// return !(no.getName() == Inter.getLocText("Role")); +// } +// +// @Override +// public Object getCellEditorValue() { +// newName = super.getCellEditorValue().toString(); +// editingNO.setName(newName); +// return editingNO; +// } +// +// +// private boolean checkRoleNameNotEmpty() { +// refreshDockingView(); +// +// String currentText = delegate.getCellEditorValue().toString(); +// boolean isContained = false; +// AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(false); +// if (pf != null && +// !ComparatorUtils.equals(oldName, currentText)) { +// try { +// Iterator iterator = AuthorityRoleDAOManager.authorityAllocationIterator(pf); +// +// while (iterator.hasNext()) { +// AuthorityAllocation authorityAllocation = (AuthorityAllocation) ((Map.Entry) iterator.next()) +// .getValue(); +// Authority _authority = authorityAllocation.getAuthority(); +// if(ComparatorUtils.equals(_authority.getName(), currentText)){ +// isContained = true; +// break; +// } +// } +// } catch (Exception e) { +// } +// } +// +// if (currentText.isEmpty() || isContained) { +// JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("RoleName_Can_Not_Be_Null") + "!"); +// roleTree.refreshTreeNode(); +// expandTree(roleTree, true); +// delegate.setValue(oldName); +// return false; +// } +// return true; +// } +// +// /* +// * 下面两个方法是CellEditorListener的 +// */ +// @Override +// public void editingCanceled(ChangeEvent e) { +// if (!checkRoleNameNotEmpty()) { +// treePath = null; +// return; +// } +// roleTree.stopEditing(); +// if (treePath == null) { +// return; +// } +// changeValue(); +// roleTree.refreshTreeNode(); +// expandTree(roleTree, true); +// } +// +// @Override +// public void editingStopped(ChangeEvent e) { +// if (!checkRoleNameNotEmpty()) { +// treePath = null; +// return; +// } +// changeValue(); +// roleTree.refreshTreeNode(); +// expandTree(roleTree, true); +// roleTree.updateUI(); +// } +// +// private void changeValue() { +// newName = delegate.getCellEditorValue().toString(); +// if (!newName.isEmpty() && newName != oldName) { +// roleTree.setSelectedRoleName(newName); +// op.rename(oldName, newName); +// +// AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(false); +// if (pf != null) { +// try { +// Iterator iterator = AuthorityRoleDAOManager.authorityAllocationIterator(pf); +// +// while (iterator.hasNext()) { +// AuthorityAllocation authorityAllocation = (AuthorityAllocation) ((Map.Entry) iterator.next()) +// .getValue(); +// Authority _authority = authorityAllocation.getAuthority(); +// if (ComparatorUtils.equals(_authority.getName(), oldName)) { +// _authority.setName(newName); +// } +// } +// } catch (Exception e) { +// } +// } +// +// try { +// AuthorityRoleDAOManager.doEnd(pf); +// } catch (Exception e) { +// FRContext.getLogger().error(e.getMessage(), e); +// } +// } +// } +// } + + + /** + * 展开树 + * @param tree 树 + * @param isExpand 是否展开 + */ + public void expandTree(JTree tree, boolean isExpand) { + TreeNode root = (TreeNode) tree.getModel().getRoot(); + expandAll(tree, new TreePath(root), isExpand); + } + + + private void expandAll(JTree tree, TreePath parent, boolean expand) { + TreeNode node = (TreeNode) parent.getLastPathComponent(); + if (node.getChildCount() >= 0) { + for (Enumeration e = node.children(); e.hasMoreElements(); ) { + TreeNode n = (TreeNode) e.nextElement(); + TreePath path = parent.pathByAddingChild(n); + expandAll(tree, path, expand); + } + } + if (expand) { + tree.expandPath(parent); + } else { + tree.collapsePath(parent); + } + } + +} \ No newline at end of file diff --git a/designer_base/src/com/fr/env/RemoteEnv.java b/designer_base/src/com/fr/env/RemoteEnv.java index 8fd63a18e..41e4860d2 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -1381,7 +1381,7 @@ public class RemoteEnv extends AbstractEnv { return; } SignIn.signIn(remoteEnv); - LicUtils.resetBytes(); + FRCoreContext.resetBytes(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshToolArea(); } catch (Exception em) { FRContext.getLogger().error(em.getMessage(), em); diff --git a/designer_chart/src/com/fr/design/chart/ChartTypePane.java b/designer_chart/src/com/fr/design/chart/ChartTypePane.java index 5cc09a3b4..7b1b74625 100644 --- a/designer_chart/src/com/fr/design/chart/ChartTypePane.java +++ b/designer_chart/src/com/fr/design/chart/ChartTypePane.java @@ -5,6 +5,7 @@ package com.fr.design.chart; */ import com.fr.base.FRContext; +import com.fr.base.FRCoreContext; import com.fr.chart.base.ChartInternationalNameContentBean; import com.fr.chart.chartattr.*; import com.fr.chart.charttypes.ChartTypeManager; @@ -14,7 +15,6 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.Inter; import com.fr.general.RegistEditionException; import com.fr.general.VT4FR; -import com.fr.stable.StableUtils; import javax.swing.*; import javax.swing.event.ListSelectionEvent; @@ -150,7 +150,7 @@ public class ChartTypePane extends ChartCommonWizardPane { String plotID = typeName[mainTypeList.getSelectedIndex()].getPlotID(); Chart chart = ChartTypeManager.getInstance().getChartTypes(plotID)[iconViewList.getSelectedIndex()]; if(chart.getPlot() != null){ - if(chart.getPlot() instanceof MapPlot && !(VT4FR.isLicAvailable(StableUtils.getBytes()) && VT4FR.CHART_MAP.support())){ + if(chart.getPlot() instanceof MapPlot && !(VT4FR.isLicAvailable(FRCoreContext.getBytes()) && VT4FR.CHART_MAP.support())){ JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Chart-Map_Not_Supported")); throw new RegistEditionException(VT4FR.CHART_MAP); } diff --git a/designer_form/src/com/fr/design/widget/ui/designer/RadioGroupDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/RadioGroupDefinePane.java index e76c8b8f0..d46163d40 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/RadioGroupDefinePane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/RadioGroupDefinePane.java @@ -7,7 +7,6 @@ import com.fr.design.widget.ui.designer.btn.ButtonGroupDefinePane; import com.fr.form.ui.RadioGroup; public class RadioGroupDefinePane extends ButtonGroupDefinePane { - private DictionaryPane dictPane; public RadioGroupDefinePane(XCreator xCreator) { @@ -18,16 +17,12 @@ public class RadioGroupDefinePane extends ButtonGroupDefinePane { @Override protected void initComponents() { super.initComponents(); - - dictPane = new DictionaryPane(); } @Override protected RadioGroup updateSubButtonGroupBean() { RadioGroup ob = (RadioGroup)creator.toData(); - ob.setDictionary(this.dictPane.updateBean()); - return ob; } @@ -38,11 +33,10 @@ public class RadioGroupDefinePane extends ButtonGroupDefinePane { @Override protected void populateSubButtonGroupBean(RadioGroup ob) { - this.dictPane.populateBean(ob.getDictionary()); } @Override public DataCreatorUI dataUI() { - return dictPane; + return null; } } \ No newline at end of file