+ /**
+ * Prepare a new {@link ConfigItem} instance, linked to the given
+ * {@link MetaInfo}.
+ *
+ * @param info
+ * the info
+ * @param autoDirtyHandling
+ * TRUE to automatically manage the setDirty/Save operations,
+ * FALSE if you want to do it yourself via
+ * {@link ConfigItem#setDirtyItem(int)}
+ */
+ protected ConfigItem(MetaInfo<E> info, boolean autoDirtyHandling) {
+ base = new ConfigItemBase<JComponent, E>(info, autoDirtyHandling) {
+ @Override
+ protected JComponent createEmptyField(int item) {
+ return ConfigItem.this.createEmptyField(item);
+ }
+
+ @Override
+ protected Object getFromInfo(int item) {
+ return ConfigItem.this.getFromInfo(item);
+ }
+
+ @Override
+ protected void setToInfo(Object value, int item) {
+ ConfigItem.this.setToInfo(value, item);
+ }
+
+ @Override
+ protected Object getFromField(int item) {
+ return ConfigItem.this.getFromField(item);
+ }
+
+ @Override
+ protected void setToField(Object value, int item) {
+ ConfigItem.this.setToField(value, item);
+ }
+
+ @Override
+ public JComponent createField(int item) {
+ JComponent field = super.createField(item);
+
+ int height = Math.max(getMinimumHeight(),
+ field.getMinimumSize().height);
+ field.setPreferredSize(new Dimension(200, height));
+
+ return field;
+ }
+
+ @Override
+ public List<JComponent> reload() {
+ List<JComponent> removed = base.reload();
+ if (!removed.isEmpty()) {
+ for (JComponent c : removed) {
+ main.remove(c);
+ }
+ main.revalidate();
+ main.repaint();
+ }
+
+ return removed;
+ }
+
+ @Override
+ protected JComponent removeItem(int item) {
+ JComponent removed = super.removeItem(item);
+ main.remove(removed);
+ main.revalidate();
+ main.repaint();
+
+ return removed;
+ }
+ };
+ }