Browse Source

Merge branch 'feature/10.0' of http://cloud.finedevelop.com:2015/scm/~mata.li/design into feature/10.0

master
Mata.Li 6 years ago
parent
commit
073601ed8f
  1. 70
      designer-chart/src/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkNorthPane.java

70
designer-chart/src/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkNorthPane.java

@ -1,13 +1,6 @@
package com.fr.design.chart.series.SeriesCondition.impl; package com.fr.design.chart.series.SeriesCondition.impl;
import java.awt.BorderLayout;
import java.awt.Component;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;
import javax.swing.JPanel;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
@ -22,12 +15,21 @@ import com.fr.general.Inter;
import com.fr.js.FormHyperlinkProvider; import com.fr.js.FormHyperlinkProvider;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
/** /**
+ * Created with IntelliJ IDEA. * + * Created with IntelliJ IDEA.
+ * User: zx * + * User: zx
+ * Date: 14-8-6 * + * Date: 14-8-6
+ * Time: 下午2:53 * + * Time: 下午2:53
+ */ * +
*
* @author zx
*/
public class FormHyperlinkNorthPane extends BasicBeanPane<FormHyperlinkProvider> { public class FormHyperlinkNorthPane extends BasicBeanPane<FormHyperlinkProvider> {
private UITextField itemNameTextField; private UITextField itemNameTextField;
@ -47,21 +49,16 @@ public class FormHyperlinkNorthPane extends BasicBeanPane<FormHyperlinkProvider
this.add(centerPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER);
formHyperlinkEditors = getFormHyperlinkEditors(); formHyperlinkEditors = getFormHyperlinkEditors();
targetFrameComboBox = formHyperlinkEditors == null ? new UIComboBox() : new UIComboBox(getFormHyperlinkEditNames()); targetFrameComboBox = formHyperlinkEditors == null ? new UIComboBox() : new UIComboBox(getFormHyperlinkEditNames());
targetFrameComboBox.setRenderer(new DefaultListCellRenderer() { targetFrameComboBox.setRenderer(new DefaultListCellRenderer());
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
return this;
}
});
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p}; double[] rowSize = {p, p, p};
double[] columnSize = {p, TableLayout.FILL}; double[] columnSize = {p, TableLayout.FILL};
Component[][] components; Component[][] components;
if(!this.needRenamePane){ if (!this.needRenamePane) {
components = new Component[][]{ components = new Component[][]{
{new UILabel(Inter.getLocText("FR-Designer_Form-Object")), targetFrameComboBox}, {new UILabel(Inter.getLocText("FR-Designer_Form-Object")), targetFrameComboBox},
}; };
}else{ } else {
itemNameTextField = new UITextField(); itemNameTextField = new UITextField();
components = new Component[][]{ components = new Component[][]{
{new UILabel(Inter.getLocText("FR-Designer_Name_has_Colon")), itemNameTextField}, {new UILabel(Inter.getLocText("FR-Designer_Name_has_Colon")), itemNameTextField},
@ -72,28 +69,28 @@ public class FormHyperlinkNorthPane extends BasicBeanPane<FormHyperlinkProvider
centerPane.add(northPane, BorderLayout.NORTH); centerPane.add(northPane, BorderLayout.NORTH);
} }
public Widget getEditingEditor(){ public Widget getEditingEditor() {
if (formHyperlinkEditors == null){ if (formHyperlinkEditors == null) {
return null; return null;
} }
String editingEditorName = (String)targetFrameComboBox.getSelectedItem(); String editingEditorName = (String) targetFrameComboBox.getSelectedItem();
for (Widget editor : formHyperlinkEditors){ for (Widget editor : formHyperlinkEditors) {
if (ComparatorUtils.equals(editingEditorName,editor.getWidgetName())){ if (ComparatorUtils.equals(editingEditorName, editor.getWidgetName())) {
return editor; return editor;
} }
} }
return null; return null;
} }
private Widget[] getFormHyperlinkEditors(){ private Widget[] getFormHyperlinkEditors() {
return DesignModelAdapter.getCurrentModelAdapter().getLinkableWidgets(); return DesignModelAdapter.getCurrentModelAdapter().getLinkableWidgets();
} }
private String[] getFormHyperlinkEditNames(){ private String[] getFormHyperlinkEditNames() {
String[] editorNames = new String[formHyperlinkEditors.length]; String[] editorNames = new String[formHyperlinkEditors.length];
int i =0; int i = 0;
for(Widget editor : formHyperlinkEditors){ for (Widget editor : formHyperlinkEditors) {
editorNames[i] = editor.getWidgetName(); editorNames[i] = editor.getWidgetName();
i++; i++;
} }
@ -107,27 +104,34 @@ public class FormHyperlinkNorthPane extends BasicBeanPane<FormHyperlinkProvider
@Override @Override
public void populateBean(FormHyperlinkProvider formHyperlink) { public void populateBean(FormHyperlinkProvider formHyperlink) {
if(itemNameTextField != null){ formHyperlinkEditors = getFormHyperlinkEditors();
if (itemNameTextField != null) {
this.itemNameTextField.setText(formHyperlink.getItemName()); this.itemNameTextField.setText(formHyperlink.getItemName());
} }
String editorName = formHyperlink.getRelateEditorName(); String editorName = formHyperlink.getRelateEditorName();
//防止初始的时候有空白选项 //防止初始的时候有空白选项
if (editorName == null){ if (editorName == null) {
return; return;
} }
if (targetFrameComboBox != null) {
//noinspection unchecked
targetFrameComboBox.setModel(new DefaultComboBoxModel(getFormHyperlinkEditNames()));
targetFrameComboBox.setSelectedItem(editorName); targetFrameComboBox.setSelectedItem(editorName);
} }
}
@Override @Override
public FormHyperlinkProvider updateBean() { public FormHyperlinkProvider updateBean() {
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); FormHyperlinkProvider formHyperlink =
StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
updateBean(formHyperlink); updateBean(formHyperlink);
return formHyperlink; return formHyperlink;
} }
@Override
public void updateBean(FormHyperlinkProvider formHyperlink) { public void updateBean(FormHyperlinkProvider formHyperlink) {
if(itemNameTextField != null){ if (itemNameTextField != null) {
formHyperlink.setItemName(this.itemNameTextField.getText()); formHyperlink.setItemName(this.itemNameTextField.getText());
} }
formHyperlink.setRelateEditorName((String) targetFrameComboBox.getSelectedItem()); formHyperlink.setRelateEditorName((String) targetFrameComboBox.getSelectedItem());

Loading…
Cancel
Save