Browse Source

REPORT-64527 && REPORT-64525 && REPORT-64489 && REPORT-64485 && REPORT-64466 && REPORT-64463 && REPORT-64462 && REPORT-64460

feature/x
Henry.Wang 3 years ago
parent
commit
50fb8f23eb
  1. 5
      designer-base/src/main/resources/com/fr/design/images/buttonicon/select_disabled.svg
  2. 5
      designer-base/src/main/resources/com/fr/design/images/buttonicon/select_normal.svg
  3. BIN
      designer-base/src/main/resources/com/fr/design/images/sort/sequence.png
  4. 19
      designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java
  5. 47
      designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java
  6. 52
      designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceEditPane.java
  7. 18
      designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequencePane.java
  8. 30
      designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java
  9. 43
      designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java
  10. 6
      designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java

5
designer-base/src/main/resources/com/fr/design/images/buttonicon/select_disabled.svg

@ -0,0 +1,5 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.5 0.5H1.45833V1H1.5V1.5H0.5V0.5ZM2.375 0.5H3.29167V1.5H2.375V0.5ZM4.20833 0.5H5.125V1.5H4.20833V0.5ZM6.04167 0.5H6.95833V1.5H6.04167V0.5ZM7.875 0.5H8.79167V1.5H7.875V0.5ZM9.70833 0.5H10.625V1.5H9.70833V0.5ZM11.5417 0.5H12.5V1.5H11.5V1H11.5417V0.5ZM0.5 3.5V2.5H1.5V3.5H0.5ZM12.5 2.5V3.5H11.5V2.5H12.5ZM0.5 5.5V4.5H1.5V5.5H0.5ZM12.5 4.5V5.5H11.5V4.5H12.5ZM0.5 7.5V6.5H1.5V7.5H0.5ZM12.5 6.5V7.5H11.5V6.5H12.5ZM0.5 8.5H1.5V9H1.45833V9.5H0.5V8.5ZM3.29167 9.5H2.375V8.5H3.29167V9.5ZM5.125 9.5H4.20833V8.5H5.125V9.5ZM6.95833 9.5H6.04167V8.5H6.95833V9.5ZM8.79167 9.5H7.875V8.5H8.79167V9.5ZM10.625 9.5H9.70833V8.5H10.625V9.5ZM12.5 8.5V9.5H11.5417V9H11.5V8.5H12.5Z" fill="#C2C2C2"/>
<path d="M13.7602 15.0001C13.6857 15.0001 13.6111 15.0001 13.5365 15.0001C13.5351 14.9878 13.5275 14.9838 13.5159 14.9829C13.4597 14.9786 13.407 14.96 13.3549 14.9404C13.171 14.8709 13.0205 14.7576 12.9224 14.5854C12.8273 14.4184 12.7603 14.2374 12.6794 14.0632C12.5792 13.8474 12.4849 13.6289 12.3875 13.4118C12.3159 13.2522 12.243 13.0932 12.1714 12.9336C12.074 12.7165 11.9766 12.4993 11.8808 12.2815C11.8719 12.2612 11.35 12.6864 10.3153 13.5573C10.2385 13.622 10.1238 13.6121 10.0591 13.5353C10.0316 13.5026 10.0165 13.4613 10.0164 13.4186L10.001 7.3649C10.0007 7.26448 10.0819 7.18287 10.1823 7.18262C10.2218 7.18252 10.2603 7.19528 10.2919 7.21898L15.462 11.0966C15.5424 11.1568 15.5587 11.2708 15.4985 11.3512C15.4692 11.3902 15.4254 11.4159 15.377 11.4223C13.9063 11.6183 13.1749 11.723 13.1829 11.7363C13.2803 11.8984 13.3767 12.061 13.4745 12.2229C13.6247 12.4719 13.776 12.7203 13.9265 12.9692C14.0725 13.2107 14.2166 13.4534 14.3643 13.6939C14.4748 13.874 14.5144 14.0685 14.4805 14.275C14.4214 14.635 14.1357 14.9218 13.7808 14.9828C13.7695 14.9847 13.7616 14.9878 13.7602 15.0001Z" fill="#C2C2C2"/>
<path d="M10.1424 7.01206C10.1424 7.05547 10.1424 7.09902 10.1424 7.14242C10.0952 7.14242 10.048 7.14242 10.0008 7.14242C9.98988 6.88542 10.098 7.06584 10.1424 7.01206Z" fill="#C2C2C2"/>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

