|
|
|
@ -1,12 +1,10 @@
|
|
|
|
|
package com.fr.design.expand; |
|
|
|
|
|
|
|
|
|
import com.fine.swing.ui.layout.Layouts; |
|
|
|
|
import com.fine.theme.icon.LazyIcon; |
|
|
|
|
import com.fr.design.constants.LayoutConstants; |
|
|
|
|
import com.fr.design.event.GlobalNameListener; |
|
|
|
|
import com.fr.design.event.GlobalNameObserver; |
|
|
|
|
import com.fr.design.gui.columnrow.ColumnRowPane; |
|
|
|
|
import com.fr.design.gui.core.ReactiveCardPane; |
|
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
|
import com.fr.design.mainframe.ElementCasePane; |
|
|
|
@ -18,12 +16,13 @@ import com.fr.grid.selection.Selection;
|
|
|
|
|
import com.fr.report.cell.cellattr.CellExpandAttr; |
|
|
|
|
import com.fr.stable.ColumnRow; |
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
|
import java.awt.*; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
|
import java.awt.event.ActionListener; |
|
|
|
|
|
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.cell; |
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.column; |
|
|
|
|
|
|
|
|
|
public abstract class ExpandFatherPane extends JPanel implements GlobalNameObserver { |
|
|
|
|
|
|
|
|
@ -35,7 +34,6 @@ public abstract class ExpandFatherPane extends JPanel implements GlobalNameObser
|
|
|
|
|
private String expandFatherName = ""; |
|
|
|
|
private GlobalNameListener globalNameListener = null; |
|
|
|
|
private boolean isAlreadyAddListener = false; |
|
|
|
|
private ReactiveCardPane cardPane; |
|
|
|
|
|
|
|
|
|
public ExpandFatherPane() { |
|
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
@ -55,20 +53,12 @@ public abstract class ExpandFatherPane extends JPanel implements GlobalNameObser
|
|
|
|
|
JPanel cc = new JPanel(new BorderLayout(LayoutConstants.HGAP_SMALL, 0)); |
|
|
|
|
cc.add(customParentColumnRowPane, BorderLayout.CENTER); |
|
|
|
|
cc.add(imageButton, BorderLayout.EAST); |
|
|
|
|
cardPane = ReactiveCardPane.create() |
|
|
|
|
.addSupplier("content", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, |
|
|
|
|
this.add(column(LayoutConstants.VERTICAL_GAP, |
|
|
|
|
cell(comboBox), |
|
|
|
|
cell(cc)).getComponent()) |
|
|
|
|
.addSupplier("none", () -> Layouts.cell(comboBox).getComponent()); |
|
|
|
|
cardPane.select("none").populate(); |
|
|
|
|
this.add(cardPane); |
|
|
|
|
cell(cc) |
|
|
|
|
).getComponent()); |
|
|
|
|
comboBox.addItemListener(e -> { |
|
|
|
|
if (comboBox.getSelectedIndex() == 2) { |
|
|
|
|
cardPane.select("content").populate(); |
|
|
|
|
} else { |
|
|
|
|
cardPane.select("none").populate(); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
cc.setVisible(comboBox.getSelectedIndex() == 2); |
|
|
|
|
if (globalNameListener != null && shouldResponseNameListener()) { |
|
|
|
|
globalNameListener.setGlobalName(expandFatherName); |
|
|
|
|
} |
|
|
|
|