Browse Source

Merge pull request #5939 in DESIGN/design from release/11.0 to feature/x

* commit '54f789aa078f119e3659f984a9efd8e844b3668f':
  REPORT-59719 fix加个判断
  REPORT-59719 下拉框效果还有点问题 fix
  REPORT-59770 【主题切换】编辑主题时,主题配色修改以后,细节配置和整体预览里的颜色没有相应联动
  REPORT-59719 下拉框效果还有点问题
  REPORT-59719 【10.0】点击数据源的刷新按钮,数据列表会变空白
research/11.0
superman 3 years ago
parent
commit
dadf7326b1
  1. 5
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java
  2. 16
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java
  3. 2
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java
  4. 7
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListPane.java

5
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java

@ -80,12 +80,13 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
* 刷新ComboBox.items
*/
protected Iterator<String> items() {
nameList = new ArrayList<String>();
ConnectionConfig mgr = ConnectionConfig.getInstance();
Iterator<String> nameIt = mgr.getConnections().keySet().iterator();
Collection<String> noAuthConnections = WorkContext.getCurrent().get(DBConnectAuth.class).getNoAuthConnections();
nameList = new ArrayList<>();
if (noAuthConnections == null) {
return nameList.iterator();
}

16
designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java

@ -91,6 +91,9 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
refreshWorker.cancel(true);
}
// 记录原来选中的Item,重新加载后需要再次选中
Object lastSelectedItem = itemComboBox.getSelectedItem();
DefaultComboBoxModel model = ((DefaultComboBoxModel) itemComboBox.getModel());
model.removeAllElements();
@ -98,6 +101,12 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
model.addElement(EMPTY);
model.addElement(PENDING);
// 存在两种场景之前只考虑了填充场景 有populate会填充下 把这边的填充逻辑删了 所以没有问题
// 如果是纯通过刷新按钮 没有populate 需要手动设置下上次选中的内容
if (lastSelectedItem != null) {
model.setSelectedItem(lastSelectedItem);
}
refreshWorker = new SwingWorker<Iterator<String>, Void>() {
@Override
protected Iterator<String> doInBackground() throws Exception {
@ -112,7 +121,12 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
while(itemIt.hasNext()) {
model.addElement(itemIt.next());
}
itemComboBox.setMaximumRowCount(itemComboBox.getMaximumRowCount() + 1);
// 如果加载成功 但是下拉框是可见的 下拉框高度是会固定为原始高度 不会因为填充了更多下拉项而变化
// 需要重新设置下拉框高度 但值一样时相关事件不会生效 所以先加再减下
if (itemComboBox.isPopupVisible()) {
itemComboBox.setMaximumRowCount(itemComboBox.getMaximumRowCount() + 1);
itemComboBox.setMaximumRowCount(itemComboBox.getMaximumRowCount() - 1);
}
} catch (Exception e) {
if (!(e instanceof CancellationException)) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);

2
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java

@ -107,7 +107,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
addAttributeChangeListener(new AttributeChangeListener() {
@Override
public void attributeChange() {
if (!isPopulating) {
if (!isPopulating && !refreshingThemedColor) {
valueChangeAction();
}
}

7
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListPane.java

@ -40,6 +40,8 @@ public class ColorListPane extends JPanel implements UIObserver {
private final EventListenerList colorChangeListenerList = new EventListenerList();
private UIObserverListener uiObserverListener;
private boolean isPopulating = false;
public ColorListPane() {
this(DEFAULT_COLOR_COUNT, DEFAULT_COLOR_SIZE, DEFAULT_COLOR_GAP);
}
@ -61,6 +63,9 @@ public class ColorListPane extends JPanel implements UIObserver {
colorButton.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (isPopulating) {
return;
}
colorList.set(index, colorButton.getSelectObject());
fireColorStateChanged();
}
@ -88,6 +93,7 @@ public class ColorListPane extends JPanel implements UIObserver {
}
public void populate(List<Color> colors) {
isPopulating = true;
colorList.clear();
for (int i = 0; i < colors.size(); i++) {
Color color = colors.get(i);
@ -96,6 +102,7 @@ public class ColorListPane extends JPanel implements UIObserver {
colorButtons.get(i).setSelectObject(color);
}
}
isPopulating = false;
}
public List<Color> update() {

Loading…
Cancel
Save