Browse Source

Pull request #1704: REPORT-31454 展示为折叠树-交互改进(非cptx不展示该面板)

Merge in DESIGN/design from ~YAOH.WU/design:release/10.0 to release/10.0

* commit 'aaea0d92ee2493d54399f1c73dfd9d1ea74eaf29':
  REPORT-31454 展示为折叠树-交互改进(非cptx不展示该面板)
  REPORT-31454 展示为折叠树-交互改进(非cptx不展示该面板)
feature/big-screen
yaoh.wu 5 years ago
parent
commit
77a971a4dc
  1. 7
      designer-base/src/main/java/com/fr/design/fun/CellExpandAttrPanelProvider.java
  2. 4
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractCellExpandAttrPanelProvider.java
  3. 17
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandExtraAttrPane.java

7
designer-base/src/main/java/com/fr/design/fun/CellExpandAttrPanelProvider.java

@ -18,4 +18,11 @@ public interface CellExpandAttrPanelProvider extends Mutable {
* @return 创建单元格属性-扩展设置中的额外面板 * @return 创建单元格属性-扩展设置中的额外面板
*/ */
BasicBeanPane<TemplateCellElement> createPanel(); BasicBeanPane<TemplateCellElement> createPanel();
/**
* 是否应该展示
*
* @return return {@code true} if extra panel is displayable
*/
boolean isDisplayable();
} }

4
designer-base/src/main/java/com/fr/design/fun/impl/AbstractCellExpandAttrPanelProvider.java

@ -36,4 +36,8 @@ public class AbstractCellExpandAttrPanelProvider implements CellExpandAttrPanelP
public BasicBeanPane<TemplateCellElement> createPanel() { public BasicBeanPane<TemplateCellElement> createPanel() {
return null; return null;
} }
public boolean isDisplayable() {
return true;
}
} }

17
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandExtraAttrPane.java

@ -73,6 +73,7 @@ public class CellExpandExtraAttrPane extends JPanel {
} }
public void populate(TemplateCellElement cellElement) { public void populate(TemplateCellElement cellElement) {
refreshExtraPanel();
this.cellElement = cellElement; this.cellElement = cellElement;
if (extras != null) { if (extras != null) {
for (BasicBeanPane<TemplateCellElement> extra : extras) { for (BasicBeanPane<TemplateCellElement> extra : extras) {
@ -91,6 +92,17 @@ public class CellExpandExtraAttrPane extends JPanel {
} }
private void refresh() { private void refresh() {
refreshExtraPanel();
if (this.cellElement != null) {
if (extras != null) {
for (BasicBeanPane<TemplateCellElement> extra : extras) {
extra.populateBean(cellElement);
}
}
}
}
private void refreshExtraPanel() {
this.removeAll(); this.removeAll();
if (extras == null) { if (extras == null) {
extras = new ArrayList<>(); extras = new ArrayList<>();
@ -99,12 +111,14 @@ public class CellExpandExtraAttrPane extends JPanel {
Set<CellExpandAttrPanelProvider> attrProviders = ExtraDesignClassManager.getInstance().getArray(CellExpandAttrPanelProvider.MARK_STRING); Set<CellExpandAttrPanelProvider> attrProviders = ExtraDesignClassManager.getInstance().getArray(CellExpandAttrPanelProvider.MARK_STRING);
if (attrProviders != null) { if (attrProviders != null) {
for (CellExpandAttrPanelProvider attrProvider : attrProviders) { for (CellExpandAttrPanelProvider attrProvider : attrProviders) {
if (attrProvider.isDisplayable()) {
BasicBeanPane<TemplateCellElement> extra = attrProvider.createPanel(); BasicBeanPane<TemplateCellElement> extra = attrProvider.createPanel();
if (extra != null) { if (extra != null) {
extras.add(extra); extras.add(extra);
} }
} }
} }
}
Component[][] components = new Component[extras.size()][DEFAULT_COMPONENT_SIZE]; Component[][] components = new Component[extras.size()][DEFAULT_COMPONENT_SIZE];
for (int i = 0; i < extras.size(); i++) { for (int i = 0; i < extras.size(); i++) {
@ -115,9 +129,6 @@ public class CellExpandExtraAttrPane extends JPanel {
double[] columnSize = {TableLayout.PREFERRED, TableLayout.FILL}; double[] columnSize = {TableLayout.PREFERRED, TableLayout.FILL};
JPanel content = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, H_GAP, V_GAP); JPanel content = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, H_GAP, V_GAP);
this.add(content, BorderLayout.CENTER); this.add(content, BorderLayout.CENTER);
if (this.cellElement != null) {
this.populate(cellElement);
}
this.validate(); this.validate();
this.repaint(); this.repaint();
} }

Loading…
Cancel
Save