|
|
@ -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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|