|
|
|
@ -28,14 +28,7 @@ import javax.swing.event.ListDataEvent;
|
|
|
|
|
import javax.swing.event.ListDataListener; |
|
|
|
|
import javax.swing.event.ListSelectionEvent; |
|
|
|
|
import javax.swing.event.ListSelectionListener; |
|
|
|
|
import java.awt.AlphaComposite; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.awt.Color; |
|
|
|
|
import java.awt.Dimension; |
|
|
|
|
import java.awt.FlowLayout; |
|
|
|
|
import java.awt.FontMetrics; |
|
|
|
|
import java.awt.Graphics; |
|
|
|
|
import java.awt.Graphics2D; |
|
|
|
|
import java.awt.*; |
|
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
|
import java.lang.reflect.Constructor; |
|
|
|
@ -146,7 +139,7 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li
|
|
|
|
|
} |
|
|
|
|
this.checkButtonEnabled(); |
|
|
|
|
refreshEventListWrapperPane(); |
|
|
|
|
this.checkGroupPaneSize(); |
|
|
|
|
this.updateGroupPaneSize(contentPane); |
|
|
|
|
isPopulating = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -214,7 +207,7 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li
|
|
|
|
|
nameEdList.addModNameActionListener(new ModNameActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void nameModed(int index, String oldName, String newName) { |
|
|
|
|
checkGroupPaneSize(); |
|
|
|
|
updateGroupPaneSize(contentPane); |
|
|
|
|
saveSettings(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
@ -304,24 +297,30 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li
|
|
|
|
|
public void onAddItem(NameableCreator creator) { |
|
|
|
|
updateSelectedNameList(creator); |
|
|
|
|
getCommonHandlers().onAddItem(creator); |
|
|
|
|
checkGroupPaneSize(); |
|
|
|
|
updateGroupPaneSize(contentPane); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void onRemoveItem() { |
|
|
|
|
getCommonHandlers().onRemoveItem(); |
|
|
|
|
refreshEventListWrapperPane(); |
|
|
|
|
checkGroupPaneSize(); |
|
|
|
|
updateGroupPaneSize(contentPane); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void onCopyItem() { |
|
|
|
|
getCommonHandlers().onCopyItem(); |
|
|
|
|
checkGroupPaneSize(); |
|
|
|
|
updateGroupPaneSize(contentPane); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void checkGroupPaneSize() { |
|
|
|
|
/** |
|
|
|
|
* 根据父面板更新对应的面板宽度 |
|
|
|
|
* (如果小于父面板的宽度就填充到与父面板宽度一致) |
|
|
|
|
* |
|
|
|
|
* @param parentPane 父面板 |
|
|
|
|
*/ |
|
|
|
|
private void updateGroupPaneSize(JPanel parentPane) { |
|
|
|
|
int width = 180; |
|
|
|
|
Iterator<Map.Entry<String, ListWrapperPane>> iterator = nameEdListMap.entrySet().iterator(); |
|
|
|
|
while (iterator.hasNext()) { |
|
|
|
@ -331,7 +330,9 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li
|
|
|
|
|
width = Math.max(width, calculateUIListMaxCellWidth(uiList.getModel(), uiList.getFontMetrics(uiList.getFont()))); |
|
|
|
|
} |
|
|
|
|
iterator = nameEdListMap.entrySet().iterator(); |
|
|
|
|
width += 30; |
|
|
|
|
//contentPane是外层的Panel,如果不进行判断的话宽度就可能会小于contentPanel,右侧会有空隙
|
|
|
|
|
//所以需要判断一下,如果外层比较宽就取外层的宽度,防止空隙出现
|
|
|
|
|
width = Math.max(width + 30, parentPane == null ? 0 : parentPane.getWidth()); |
|
|
|
|
while (iterator.hasNext()) { |
|
|
|
|
Map.Entry<String, ListWrapperPane> entry = iterator.next(); |
|
|
|
|
ListWrapperPane wrapperPane = entry.getValue(); |
|
|
|
|