|
|
@ -139,7 +139,7 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li |
|
|
|
} |
|
|
|
} |
|
|
|
this.checkButtonEnabled(); |
|
|
|
this.checkButtonEnabled(); |
|
|
|
refreshEventListWrapperPane(); |
|
|
|
refreshEventListWrapperPane(); |
|
|
|
this.checkGroupPaneSize(); |
|
|
|
this.updateGroupPaneSize(contentPane); |
|
|
|
isPopulating = false; |
|
|
|
isPopulating = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -207,7 +207,7 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li |
|
|
|
nameEdList.addModNameActionListener(new ModNameActionListener() { |
|
|
|
nameEdList.addModNameActionListener(new ModNameActionListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void nameModed(int index, String oldName, String newName) { |
|
|
|
public void nameModed(int index, String oldName, String newName) { |
|
|
|
checkGroupPaneSize(); |
|
|
|
updateGroupPaneSize(contentPane); |
|
|
|
saveSettings(); |
|
|
|
saveSettings(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -297,24 +297,30 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li |
|
|
|
public void onAddItem(NameableCreator creator) { |
|
|
|
public void onAddItem(NameableCreator creator) { |
|
|
|
updateSelectedNameList(creator); |
|
|
|
updateSelectedNameList(creator); |
|
|
|
getCommonHandlers().onAddItem(creator); |
|
|
|
getCommonHandlers().onAddItem(creator); |
|
|
|
checkGroupPaneSize(); |
|
|
|
updateGroupPaneSize(contentPane); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onRemoveItem() { |
|
|
|
public void onRemoveItem() { |
|
|
|
getCommonHandlers().onRemoveItem(); |
|
|
|
getCommonHandlers().onRemoveItem(); |
|
|
|
refreshEventListWrapperPane(); |
|
|
|
refreshEventListWrapperPane(); |
|
|
|
checkGroupPaneSize(); |
|
|
|
updateGroupPaneSize(contentPane); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onCopyItem() { |
|
|
|
public void onCopyItem() { |
|
|
|
getCommonHandlers().onCopyItem(); |
|
|
|
getCommonHandlers().onCopyItem(); |
|
|
|
checkGroupPaneSize(); |
|
|
|
updateGroupPaneSize(contentPane); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void checkGroupPaneSize() { |
|
|
|
/** |
|
|
|
|
|
|
|
* 根据父面板更新对应的面板宽度 |
|
|
|
|
|
|
|
* (如果小于父面板的宽度就填充到与父面板宽度一致) |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param parentPane 父面板 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void updateGroupPaneSize(JPanel parentPane) { |
|
|
|
int width = 180; |
|
|
|
int width = 180; |
|
|
|
Iterator<Map.Entry<String, ListWrapperPane>> iterator = nameEdListMap.entrySet().iterator(); |
|
|
|
Iterator<Map.Entry<String, ListWrapperPane>> iterator = nameEdListMap.entrySet().iterator(); |
|
|
|
while (iterator.hasNext()) { |
|
|
|
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()))); |
|
|
|
width = Math.max(width, calculateUIListMaxCellWidth(uiList.getModel(), uiList.getFontMetrics(uiList.getFont()))); |
|
|
|
} |
|
|
|
} |
|
|
|
iterator = nameEdListMap.entrySet().iterator(); |
|
|
|
iterator = nameEdListMap.entrySet().iterator(); |
|
|
|
width += 30; |
|
|
|
//contentPane是外层的Panel,如果不进行判断的话宽度就可能会小于contentPanel,右侧会有空隙
|
|
|
|
|
|
|
|
//所以需要判断一下,如果外层比较宽就取外层的宽度,防止空隙出现
|
|
|
|
|
|
|
|
width = Math.max(width + 30, parentPane == null ? 0 : parentPane.getWidth()); |
|
|
|
while (iterator.hasNext()) { |
|
|
|
while (iterator.hasNext()) { |
|
|
|
Map.Entry<String, ListWrapperPane> entry = iterator.next(); |
|
|
|
Map.Entry<String, ListWrapperPane> entry = iterator.next(); |
|
|
|
ListWrapperPane wrapperPane = entry.getValue(); |
|
|
|
ListWrapperPane wrapperPane = entry.getValue(); |
|
|
|
UIList uiList = wrapperPane.getNameEdList(); |
|
|
|
UIList uiList = wrapperPane.getNameEdList(); |
|
|
|
//contentPane是外层的Panel,如果不进行判断的话宽度就可能会小于contentPanel,右侧会有空隙
|
|
|
|
uiList.setFixedCellWidth(width); |
|
|
|
//所以需要判断一下,如果外层比较宽就取外层的宽度,防止空隙出现
|
|
|
|
|
|
|
|
uiList.setFixedCellWidth(Math.max(width, contentPane == null ? 0 : contentPane.getWidth())); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|