Browse Source

REPORT-75998 修改UI与适配逻辑(同步final)

new-design
Destiny.Lin 2 years ago
parent
commit
bfd6b9d984
  1. 3
      designer-base/src/main/resources/com/fr/design/images/replace/change_normal.svg
  2. BIN
      designer-base/src/main/resources/com/fr/design/images/replace/replace.png
  3. 5
      designer-base/src/main/resources/com/fr/design/images/replace/replace_normal.svg
  4. 7
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java
  5. 152
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java
  6. 7
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java
  7. 22
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceWestPanel.java

3
designer-base/src/main/resources/com/fr/design/images/replace/change_normal.svg

@ -0,0 +1,3 @@
<svg width="18" height="14" viewBox="0 0 18 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.7565 0.174329C10.6883 0.11302 10.7317 0 10.8234 0H12.6172C12.6419 0 12.6657 0.00914436 12.6841 0.0256706L17.4402 4.30615C17.5764 4.42877 17.4897 4.65481 17.3064 4.65481H0.603381C0.548153 4.65481 0.503381 4.61004 0.503381 4.55481V3.35481C0.503381 3.29958 0.548152 3.25481 0.603381 3.25481H14.1792L10.7565 0.174329ZM7.25031 12.9352C7.31843 12.9965 7.27506 13.1095 7.18341 13.1095H5.38959C5.36489 13.1095 5.34106 13.1004 5.3227 13.0838L0.566609 8.80335C0.430366 8.68073 0.517105 8.45469 0.700402 8.45469H17.4034C17.4586 8.45469 17.5034 8.49946 17.5034 8.55469V9.75469C17.5034 9.80992 17.4586 9.85469 17.4034 9.85469H3.82755L7.25031 12.9352Z" fill="#333334" fill-opacity="0.5"/>
</svg>

After

Width:  |  Height:  |  Size: 831 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 418 B

After

Width:  |  Height:  |  Size: 437 B

5
designer-base/src/main/resources/com/fr/design/images/replace/replace_normal.svg

@ -1,3 +1,6 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <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="M6.90857 12.5269C3.871 12.5269 1.40857 10.0644 1.40857 7.02686C1.40857 3.98929 3.871 1.52686 6.90857 1.52686C9.94614 1.52686 12.4086 3.98929 12.4086 7.02686C12.4086 8.28787 11.9842 9.44977 11.2705 10.3775L14.3701 13.5236C14.6528 13.8062 14.6528 14.2645 14.3701 14.5472C14.0874 14.8298 13.6292 14.8298 13.3465 14.5472L10.2452 11.3995C9.31981 12.1067 8.16326 12.5269 6.90857 12.5269ZM11.4086 7.02686C11.4086 9.51214 9.39385 11.5269 6.90857 11.5269C4.42329 11.5269 2.40857 9.51214 2.40857 7.02686C2.40857 4.54157 4.42329 2.52686 6.90857 2.52686C9.39385 2.52686 11.4086 4.54157 11.4086 7.02686Z" fill="#333334"/> <path d="M11.1814 12.1958C10.9014 11.9157 10.9014 11.4616 11.1814 11.1815C11.4615 10.9014 11.9156 10.9014 12.1957 11.1815L14.7631 13.7488C15.0432 14.0289 15.0432 14.483 14.7631 14.7631C14.483 15.0432 14.0289 15.0432 13.7488 14.7631L11.1814 12.1958Z" fill="#333334"/>
<path d="M10.2465 2.54175L12.9366 4.69378H8.63251L10.2465 2.54175Z" fill="#333334"/>
<path d="M4.0266 12.2264L1.33656 10.0743L5.64063 10.0743L4.0266 12.2264Z" fill="#333334"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.13541 2.06743C4.1983 2.06743 1.81731 4.44842 1.81731 7.38553C1.81731 7.94828 1.90472 8.49062 2.0667 8.99971H0.81873C0.687214 8.48351 0.61731 7.94268 0.61731 7.38553C0.61731 3.78568 3.53556 0.867432 7.13541 0.867432C9.7761 0.867432 12.05 2.43777 13.0743 4.69555H11.724C10.8002 3.12304 9.09106 2.06743 7.13541 2.06743ZM1.19661 10.0757C2.22093 12.3334 4.4948 13.9036 7.13541 13.9036C10.7353 13.9036 13.6535 10.9854 13.6535 7.38553C13.6535 6.82846 13.5836 6.28771 13.4521 5.77157H12.2042C12.3661 6.28059 12.4535 6.82286 12.4535 7.38553C12.4535 10.3226 10.0725 12.7036 7.13541 12.7036C5.17985 12.7036 3.47081 11.6481 2.54694 10.0757H1.19661Z" fill="#333334"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 761 B

