|
|
|
@ -1,8 +1,8 @@
|
|
|
|
|
package com.fr.design.actions.replace.ui; |
|
|
|
|
|
|
|
|
|
import com.fr.design.file.HistoryTemplateListCache; |
|
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
|
import com.fr.design.gui.icontainer.UIScrollPane; |
|
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
@ -12,6 +12,7 @@ import com.fr.stable.StringUtils;
|
|
|
|
|
import javax.swing.ComboBoxEditor; |
|
|
|
|
import javax.swing.JCheckBox; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import javax.swing.ScrollPaneConstants; |
|
|
|
|
import java.awt.Dimension; |
|
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
|
import java.awt.event.ActionListener; |
|
|
|
@ -36,12 +37,16 @@ public class ITReplaceNorthPanel {
|
|
|
|
|
|
|
|
|
|
private UIComboBox findInputCombobox; |
|
|
|
|
private UIComboBox replaceInputCombobox; |
|
|
|
|
|
|
|
|
|
private UIScrollPane scrollPane; |
|
|
|
|
private UIButton replaceButton; |
|
|
|
|
private UIButton searchButton; |
|
|
|
|
|
|
|
|
|
//存储的5次最近输入
|
|
|
|
|
private int maxItemCount = 5; |
|
|
|
|
private static final int LIMIT_WIDTH = 1250; |
|
|
|
|
private static final int HEIGHT = 161; |
|
|
|
|
private static final int BUTTON_WIDTH = 60; |
|
|
|
|
private static final int BUTTON_GAP = 20; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int findLabelX, findLabelY, findLabelWidth, findLabelHeight; |
|
|
|
@ -52,9 +57,9 @@ public class ITReplaceNorthPanel {
|
|
|
|
|
private int resultLabelX, resultLabelY, resultLabelWidth, resultLabelHeight; |
|
|
|
|
private int findInputComboBoxX, findInputComboBoxY, findInputComboBoxWidth, findInputComboBoxHeight; |
|
|
|
|
private int replaceInputComboBoxX, replaceInputComboBoxY, replaceInputComboBoxWidth, replaceInputComboBoxHeight; |
|
|
|
|
private int replaceButtonX, replaceButtonY, replaceButtonWidth, replaceButtonHeight; |
|
|
|
|
private int searchButtonX, searchButtonY, searchButtonWidth, searchButtonHeight; |
|
|
|
|
private int buttonGap; |
|
|
|
|
private int replaceButtonX, replaceButtonY, replaceButtonHeight; |
|
|
|
|
private int searchButtonX, searchButtonY, searchButtonHeight; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static ArrayList<String> findItems = new ArrayList<>(); |
|
|
|
|
public static ArrayList<String> findInputItems = new ArrayList<>(); |
|
|
|
@ -103,9 +108,8 @@ public class ITReplaceNorthPanel {
|
|
|
|
|
|
|
|
|
|
replaceButton = new UIButton(Toolkit.i18nText("Fine-Design_Replace_Button")); |
|
|
|
|
searchButton = new UIButton(Toolkit.i18nText("Fine-Design_Search_Button")); |
|
|
|
|
|
|
|
|
|
setLimitSize(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getWidth()); |
|
|
|
|
|
|
|
|
|
upPanel.setPreferredSize(new Dimension(LIMIT_WIDTH, HEIGHT)); |
|
|
|
|
scrollPane = new UIScrollPane(upPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); |
|
|
|
|
upPanel.add(findLabel); |
|
|
|
|
upPanel.add(rangeLabel); |
|
|
|
|
upPanel.add(resultLabel); |
|
|
|
@ -124,8 +128,9 @@ public class ITReplaceNorthPanel {
|
|
|
|
|
* @param width |
|
|
|
|
*/ |
|
|
|
|
public void setLimitSize(int width) { |
|
|
|
|
width = Math.max(LIMIT_WIDTH, width); |
|
|
|
|
upPanel.setMaximumSize(new Dimension(width, 161)); |
|
|
|
|
upPanel.setMinimumSize(new Dimension(width, 161)); |
|
|
|
|
//upPanel.setMinimumSize(new Dimension(width, 161));
|
|
|
|
|
upPanel.setPreferredSize(new Dimension(width, 161)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -139,6 +144,8 @@ public class ITReplaceNorthPanel {
|
|
|
|
|
*/ |
|
|
|
|
public void fitScreen(int x, int y, int templateWidth) { |
|
|
|
|
|
|
|
|
|
templateWidth = Math.max(templateWidth, LIMIT_WIDTH); |
|
|
|
|
|
|
|
|
|
setFindLabelBounds(x, y, templateWidth); |
|
|
|
|
setRangeLabelBounds(x, y, templateWidth); |
|
|
|
|
setResultLabelBounds(x, y, templateWidth); |
|
|
|
@ -152,6 +159,7 @@ public class ITReplaceNorthPanel {
|
|
|
|
|
setReplaceButtonBounds(x, y, templateWidth); |
|
|
|
|
setSearchButtonBounds(x, y, templateWidth); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -198,27 +206,31 @@ public class ITReplaceNorthPanel {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void setSearchButtonBounds(int x, int y, int templateWidth) { |
|
|
|
|
buttonGap = templateWidth / 90; |
|
|
|
|
searchButtonWidth = templateWidth / 30; |
|
|
|
|
public UIScrollPane getScrollPane() { |
|
|
|
|
return scrollPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setScrollPane(UIScrollPane scrollPane) { |
|
|
|
|
this.scrollPane = scrollPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void setSearchButtonBounds(int x, int y, int templateWidth) { |
|
|
|
|
searchButtonHeight = 25; |
|
|
|
|
searchButtonY = resultLabelY; |
|
|
|
|
searchButtonX = replaceInputComboBoxX + replaceInputComboBoxWidth - replaceButtonWidth * 2 - buttonGap; |
|
|
|
|
searchButton.setBounds(searchButtonX, searchButtonY, searchButtonWidth, searchButtonHeight); |
|
|
|
|
searchButtonX = replaceInputComboBoxX + replaceInputComboBoxWidth - BUTTON_WIDTH * 2 - BUTTON_GAP; |
|
|
|
|
searchButton.setBounds(searchButtonX, searchButtonY, BUTTON_WIDTH, searchButtonHeight); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setReplaceButtonBounds(int x, int y, int templateWidth) { |
|
|
|
|
buttonGap = templateWidth / 90; |
|
|
|
|
replaceButtonWidth = templateWidth / 30; |
|
|
|
|
replaceButtonHeight = 25; |
|
|
|
|
replaceButtonY = resultLabelY; |
|
|
|
|
replaceButtonX = replaceInputComboBoxX + replaceInputComboBoxWidth - replaceButtonWidth; |
|
|
|
|
replaceButton.setBounds(replaceButtonX, replaceButtonY, replaceButtonWidth, replaceButtonHeight); |
|
|
|
|
replaceButtonX = replaceInputComboBoxX + replaceInputComboBoxWidth - BUTTON_WIDTH; |
|
|
|
|
replaceButton.setBounds(replaceButtonX, replaceButtonY, BUTTON_WIDTH, replaceButtonHeight); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setReplaceInputComboboxBounds(int x, int y, int templateWidth) { |
|
|
|
|
replaceInputComboBoxX = x + templateWidth / 2 + templateWidth / 30; |
|
|
|
|
replaceInputComboBoxX = x + templateWidth / 2 + templateWidth / 60; |
|
|
|
|
replaceInputComboBoxY = y + 55; |
|
|
|
|
replaceInputComboBoxWidth = templateWidth / 3 + templateWidth / 30 * 2; |
|
|
|
|
replaceInputComboBoxHeight = 25; |
|
|
|
@ -243,7 +255,7 @@ public class ITReplaceNorthPanel {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void setRangeComboboxBounds(int x, int y, int templateWidth) { |
|
|
|
|
rangeComboBoxX = x + templateWidth / 2 + templateWidth / 15 + templateWidth / 60; |
|
|
|
|
rangeComboBoxX = x + templateWidth / 2 + templateWidth / 15; |
|
|
|
|
rangeComboBoxY = y + 20; |
|
|
|
|
rangeComboBoxWidth = templateWidth / 3 + templateWidth / 60; |
|
|
|
|
rangeComboBoxHeight = 25; |
|
|
|
@ -270,7 +282,7 @@ public class ITReplaceNorthPanel {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setRangeLabelBounds(int x, int y, int templateWidth) { |
|
|
|
|
rangeLabelX = x + templateWidth / 2 + templateWidth / 30; |
|
|
|
|
rangeLabelX = x + templateWidth / 2 + templateWidth / 60; |
|
|
|
|
rangeLabelY = y + 20; |
|
|
|
|
rangeLabelWidth = findLabelWidth; |
|
|
|
|
rangeLabelHeight = 25; |
|
|
|
|