Browse Source

REPORT-82899 数据脱敏三期 修改增加单元格脱敏属性的实现方式

feature/x
Leo.Qin 2 years ago
parent
commit
5bb7f1ac93
  1. 14
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  2. 2
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellPane.java
  3. 1
      designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

14
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java

@ -12,7 +12,6 @@ import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.MultilineLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField;
@ -129,8 +128,8 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private UIRadioButton previewAndExportButton;
private UIRadioButton[] desensitizationButtons;
private CellDesensitizationGroupsPane groupsPane;
private final int EXPORT_SCOPE = 0;
private final int PREVIEW_AND_EXPORT_SCOPE = 1;
private final int EXPORT_SCOPE = CellDesensitizationAttr.EXPORT_SCOPE;
private final int PREVIEW_AND_EXPORT_SCOPE = CellDesensitizationAttr.PREVIEW_AND_EXPORT_SCOPE;
private static final Color TIPS_FONT_COLOR = new Color(0x8f8f92);
@ -695,11 +694,11 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
}
private void populateDesensitizationBean(TemplateCellElement cellElement) {
CellDesensitizationAttr cellDesensitizationAttr = cellElement.getCellDesensitizationAttr();
CellDesensitizationAttr cellDesensitizationAttr = cellElement.getCellAttr(CellDesensitizationAttr.ATTR_TAG);
if (cellDesensitizationAttr == null) {
cellDesensitizationAttr = new CellDesensitizationAttr();
}
boolean exportSelected = cellDesensitizationAttr.getScope() == 0;
boolean exportSelected = cellDesensitizationAttr.getScope() == EXPORT_SCOPE;
exportButton.setSelected(exportSelected);
previewAndExportButton.setSelected(!exportSelected);
groupsPane.populate(cellDesensitizationAttr.getDesensitizationBeans());
@ -805,13 +804,14 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
* @param cellElement
*/
private void updateDesensitizationAttr(TemplateCellElement cellElement) {
CellDesensitizationAttr cellDesensitizationAttr = cellElement.getCellDesensitizationAttr();
CellDesensitizationAttr cellDesensitizationAttr = cellElement.getCellAttr(CellDesensitizationAttr.XML_TAG);
if (cellDesensitizationAttr == null) {
cellDesensitizationAttr = new CellDesensitizationAttr();
}
cellDesensitizationAttr.setScope(exportButton.isSelected() ? EXPORT_SCOPE : PREVIEW_AND_EXPORT_SCOPE);
cellDesensitizationAttr.setDesensitizationBeans(new ArrayList<>(groupsPane.update()));
cellElement.setCellDesensitizationAttr(cellDesensitizationAttr);
cellElement.addCellAttr(cellDesensitizationAttr);
}

2
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellPane.java

@ -291,7 +291,7 @@ public class DesensitizationCellPane extends BasicBeanPane {
for (int i = 1; i <= chars.length; i++) {
//如果原文本+省略号长度超过文本框
int width = textEditor.getWidth();
if (width != 0 && fontMetrics.charsWidth(chars, 0, i) + omitLength > width) {
if (width > 0 && fontMetrics.charsWidth(chars, 0, i) + omitLength > width) {
//从第i-1的位置截断再拼上省略号
omitText = text.substring(0, i - 2) + OMIT_TEXT;
break;

1
designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -1064,7 +1064,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
@Override
public void refreshMultipleDetails() {
tabsHeaderIconPane.setVisible(tc.isSelectedOneCell());
cellDSColumnAdvancedPane.setVisible(tc.isSelectedOneCell());
cellDSColumnBasicPane.setMultipleVisible(tc.isSelectedOneCell());
}

Loading…
Cancel
Save