|
|
|
@ -139,7 +139,7 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li
|
|
|
|
|
} |
|
|
|
|
this.checkButtonEnabled(); |
|
|
|
|
refreshEventListWrapperPane(); |
|
|
|
|
this.checkGroupPaneSize(); |
|
|
|
|
this.updateGroupPaneSize(contentPane); |
|
|
|
|
isPopulating = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -207,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(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
@ -297,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()) { |
|
|
|
@ -324,14 +330,14 @@ 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(); |
|
|
|
|
UIList uiList = wrapperPane.getNameEdList(); |
|
|
|
|
//contentPane是外层的Panel,如果不进行判断的话宽度就可能会小于contentPanel,右侧会有空隙
|
|
|
|
|
//所以需要判断一下,如果外层比较宽就取外层的宽度,防止空隙出现
|
|
|
|
|
uiList.setFixedCellWidth(Math.max(width, contentPane == null ? 0 : contentPane.getWidth())); |
|
|
|
|
uiList.setFixedCellWidth(width); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|