After

Width:  |  Height:  |  Size: 1.2 KiB

7
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java

@ -55,6 +55,7 @@ public class ITReplaceMainDialog extends UIDialog {
private String searchStr; private String searchStr;
private static final int FIRST_ROW = 0; private static final int FIRST_ROW = 0;
public static int selectCount = 0; public static int selectCount = 0;
public static int MAIN_PANEL_WIDTH = 929;
public ITReplaceMainDialog() { public ITReplaceMainDialog() {
super(DesignerContext.getDesignerFrame()); super(DesignerContext.getDesignerFrame());
@ -97,8 +98,8 @@ public class ITReplaceMainDialog extends UIDialog {
int width = jTemplate.getWidth(); int width = jTemplate.getWidth();
Point point = jTemplate.getLocationOnScreen(); Point point = jTemplate.getLocationOnScreen();
setModal(false); setModal(false);
setMaximumSize(new Dimension(jTemplate.getWidth(), jTemplate.getHeight())); setMaximumSize(new Dimension(width, jTemplate.getHeight()));
setMinimumSize(new Dimension(jTemplate.getWidth(), 240)); setMinimumSize(new Dimension(width, 240));
setSize(width, height); setSize(width, height);
setLocation(new Point(point.x, point.y + jTemplate.getHeight() / 2 + jTemplate.getHeight() / 2 - 385)); setLocation(new Point(point.x, point.y + jTemplate.getHeight() / 2 + jTemplate.getHeight() / 2 - 385));
@ -124,7 +125,7 @@ public class ITReplaceMainDialog extends UIDialog {
replaceComboBox.setEnabled(false); replaceComboBox.setEnabled(false);
replaceComboBox.setEditable(true); replaceComboBox.setEditable(true);
northPane.getReplaceButton().setEnabled(false); northPane.getReplaceButton().setEnabled(false);
westPanel.getLeftPanel().setPreferredSize(new Dimension(ITReplaceWestPanel.LEFT_WIDTH, this.getHeight()));
((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).setPlaceholder(Toolkit.i18nText("Fine-Design_Replace_Search_Input")); ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).setPlaceholder(Toolkit.i18nText("Fine-Design_Replace_Search_Input"));
((UITextField) (northPane.getReplaceInputCombobox().getEditor().getEditorComponent())).setPlaceholder(Toolkit.i18nText("Fine-Design_Replace_Input")); ((UITextField) (northPane.getReplaceInputCombobox().getEditor().getEditorComponent())).setPlaceholder(Toolkit.i18nText("Fine-Design_Replace_Input"));
((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).addActionListener(new ActionListener() { ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).addActionListener(new ActionListener() {

152
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java

@ -1,5 +1,6 @@
package com.fr.design.actions.replace.ui; package com.fr.design.actions.replace.ui;
import com.fr.base.svg.IconUtils;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
@ -9,7 +10,9 @@ import com.fr.design.i18n.Toolkit;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.ComboBoxEditor; import javax.swing.ComboBoxEditor;
import javax.swing.Icon;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.ScrollPaneConstants; import javax.swing.ScrollPaneConstants;
@ -34,20 +37,28 @@ public class ITReplaceNorthPanel {
private UIComboBox findCombobox; private UIComboBox findCombobox;
private UIComboBox rangeCombobox; private UIComboBox rangeCombobox;
private JCheckBox matchRadioButton; private JCheckBox matchRadioButton;
private UILabel iconLabel;
private UIComboBox findInputCombobox; private UIComboBox findInputCombobox;
private UIComboBox replaceInputCombobox; private UIComboBox replaceInputCombobox;
private UIScrollPane scrollPane; private UIScrollPane scrollPane;
private UIButton replaceButton; private UIButton replaceButton;
private UIButton searchButton; private UIButton searchButton;
private static double rate = 1.00;
//存储的5次最近输入 //存储的5次最近输入
private int maxItemCount = 5; private int maxItemCount = 5;
private static final int LIMIT_WIDTH = 1250; private static int limit_width = 800;
private static final int HEIGHT = 161; private static final int HEIGHT = 161;
private static final int BUTTON_WIDTH = 60; private static final int BUTTON_WIDTH = 44;
private static final int BUTTON_GAP = 20; private static final int GAP = 20;
private static final int BUTTON_GAP = 10;
private static final int MATCH_WIDTH = 70; private static final int MATCH_WIDTH = 70;
private static final int COMPONENT_HEIGHT = 25;
private static final int FIRST_Y = 15, SECOND_Y = 50, THIRD_Y = 85, FOURTH_Y = 120;
private static final int FIRST_X = 20, SECOND_X = 80;
private static final int LABEL_WIDTH = 60;
private static final Icon CHANGE_ICON = IconUtils.readIcon("/com/fr/design/images/replace/change_normal.svg");
private int findLabelX, findLabelY, findLabelWidth, findLabelHeight; private int findLabelX, findLabelY, findLabelWidth, findLabelHeight;
@ -60,7 +71,8 @@ public class ITReplaceNorthPanel {
private int replaceInputComboBoxX, replaceInputComboBoxY, replaceInputComboBoxWidth, replaceInputComboBoxHeight; private int replaceInputComboBoxX, replaceInputComboBoxY, replaceInputComboBoxWidth, replaceInputComboBoxHeight;
private int replaceButtonX, replaceButtonY, replaceButtonHeight; private int replaceButtonX, replaceButtonY, replaceButtonHeight;
private int searchButtonX, searchButtonY, searchButtonHeight; private int searchButtonX, searchButtonY, searchButtonHeight;
private int iconX, iconY, iconWidth, iconHeight;
private int inputLength;
public static ArrayList<String> findItems = new ArrayList<>(); public static ArrayList<String> findItems = new ArrayList<>();
public static ArrayList<String> findInputItems = new ArrayList<>(); public static ArrayList<String> findInputItems = new ArrayList<>();
@ -81,6 +93,7 @@ public class ITReplaceNorthPanel {
findLabel = new UILabel(Toolkit.i18nText("Fine-Design_Replace_Search_Element")); findLabel = new UILabel(Toolkit.i18nText("Fine-Design_Replace_Search_Element"));
rangeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Replace_Search_Range")); rangeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Replace_Search_Range"));
iconLabel = new UILabel(CHANGE_ICON);
resultLabel = new UILabel(); resultLabel = new UILabel();
String[] rangeItems = new String[]{Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Current")}; String[] rangeItems = new String[]{Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Current")};
@ -109,7 +122,7 @@ public class ITReplaceNorthPanel {
replaceButton = new UIButton(Toolkit.i18nText("Fine-Design_Replace_Button")); replaceButton = new UIButton(Toolkit.i18nText("Fine-Design_Replace_Button"));
searchButton = new UIButton(Toolkit.i18nText("Fine-Design_Search_Button")); searchButton = new UIButton(Toolkit.i18nText("Fine-Design_Search_Button"));
upPanel.setPreferredSize(new Dimension(LIMIT_WIDTH, HEIGHT)); upPanel.setPreferredSize(new Dimension(limit_width, HEIGHT));
scrollPane = new UIScrollPane(upPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane = new UIScrollPane(upPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
upPanel.add(findLabel); upPanel.add(findLabel);
upPanel.add(rangeLabel); upPanel.add(rangeLabel);
@ -121,6 +134,8 @@ public class ITReplaceNorthPanel {
upPanel.add(matchRadioButton); upPanel.add(matchRadioButton);
upPanel.add(replaceButton); upPanel.add(replaceButton);
upPanel.add(searchButton); upPanel.add(searchButton);
upPanel.add(iconLabel);
scrollPane.setBorder(BorderFactory.createEmptyBorder());
} }
/** /**
@ -129,9 +144,8 @@ public class ITReplaceNorthPanel {
* @param width * @param width
*/ */
public void setLimitSize(int width) { public void setLimitSize(int width) {
width = Math.max(LIMIT_WIDTH, width); upPanel.setMaximumSize(new Dimension(limit_width, 161));
upPanel.setMaximumSize(new Dimension(width, 161)); upPanel.setPreferredSize(new Dimension(limit_width, 161));
upPanel.setPreferredSize(new Dimension(width, 161));
} }
@ -144,21 +158,22 @@ public class ITReplaceNorthPanel {
*/ */
public void fitScreen(int x, int y, int templateWidth) { public void fitScreen(int x, int y, int templateWidth) {
templateWidth = Math.max(templateWidth, LIMIT_WIDTH); templateWidth = Math.max(ITReplaceMainDialog.MAIN_PANEL_WIDTH, templateWidth);
templateWidth = templateWidth - ITReplaceWestPanel.LEFT_WIDTH;
setFindLabelBounds(x, y, templateWidth); inputLength = (templateWidth - GAP * 5) / 2;
setRangeLabelBounds(x, y, templateWidth);
setResultLabelBounds(x, y, templateWidth);
setFindComboboxBounds(x, y, templateWidth);
setRangeComboboxBounds(x, y, templateWidth);
setFindInputComboboxBounds(x, y, templateWidth);
setReplaceInputComboboxBounds(x, y, templateWidth);
setUIRadioButtonBounds(x, y, templateWidth);
setReplaceButtonBounds(x, y, templateWidth);
setSearchButtonBounds(x, y, templateWidth);
setFindLabelBounds();
setResultLabelBounds(templateWidth);
setFindComboboxBounds();
setFindInputComboboxBounds();
setReplaceInputComboboxBounds(templateWidth);
setRangeLabelBounds();
setRangeComboboxBounds();
setUIRadioButtonBounds();
setReplaceButtonBounds();
setSearchButtonBounds();
setIconLabelBounds();
} }
@ -214,87 +229,94 @@ public class ITReplaceNorthPanel {
this.scrollPane = scrollPane; this.scrollPane = scrollPane;
} }
private void setIconLabelBounds() {
iconX = inputLength + GAP;
iconY = SECOND_Y;
iconWidth = GAP;
iconHeight = COMPONENT_HEIGHT;
iconLabel.setBounds(iconX, iconY, iconWidth, iconHeight);
}
private void setSearchButtonBounds(int x, int y, int templateWidth) { private void setSearchButtonBounds() {
searchButtonHeight = 25; searchButtonHeight = COMPONENT_HEIGHT;
searchButtonY = resultLabelY; searchButtonY = FOURTH_Y;
searchButtonX = replaceInputComboBoxX + replaceInputComboBoxWidth - BUTTON_WIDTH * 2 - BUTTON_GAP; searchButtonX = replaceInputComboBoxX + replaceInputComboBoxWidth - BUTTON_WIDTH * 2 - BUTTON_GAP;
searchButton.setBounds(searchButtonX, searchButtonY, BUTTON_WIDTH, searchButtonHeight); searchButton.setBounds(searchButtonX, searchButtonY, BUTTON_WIDTH, searchButtonHeight);
} }
private void setReplaceButtonBounds(int x, int y, int templateWidth) { private void setReplaceButtonBounds() {
replaceButtonHeight = 25; replaceButtonHeight = COMPONENT_HEIGHT;
replaceButtonY = resultLabelY; replaceButtonY = FOURTH_Y;
replaceButtonX = replaceInputComboBoxX + replaceInputComboBoxWidth - BUTTON_WIDTH; replaceButtonX = replaceInputComboBoxX + replaceInputComboBoxWidth - BUTTON_WIDTH;
replaceButton.setBounds(replaceButtonX, replaceButtonY, BUTTON_WIDTH, replaceButtonHeight); replaceButton.setBounds(replaceButtonX, replaceButtonY, BUTTON_WIDTH, replaceButtonHeight);
} }
private void setReplaceInputComboboxBounds(int x, int y, int templateWidth) { private void setReplaceInputComboboxBounds(int templateWidth) {
replaceInputComboBoxX = x + templateWidth / 2 + templateWidth / 60; replaceInputComboBoxX = templateWidth - inputLength - GAP * 2;
replaceInputComboBoxY = y + 55; replaceInputComboBoxY = SECOND_Y;
replaceInputComboBoxWidth = templateWidth / 3 + templateWidth / 30 * 2; replaceInputComboBoxWidth = inputLength;
replaceInputComboBoxHeight = 25; replaceInputComboBoxHeight = COMPONENT_HEIGHT;
replaceInputCombobox.setBounds(replaceInputComboBoxX, replaceInputComboBoxY, replaceInputComboBoxWidth, replaceInputComboBoxHeight); replaceInputCombobox.setBounds(replaceInputComboBoxX, replaceInputComboBoxY, replaceInputComboBoxWidth, replaceInputComboBoxHeight);
} }
private void setFindInputComboboxBounds(int x, int y, int templateWidth) { private void setFindInputComboboxBounds() {
findInputComboBoxX = x + templateWidth / 60; findInputComboBoxX = FIRST_X;
findInputComboBoxY = y + 55; findInputComboBoxY = SECOND_Y;
findInputComboBoxWidth = templateWidth / 3 + templateWidth / 30 * 2; findInputComboBoxWidth = inputLength - GAP;
findInputComboBoxHeight = 25; findInputComboBoxHeight = COMPONENT_HEIGHT;
findInputCombobox.setBounds(findInputComboBoxX, findInputComboBoxY, findInputComboBoxWidth, findInputComboBoxHeight); findInputCombobox.setBounds(findInputComboBoxX, findInputComboBoxY, findInputComboBoxWidth, findInputComboBoxHeight);
} }
private void setUIRadioButtonBounds(int x, int y, int templateWidth) { private void setUIRadioButtonBounds() {
matchX = x + templateWidth / 60; matchX = FIRST_X;
matchY = y + 90; matchY = THIRD_Y;
matchWidth = MATCH_WIDTH; matchWidth = MATCH_WIDTH;
matchHeight = 25; matchHeight = COMPONENT_HEIGHT;
matchRadioButton.setBounds(matchX, matchY, matchWidth, matchHeight); matchRadioButton.setBounds(matchX, matchY, matchWidth, matchHeight);
} }
private void setRangeComboboxBounds(int x, int y, int templateWidth) { private void setRangeComboboxBounds() {
rangeComboBoxX = x + templateWidth / 2 + templateWidth / 15; rangeComboBoxX = rangeLabelX + rangeLabelWidth;
rangeComboBoxY = y + 20; rangeComboBoxY = FIRST_Y;
rangeComboBoxWidth = templateWidth / 3 + templateWidth / 60; rangeComboBoxWidth = inputLength - 3 * GAP;
rangeComboBoxHeight = 25; rangeComboBoxHeight = COMPONENT_HEIGHT;
rangeCombobox.setBounds(rangeComboBoxX, rangeComboBoxY, rangeComboBoxWidth, rangeComboBoxHeight); rangeCombobox.setBounds(rangeComboBoxX, rangeComboBoxY, rangeComboBoxWidth, rangeComboBoxHeight);
} }
private void setFindComboboxBounds(int x, int y, int templateWidth) { private void setFindComboboxBounds() {
findComboBoxX = x + templateWidth / 30 * 2; findComboBoxX = SECOND_X;
findComboBoxY = y + 20; findComboBoxY = FIRST_Y;
findComboBoxWidth = templateWidth / 3 + templateWidth / 60; findComboBoxWidth = inputLength - 4 * GAP;
findComboBoxHeight = 25; findComboBoxHeight = COMPONENT_HEIGHT;
findCombobox.setBounds(findComboBoxX, findComboBoxY, findComboBoxWidth, findComboBoxHeight); findCombobox.setBounds(findComboBoxX, findComboBoxY, findComboBoxWidth, findComboBoxHeight);
} }
private void setResultLabelBounds(int x, int y, int templateWidth) { private void setResultLabelBounds(int templateWidth) {
resultLabelX = findLabelX; resultLabelX = FIRST_X;
resultLabelY = y + 125; resultLabelY = FOURTH_Y;
resultLabelWidth = templateWidth; resultLabelWidth = templateWidth;
resultLabelHeight = 25; resultLabelHeight = COMPONENT_HEIGHT;
resultLabel.setBounds(resultLabelX, resultLabelY, resultLabelWidth, resultLabelHeight); resultLabel.setBounds(resultLabelX, resultLabelY, resultLabelWidth, resultLabelHeight);
} }
private void setRangeLabelBounds(int x, int y, int templateWidth) { private void setRangeLabelBounds() {
rangeLabelX = x + templateWidth / 2 + templateWidth / 60; rangeLabelX = replaceInputComboBoxX;
rangeLabelY = y + 20; rangeLabelY = FIRST_Y;
rangeLabelWidth = findLabelWidth; rangeLabelWidth = LABEL_WIDTH;
rangeLabelHeight = 25; rangeLabelHeight = COMPONENT_HEIGHT;
rangeLabel.setBounds(rangeLabelX, rangeLabelY, rangeLabelWidth, rangeLabelHeight); rangeLabel.setBounds(rangeLabelX, rangeLabelY, rangeLabelWidth, rangeLabelHeight);
} }
private void setFindLabelBounds(int x, int y, int templateWidth) { private void setFindLabelBounds() {
findLabelX = x + templateWidth / 60; findLabelX = FIRST_X;
findLabelY = y + 20; findLabelY = FIRST_Y;
findLabelWidth = templateWidth / 20; findLabelWidth = LABEL_WIDTH;
findLabelHeight = 25; findLabelHeight = COMPONENT_HEIGHT;
findLabel.setBounds(findLabelX, findLabelY, findLabelWidth, findLabelHeight); findLabel.setBounds(findLabelX, findLabelY, findLabelWidth, findLabelHeight);
} }

7
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java

@ -1,5 +1,6 @@
package com.fr.design.actions.replace.ui; package com.fr.design.actions.replace.ui;
import javax.swing.BorderFactory;
import javax.swing.RowSorter; import javax.swing.RowSorter;
import javax.swing.table.TableRowSorter; import javax.swing.table.TableRowSorter;
import java.awt.Color; import java.awt.Color;
@ -18,17 +19,21 @@ public class ITReplaceSouthPanel {
public static final int CHECKBOX_INDEX = 0; public static final int CHECKBOX_INDEX = 0;
//ITContent在表格的列索引 //ITContent在表格的列索引
public static final int CONTENT_INDEX = 6; public static final int CONTENT_INDEX = 6;
public static final int TABLE_GAP = 20;
public ITReplaceSouthPanel() { public ITReplaceSouthPanel() {
itTableEditor = new ITTableEditor(); itTableEditor = new ITTableEditor();
tableEditorPane = new ITTableEditorPane<>(itTableEditor); tableEditorPane = new ITTableEditorPane<>(itTableEditor);
RowSorter<ITTableEditor> sorter = new TableRowSorter<ITTableEditor>(itTableEditor){ //左右两边间距20
tableEditorPane.setBorder(BorderFactory.createEmptyBorder(0, TABLE_GAP, 0, TABLE_GAP));
RowSorter<ITTableEditor> sorter = new TableRowSorter<ITTableEditor>(itTableEditor) {
@Override @Override
public boolean isSortable(int column) { public boolean isSortable(int column) {
return column != CHECKBOX_INDEX || column != CONTENT_INDEX; return column != CHECKBOX_INDEX || column != CONTENT_INDEX;
} }
}; };
tableEditorPane.getEditTable().setRowSorter(sorter); tableEditorPane.getEditTable().setRowSorter(sorter);
tableEditorPane.getEditTable().setBorder(BorderFactory.createEmptyBorder());
tableEditorPane.getEditTable().setSelectionBackground(new Color(217, 235, 254)); tableEditorPane.getEditTable().setSelectionBackground(new Color(217, 235, 254));
tableEditorPane.getEditTable().setRowHeight(tableEditorPane.getEditTable().getRowHeight() / 2 + tableEditorPane.getEditTable().getRowHeight()); tableEditorPane.getEditTable().setRowHeight(tableEditorPane.getEditTable().getRowHeight() / 2 + tableEditorPane.getEditTable().getRowHeight());
tableEditorPane.makeFace(tableEditorPane.getEditTable()); tableEditorPane.makeFace(tableEditorPane.getEditTable());

22
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceWestPanel.java

@ -12,9 +12,12 @@ import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.Color; import java.awt.Color;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.GridLayout; import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
/** /**
@ -29,7 +32,9 @@ public class ITReplaceWestPanel {
private UILabel iconLabel; private UILabel iconLabel;
private static final Icon HELP_ICON = IconUtils.readIcon("com/fr/design/images/buttonicon/replace_help.svg"); private static final Icon HELP_ICON = IconUtils.readIcon("com/fr/design/images/buttonicon/replace_help.svg");
private static final String HELP_URL = CloudCenter.getInstance().acquireUrlByKind("design.replace.help", "https://help.fanruan.com/finereport/doc-view-4954.html?source=3"); private static final String HELP_URL = CloudCenter.getInstance().acquireUrlByKind("design.replace.help", "https://help.fanruan.com/finereport/doc-view-4954.html?source=3");
private static final int FILL_COUNT = 13; private static final int FILL_COUNT = 12;
public static final int LEFT_WIDTH = 100;
public static final String CONTENT_TEXT = "<html><font color = 'rgb(255,255,255)'>" + Toolkit.i18nText("Fine-Design_Basic_Templates_Content") + "</font></html>";
public ITReplaceWestPanel() { public ITReplaceWestPanel() {
@ -37,6 +42,18 @@ public class ITReplaceWestPanel {
iconLabel = new UILabel("<html><u><font color = 'rgb(61,153,249)'>" + Toolkit.i18nText("Fine-Design_Report_Community_Help") + "</font></u></html>"); iconLabel = new UILabel("<html><u><font color = 'rgb(61,153,249)'>" + Toolkit.i18nText("Fine-Design_Report_Community_Help") + "</font></u></html>");
UIToggleButton contentButton = new UIToggleButton(Toolkit.i18nText("Fine-Design_Basic_Templates_Content")); UIToggleButton contentButton = new UIToggleButton(Toolkit.i18nText("Fine-Design_Basic_Templates_Content"));
contentButton.setText(CONTENT_TEXT);
contentButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (!contentButton.isSelected()) {
contentButton.setText(CONTENT_TEXT);
} else {
contentButton.setText(Toolkit.i18nText("Fine-Design_Basic_Templates_Content"));
}
}
});
leftPanel.setBackground(Color.WHITE);
contentButton.setSelected(true); contentButton.setSelected(true);
contentButton.setBorderPainted(false); contentButton.setBorderPainted(false);
leftPanel.add(contentButton); leftPanel.add(contentButton);
@ -47,8 +64,8 @@ public class ITReplaceWestPanel {
} }
//添加帮助文档按钮及超链 //添加帮助文档按钮及超链
iconLabel.setIcon(HELP_ICON);
iconLabel.setToolTipText(Toolkit.i18nText("Fine-Design_Replace_Tooltip")); iconLabel.setToolTipText(Toolkit.i18nText("Fine-Design_Replace_Tooltip"));
iconLabel.setHorizontalAlignment(SwingConstants.CENTER);
//设置游标 //设置游标
iconLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); iconLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
iconLabel.addMouseListener(new MouseClickListener() { iconLabel.addMouseListener(new MouseClickListener() {
@ -58,6 +75,7 @@ public class ITReplaceWestPanel {
} }
}); });
leftPanel.add(iconLabel); leftPanel.add(iconLabel);
leftPanel.add(new UILabel(StringUtils.EMPTY));
} }
public JPanel getLeftPanel() { public JPanel getLeftPanel() {

Loading…
Cancel
Save