|
|
@ -20,8 +20,11 @@ import com.fr.form.ui.*; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.stable.ArrayUtils; |
|
|
|
import com.fr.stable.ArrayUtils; |
|
|
|
|
|
|
|
import com.fr.stable.AssistUtils; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.*; |
|
|
|
|
|
|
|
import javax.swing.event.PopupMenuEvent; |
|
|
|
|
|
|
|
import javax.swing.event.PopupMenuListener; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.event.ItemEvent; |
|
|
|
import java.awt.event.ItemEvent; |
|
|
|
import java.awt.event.ItemListener; |
|
|
|
import java.awt.event.ItemListener; |
|
|
@ -198,6 +201,7 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.setPreferredSize(new Dimension(100, 20)); |
|
|
|
this.setPreferredSize(new Dimension(100, 20)); |
|
|
|
|
|
|
|
this.initPopupMenuListener(userDefined); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setSelectedItemByWidgetClass(Class clazz) { |
|
|
|
public void setSelectedItemByWidgetClass(Class clazz) { |
|
|
@ -218,7 +222,7 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener |
|
|
|
super.setSelectedItem(anObject); |
|
|
|
super.setSelectedItem(anObject); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Vector getWidgetsName(boolean userDefined) { |
|
|
|
private Vector<Item> getWidgetsName(boolean userDefined) { |
|
|
|
|
|
|
|
|
|
|
|
WidgetOption[] reportWidgetInstance = getWidgetOptions(); |
|
|
|
WidgetOption[] reportWidgetInstance = getWidgetOptions(); |
|
|
|
Vector<Item> items = new Vector<Item>(); |
|
|
|
Vector<Item> items = new Vector<Item>(); |
|
|
@ -262,7 +266,45 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private WidgetOption[] getWidgetOptions() { |
|
|
|
private WidgetOption[] getWidgetOptions() { |
|
|
|
return (WidgetOption[]) ArrayUtils.addAll(WidgetOption.getReportWidgetInstance(), ExtraDesignClassManager.getInstance().getCellWidgetOptions()); |
|
|
|
return ArrayUtils.addAll(WidgetOption.getReportWidgetInstance(), ExtraDesignClassManager.getInstance().getCellWidgetOptions()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void initPopupMenuListener(boolean userDefined) { |
|
|
|
|
|
|
|
this.addPopupMenuListener(new PopupMenuListener() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { |
|
|
|
|
|
|
|
// 下拉刷新下列表
|
|
|
|
|
|
|
|
Vector<Item> widgetsName = getWidgetsName(userDefined); |
|
|
|
|
|
|
|
if (modelChanged(widgetsName)) { |
|
|
|
|
|
|
|
refreshBoxItems(widgetsName); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void popupMenuCanceled(PopupMenuEvent e) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean modelChanged(Vector<Item> widgetsName) { |
|
|
|
|
|
|
|
DefaultComboBoxModel model = (DefaultComboBoxModel) getModel(); |
|
|
|
|
|
|
|
int modelSize = model.getSize(); |
|
|
|
|
|
|
|
if (modelSize != widgetsName.size()) { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (int i = 0; i < modelSize; i++) { |
|
|
|
|
|
|
|
if (!AssistUtils.equals(model.getElementAt(i), widgetsName.elementAt(i))) { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|