5
designer-base/src/main/resources/com/fr/design/images/buttonicon/select_normal.svg

@ -0,0 +1,5 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.5 0.5H1.45833V1H1.5V1.5H0.5V0.5ZM2.375 0.5H3.29167V1.5H2.375V0.5ZM4.20833 0.5H5.125V1.5H4.20833V0.5ZM6.04167 0.5H6.95833V1.5H6.04167V0.5ZM7.875 0.5H8.79167V1.5H7.875V0.5ZM9.70833 0.5H10.625V1.5H9.70833V0.5ZM11.5417 0.5H12.5V1.5H11.5V1H11.5417V0.5ZM0.5 3.5V2.5H1.5V3.5H0.5ZM12.5 2.5V3.5H11.5V2.5H12.5ZM0.5 5.5V4.5H1.5V5.5H0.5ZM12.5 4.5V5.5H11.5V4.5H12.5ZM0.5 7.5V6.5H1.5V7.5H0.5ZM12.5 6.5V7.5H11.5V6.5H12.5ZM0.5 8.5H1.5V9H1.45833V9.5H0.5V8.5ZM3.29167 9.5H2.375V8.5H3.29167V9.5ZM5.125 9.5H4.20833V8.5H5.125V9.5ZM6.95833 9.5H6.04167V8.5H6.95833V9.5ZM8.79167 9.5H7.875V8.5H8.79167V9.5ZM10.625 9.5H9.70833V8.5H10.625V9.5ZM12.5 8.5V9.5H11.5417V9H11.5V8.5H12.5Z" fill="#8F8F92"/>
<path d="M13.7602 15.0001C13.6857 15.0001 13.6111 15.0001 13.5365 15.0001C13.5351 14.9878 13.5275 14.9838 13.5159 14.9829C13.4597 14.9786 13.407 14.96 13.3549 14.9404C13.171 14.8709 13.0205 14.7576 12.9224 14.5854C12.8273 14.4184 12.7603 14.2374 12.6794 14.0632C12.5792 13.8474 12.4849 13.6289 12.3875 13.4118C12.3159 13.2522 12.243 13.0932 12.1714 12.9336C12.074 12.7165 11.9766 12.4993 11.8808 12.2815C11.8719 12.2612 11.35 12.6864 10.3153 13.5573C10.2385 13.622 10.1238 13.6121 10.0591 13.5353C10.0316 13.5026 10.0165 13.4613 10.0164 13.4186L10.001 7.3649C10.0007 7.26448 10.0819 7.18287 10.1823 7.18262C10.2218 7.18252 10.2603 7.19528 10.2919 7.21898L15.462 11.0966C15.5424 11.1568 15.5587 11.2708 15.4985 11.3512C15.4692 11.3902 15.4254 11.4159 15.377 11.4223C13.9063 11.6183 13.1749 11.723 13.1829 11.7363C13.2803 11.8984 13.3767 12.061 13.4745 12.2229C13.6247 12.4719 13.776 12.7203 13.9265 12.9692C14.0725 13.2107 14.2166 13.4534 14.3643 13.6939C14.4748 13.874 14.5144 14.0685 14.4805 14.275C14.4214 14.635 14.1357 14.9218 13.7808 14.9828C13.7695 14.9847 13.7616 14.9878 13.7602 15.0001Z" fill="#333334"/>
<path d="M10.1424 7.01206C10.1424 7.05547 10.1424 7.09902 10.1424 7.14242C10.0952 7.14242 10.048 7.14242 10.0008 7.14242C9.98988 6.88542 10.098 7.06584 10.1424 7.01206Z" fill="#333334"/>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/sort/sequence.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

19
designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java

@ -176,6 +176,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
private CellSelection formatReferencedCell = null;
private CellSelection cellNeedTOFormat = null;
private FormatBrushAction formatBrushAction;
private boolean repeatSelection = false;
private ActionListener keyListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@ -526,11 +527,17 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
return this.selection.getQuickEditor(this);
}
public boolean isRepeatSelection() {
return repeatSelection;
}
public void setRepeatSelection(boolean repeatSelection) {
this.repeatSelection = repeatSelection;
}
@Override
public void setSelection(Selection selection) {
if (!ComparatorUtils.equals(this.selection, selection)
|| !ComparatorUtils.equals(EastRegionContainerPane.getInstance().getCellAttrPane(), CellElementPropertyPane.getInstance())
|| DesignModeContext.isAuthorityEditing()) {
if (isEffectiveSelection(selection)) {
try {
//旧选中内容编辑器释放模板对象
QuickEditor editor = this.selection.getQuickEditorWithoutPopulate(this);
@ -545,6 +552,12 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
}
}
private boolean isEffectiveSelection(Selection selection) {
return (isRepeatSelection() || !ComparatorUtils.equals(this.selection, selection))
|| !ComparatorUtils.equals(EastRegionContainerPane.getInstance().getCellAttrPane(), CellElementPropertyPane.getInstance())
|| DesignModeContext.isAuthorityEditing();
}
public void setOldSelecton(Selection selection) {
this.selection = selection;

47
designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java

@ -12,8 +12,6 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.selection.SelectionEvent;
import com.fr.design.selection.SelectionListener;
import com.fr.design.ui.util.UIUtil;
import com.fr.general.Background;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection;
import com.fr.log.FineLoggerFactory;
@ -30,8 +28,6 @@ import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
@ -50,6 +46,9 @@ public class SortColumnRowPane extends JPanel implements UIObserver {
private CellSelection oldSelection;
private SelectionListener gridSelectionChangeListener;
UIObserverListener uiObserverListener;
private final static Icon DISABLED_ICON = IconUtils.readIcon("/com/fr/design/images/buttonicon/select_disabled.svg");
private final static Icon ENABLE_ICON = IconUtils.readIcon("/com/fr/design/images/buttonicon/select_normal.svg");
private boolean enabled;
public SortColumnRowPane(int paneWidth, int paneHeight) {
this.paneWidth = paneWidth;
@ -91,12 +90,17 @@ public class SortColumnRowPane extends JPanel implements UIObserver {
}
void initSelectButton() {
selectButton = new UIButton(IconUtils.readIcon("/com/fr/design/images/buttonicon/select.png"));
selectButton = new UIButton(ENABLE_ICON);
selectButton.addMouseListener(new SelectActionListener(this));
this.add(selectButton);
}
public void populateBean(ColumnRow columnRow) {
populateBean(columnRow, true);
}
public void populateBean(ColumnRow columnRow, boolean enabled) {
this.enabled = enabled;
if (SortColumnRowPane.isAvailableColumnRow(columnRow)) {
colJTextField.setText(EssentialUtils.convertIntToABC(columnRow.column + 1));
rowJTextField.setText(String.valueOf(columnRow.row + 1));
@ -104,6 +108,11 @@ public class SortColumnRowPane extends JPanel implements UIObserver {
colJTextField.setText(StringUtils.EMPTY);
rowJTextField.setText(StringUtils.EMPTY);
}
if (enabled) {
selectButton.setIcon(ENABLE_ICON);
} else {
selectButton.setIcon(DISABLED_ICON);
}
refresh();
}
@ -141,25 +150,28 @@ public class SortColumnRowPane extends JPanel implements UIObserver {
@Override
public void mouseClicked(MouseEvent e) {
ElementCasePane elementCasePane = getCurrentElementCase();
if (elementCasePane == null || isAlreadyAddListener) {
return;
}
prepareSelectHeader(elementCasePane);
gridSelectionChangeListener = new SelectionListener() {
@Override
public void selectionChanged(SelectionEvent e) {
completeSelectHeader(elementCasePane);
if (enabled) {
ElementCasePane elementCasePane = getCurrentElementCase();
if (elementCasePane == null || isAlreadyAddListener) {
return;
}
};
elementCasePane.addSelectionChangeListener(gridSelectionChangeListener);
isAlreadyAddListener = true;
prepareSelectHeader(elementCasePane);
gridSelectionChangeListener = new SelectionListener() {
@Override
public void selectionChanged(SelectionEvent e) {
completeSelectHeader(elementCasePane);
}
};
elementCasePane.addSelectionChangeListener(gridSelectionChangeListener);
isAlreadyAddListener = true;
}
}
private void prepareSelectHeader(ElementCasePane elementCasePane) {
ashDisableHeaderCellsStyle(elementCasePane.getEditingElementCase());
oldSelection = (CellSelection) elementCasePane.getSelection();
elementCasePane.getGrid().setNotShowingTableSelectPane(false);
elementCasePane.setRepeatSelection(true);
elementCasePane.setEditable(false);
elementCasePane.repaint(10);
}
@ -179,6 +191,7 @@ public class SortColumnRowPane extends JPanel implements UIObserver {
elementCasePane.removeSelectionChangeListener(gridSelectionChangeListener);
isAlreadyAddListener = false;
elementCasePane.getGrid().setNotShowingTableSelectPane(true);
elementCasePane.setRepeatSelection(false);
elementCasePane.setEditable(true);
elementCasePane.repaint();
}

52
designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceEditPane.java

@ -5,12 +5,15 @@ import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ilist.UIList;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.alphafine.listener.DocumentAdapter;
import com.fr.design.mainframe.dnd.SerializableTransferable;
import com.fr.design.mainframe.share.ui.base.PlaceholderTextArea;
import com.fr.locale.InterProviderFactory;
import com.fr.report.core.sort.sortexpression.CustomSequenceSortExpression;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import java.awt.*;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
@ -27,6 +30,7 @@ import java.util.List;
public class CustomSequenceEditPane extends BasicPane {
java.util.List<String> customSequence;
JSplitPane jSplitPane;
JPanel referenceSequencePanel;
JPanel editSequencePanel;
JTextArea jTextArea;
@ -40,17 +44,32 @@ public class CustomSequenceEditPane extends BasicPane {
this.setLayout(new BorderLayout());
initReferenceSequencePanel();
initEditSequencePanel();
initSplitPane();
}
void initSplitPane() {
jSplitPane = new JSplitPane();
this.add(jSplitPane);
jSplitPane.setOneTouchExpandable(true);
jSplitPane.setContinuousLayout(true);
jSplitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
jSplitPane.setLeftComponent(referenceSequencePanel);
jSplitPane.setRightComponent(editSequencePanel);
jSplitPane.setDividerSize(10);
jSplitPane.setDividerLocation(200);
}
void initReferenceSequencePanel() {
referenceSequencePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
referenceSequencePanel = new JPanel();
referenceSequencePanel.setLayout(new BoxLayout(referenceSequencePanel, BoxLayout.Y_AXIS));
JPanel titlePane = new JPanel(new FlowLayout(FlowLayout.LEFT));
UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Reference_Sequence"));
referenceSequencePanel.add(uiLabel);
titlePane.add(uiLabel);
referenceSequencePanel.add(titlePane);
UIScrollPane uiScrollPane = new UIScrollPane(getReferenceSequenceList());
uiScrollPane.setPreferredSize(new Dimension(200, 300));
referenceSequencePanel.add(uiScrollPane);
referenceSequencePanel.setPreferredSize(new Dimension(200, 400));
this.add(referenceSequencePanel, BorderLayout.WEST);
referenceSequencePanel.setSize(new Dimension(200, 400));
}
private UIList getReferenceSequenceList() {
@ -69,18 +88,20 @@ public class CustomSequenceEditPane extends BasicPane {
}
void initEditSequencePanel() {
editSequencePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
editSequencePanel = new JPanel();
editSequencePanel.setLayout(new BoxLayout(editSequencePanel, BoxLayout.Y_AXIS));
JPanel titlePane = new JPanel(new FlowLayout(FlowLayout.LEFT));
UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Input_Sequence"));
editSequencePanel.add(uiLabel);
titlePane.add(uiLabel);
UILabel uiLabel2 = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Please_Interlace_Sequence_Elements"));
uiLabel2.setForeground(Color.lightGray);
editSequencePanel.add(uiLabel2);
titlePane.add(uiLabel2);
editSequencePanel.add(titlePane);
jTextArea = getTextArea();
UIScrollPane uiScrollPane = new UIScrollPane(jTextArea);
uiScrollPane.setPreferredSize(new Dimension(475, 300));
editSequencePanel.add(uiScrollPane);
this.add(editSequencePanel, BorderLayout.CENTER);
editSequencePanel.setSize(new Dimension(475, 300));
}
@ -88,6 +109,12 @@ public class CustomSequenceEditPane extends BasicPane {
PlaceholderTextArea placeholderTextArea = new PlaceholderTextArea(10, 10, getPlaceholderText());
new CustomSequenceEditDropTarget(placeholderTextArea, CustomSequenceSortExpression.getReferenceCustomSequences());
placeholderTextArea.setText(CustomSequenceSortExpression.customSequenceToString(customSequence, "\n"));
placeholderTextArea.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
placeholderTextArea.repaint();
}
});
return placeholderTextArea;
}
@ -139,12 +166,15 @@ public class CustomSequenceEditPane extends BasicPane {
DataFlavor[] dataFlavors = transferable.getTransferDataFlavors();
if (dataFlavors.length == 1) {
Integer index = (Integer) transferable.getTransferData(dataFlavors[0]);
String text = "";
JTextArea jTextArea = (JTextArea) dtde.getDropTargetContext().getComponent();
String text = jTextArea.getText();
if (StringUtils.isNotEmpty(text) && !text.endsWith("\n")) {
text += "\n";
}
java.util.List<String> customSequence = customSequences.get(index);
for (int i = 0; i < customSequence.size(); i++) {
text += customSequence.get(i) + "\n";
}
JTextArea jTextArea = (JTextArea) dtde.getDropTargetContext().getComponent();
jTextArea.setText(text);
}
} catch (Exception e) {

18
designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequencePane.java

@ -10,8 +10,8 @@ import com.fr.report.core.sort.sortexpression.CustomSequenceSortExpression;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.List;
@ -29,13 +29,15 @@ public class CustomSequencePane extends JPanel {
textField = new UITextField();
textField.setEditable(false);
textField.setPreferredSize(new Dimension(width - 20, AbstractSortPane.PANE_COMPONENT_HEIGHT));
Icon icon = IconUtils.readIcon("/com/fr/design/images/control/refresh.png");
Icon icon = IconUtils.readIcon("/com/fr/design/images/sort/sequence.png");
button = new UIButton(icon);
button.setBackground(Color.RED);
button.setOpaque(false);
button.setCursor(new Cursor(Cursor.HAND_CURSOR));
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
button.setPreferredSize(new Dimension(20, AbstractSortPane.PANE_COMPONENT_HEIGHT));
MouseAdapter mouseAdapter = new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
CustomSequenceEditPane customSequenceEditPane = new CustomSequenceEditPane(customSequence);
customSequenceEditPane.showWindowWithCustomSize(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
@ -45,9 +47,9 @@ public class CustomSequencePane extends JPanel {
}
}, new Dimension(700, 400)).setVisible(true);
}
});
button.setPreferredSize(new Dimension(20, AbstractSortPane.PANE_COMPONENT_HEIGHT));
};
button.addMouseListener(mouseAdapter);
textField.addMouseListener(mouseAdapter);
this.add(textField);
this.add(button);
}

30
designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java

@ -1,10 +1,14 @@
package com.fr.design.sort.header;
import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.sort.common.AbstractSortPane;
import com.fr.design.sort.common.SortColumnRowPane;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ColumnRow;
import javax.swing.*;
@ -43,13 +47,31 @@ public class HeaderAreaPane extends JPanel {
}
public void populateBean(ColumnRow columnRow, boolean showHeaderArea) {
areaJLayeredPane.populateBean(columnRow, showHeaderArea);
boolean enabled = true;
ElementCasePane elementCasePane = getCurrentElementCase();
if (elementCasePane != null) {
enabled = elementCasePane.isSelectedOneCell();
}
areaJLayeredPane.populateBean(columnRow, showHeaderArea, enabled);
}
public ColumnRow updateBean() {
return areaJLayeredPane.updateBean();
}
private ElementCasePane getCurrentElementCase() {
try {
TargetComponent targetComponent
= HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
if (targetComponent instanceof ElementCasePane) {
return (ElementCasePane) targetComponent;
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
return null;
}
class AreaJLayeredPane extends JPanel {
SortColumnRowPane columnRowPane;
JLayeredPane jLayeredPane;
@ -75,6 +97,7 @@ public class HeaderAreaPane extends JPanel {
setSortColumnRowPaneShow(uiComboBox.getSelectedIndex() == 1);
}
});
uiComboBox.setEnabled(false);
}
void setSortColumnRowPaneShow(boolean show) {
@ -97,14 +120,15 @@ public class HeaderAreaPane extends JPanel {
this.add(jLayeredPane);
}
public void populateBean(ColumnRow columnRow, boolean showHeaderArea) {
public void populateBean(ColumnRow columnRow, boolean showHeaderArea, boolean enabled) {
if (showHeaderArea) {
uiComboBox.setSelectedIndex(1);
} else {
uiComboBox.setSelectedIndex(0);
}
columnRowPane.populateBean(columnRow);
columnRowPane.populateBean(columnRow, enabled);
setSortColumnRowPaneShow(uiComboBox.getSelectedIndex() == 1);
uiComboBox.setEnabled(enabled);
}
public ColumnRow updateBean() {

43
designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java

@ -31,6 +31,8 @@ public class HeaderSortRulePane extends JPanel {
private static final String ASC_ICON_TEMPLATE_PATH = "/com/fr/design/images/sort/asc.svg";
private static final String DES_ICON_TEMPLATE_PATH = "/com/fr/design/images/sort/des.svg";
private static final String NOSORT_ICON_TEMPLATE_PATH = "/com/fr/design/images/sort/nosort.svg";
private static final double ICON_SCALE = SVGIcon.SYSTEM_SCALE * 1.25;
private static final int ICON_LENGTH = (int) Math.ceil(16 * ICON_SCALE);
IconButton ascIconButton;
IconButton desIconButton;
IconButton nosortIconButton;
@ -63,8 +65,8 @@ public class HeaderSortRulePane extends JPanel {
new Component[]{desUICheckBox = new UICheckBox(SortRule.DES.getDescription()), desIconButton = new IconButton(DES_ICON_TEMPLATE_PATH)},
new Component[]{nosortUICheckBox = new UICheckBox(SortRule.NO_SORT.getDescription()), nosortIconButton = new IconButton(NOSORT_ICON_TEMPLATE_PATH)},
};
double[] rowSize = {24, 24, 24};
double[] columnSize = {80, 30};
double[] rowSize = {ICON_LENGTH + 10, ICON_LENGTH + 10, ICON_LENGTH + 10};
double[] columnSize = {80, ICON_LENGTH + 10};
JPanel sortRuleItem = TableLayoutHelper.createCommonTableLayoutPane(components, rowSize, columnSize, 0);
this.add(sortRuleItem, BorderLayout.CENTER);
initUICheckBoxChange(ascUICheckBox, ascIconButton);
@ -125,12 +127,12 @@ public class HeaderSortRulePane extends JPanel {
jLayeredPane = new JLayeredPane();
iconLabel = getIconLabel(iconTemplatePath);
borderUiLabel = new UILabel();
borderUiLabel.setSize(16, 16);
borderUiLabel.setSize(ICON_LENGTH, ICON_LENGTH);
borderUiLabel.setOpaque(true);
borderUiLabel.setBackground(Color.WHITE);
iconLabel.setSize(16, 16);
iconLabel.setSize(ICON_LENGTH, ICON_LENGTH);
colorButton = new ColorListPane.ColorButton(Color.CYAN);
colorButton.setSize(16, 16);
colorButton.setSize(ICON_LENGTH, ICON_LENGTH);
colorButton.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
@ -139,7 +141,7 @@ public class HeaderSortRulePane extends JPanel {
uiObserverListener.doChange();
}
});
jLayeredPane.setPreferredSize(new Dimension(16, 16));
jLayeredPane.setPreferredSize(new Dimension(ICON_LENGTH, ICON_LENGTH));
jLayeredPane.add(iconLabel, JLayeredPane.POPUP_LAYER);
jLayeredPane.add(borderUiLabel, JLayeredPane.MODAL_LAYER);
@ -152,6 +154,14 @@ public class HeaderSortRulePane extends JPanel {
refreshIconLabel(icon);
}
void refreshIconLabel(BufferedImage bufferedImage) {
if (bufferedImage != null) {
this.bufferedImage = bufferedImage;
Icon icon = new SVGIcon(bufferedImage);
refreshIconLabel(icon);
}
}
void refreshIconLabel(Icon icon) {
if (icon != null) {
iconLabel.removeAll();
@ -175,7 +185,7 @@ public class HeaderSortRulePane extends JPanel {
String svgText = originalSvgText.replaceAll("\\{fillColor\\}", shiftColor(color));
InputStream svgInputStream = new ByteArrayInputStream(svgText.getBytes(StandardCharsets.UTF_8));
TranscoderInput input = new TranscoderInput(svgInputStream);
bufferedImage = SVGTranscoder.createImage(SVGIcon.SYSTEM_SCALE, input).getImage();
bufferedImage = SVGTranscoder.createImage(ICON_SCALE, input).getImage();
SVGIcon svgIcon = new SVGIcon(bufferedImage);
return svgIcon;
} catch (Exception e) {
@ -203,12 +213,11 @@ public class HeaderSortRulePane extends JPanel {
}
String shiftValue(int value) {
int resultValue = (int) ((((float) value) / 255) * 99);
if (resultValue < 10) {
return "0" + resultValue;
} else {
return "" + resultValue;
String resultValue = Integer.toHexString(value);
if (resultValue.length() == 1) {
resultValue = "0" + resultValue;
}
return resultValue;
}
private String getSvgText(InputStream inputStream) throws Exception {
@ -237,18 +246,14 @@ public class HeaderSortRulePane extends JPanel {
for (SortHeader.SortItem sortItem : sortItems) {
SortRule sortRule = sortItem.getSortRule();
BufferedImage bufferedImage = sortItem.getBufferedImage();
Icon icon = null;
if (bufferedImage != null) {
icon = new SVGIcon(bufferedImage);
}
if (sortRule == SortRule.ASC) {
ascIconButton.refreshIconLabel(icon);
ascIconButton.refreshIconLabel(bufferedImage);
ascUICheckBox.setSelected(true);
} else if (sortRule == SortRule.DES) {
desIconButton.refreshIconLabel(icon);
desIconButton.refreshIconLabel(bufferedImage);
desUICheckBox.setSelected(true);
} else if (sortRule == SortRule.NO_SORT) {
nosortIconButton.refreshIconLabel(icon);
nosortIconButton.refreshIconLabel(bufferedImage);
nosortUICheckBox.setSelected(true);
}

6
designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java

@ -35,15 +35,17 @@ public class SortHeaderPane extends JPanel {
public void populateBean(SortHeader sortHeader, String defaultHeaderArea) {
this.sortHeader = sortHeader;
boolean showHeaderArea = false;
ColumnRow columnRow = null;
SortHeader.SortItem[] sortItems = null;
String headerArea = defaultHeaderArea;
ColumnRow columnRow = ColumnRow.valueOf(headerArea);
if (sortHeader != null) {
headerArea = sortHeader.getHeaderArea();
sortItems = sortHeader.getSortItems();
showHeaderArea = SortColumnRowPane.isAvailableColumnRow(ColumnRow.valueOf(headerArea));
if (showHeaderArea) {
columnRow = ColumnRow.valueOf(headerArea);
}
}
columnRow = ColumnRow.valueOf(headerArea);
headerAreaPane.populateBean(columnRow, showHeaderArea);
headerSettingPane.populateBean(sortItems);
}

Loading…
Cancel
Save