Browse Source

REPORT-53175【10.0.18】组件背景分离为标题/背景/边框

子功能: 组件样式支持图片边框

首次打开边框图片选择器的默认路径为assets/border_images,
后续打开路径为上次位置
feature/10.0
Starryi 3 years ago
parent
commit
56b32280f3
  1. 29
      designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java

29
designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java

@ -5,6 +5,7 @@ import com.fr.base.Style;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.base.background.ImageBackground; import com.fr.base.background.ImageBackground;
import com.fr.base.background.ImageFileBackground; import com.fr.base.background.ImageFileBackground;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
@ -20,7 +21,6 @@ import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itooltip.UIToolTip;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
@ -32,7 +32,10 @@ import com.fr.general.Background;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.GraphDrawHelper; import com.fr.stable.GraphDrawHelper;
import com.fr.stable.ProjectLibrary;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
@ -46,6 +49,7 @@ import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener; import java.awt.event.MouseMotionListener;
import java.awt.geom.RoundRectangle2D; import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
@ -174,6 +178,20 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver {
} }
} }
private void initImageFileChooserDirectory() {
ServerPreferenceConfig config = ServerPreferenceConfig.getInstance();
String lastUsedBorderImagesDirPath = config.getLastUsedBorderImagesDir();
File lastUsedBorderImagesDir = StringUtils.isNotEmpty(lastUsedBorderImagesDirPath) ? new File(lastUsedBorderImagesDirPath) : null;
File inbuiltBorderImagesDir = new File(StableUtils.pathJoin(ProjectLibrary.getInstance().getLibHome(), ProjectConstants.ASSETS_NAME, "border_images"));
if (lastUsedBorderImagesDir!= null && lastUsedBorderImagesDir.exists()) {
imageFileChooser.setCurrentDirectory(lastUsedBorderImagesDir);
} else if (inbuiltBorderImagesDir.exists()) {
imageFileChooser.setCurrentDirectory(inbuiltBorderImagesDir);
}
}
protected void initNinePointTweakPaneIfNotExist() { protected void initNinePointTweakPaneIfNotExist() {
if (tweakPane == null) { if (tweakPane == null) {
tweakPane = new NinePointImageTweakDialogPane(); tweakPane = new NinePointImageTweakDialogPane();
@ -210,8 +228,15 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
initImageFileChooserIfNotExist(); initImageFileChooserIfNotExist();
initImageFileChooserDirectory();
int returnVal = imageFileChooser.showOpenDialog(DesignerContext.getDesignerFrame()); int returnVal = imageFileChooser.showOpenDialog(DesignerContext.getDesignerFrame());
if (returnVal == JFileChooser.APPROVE_OPTION) {
ServerPreferenceConfig config = ServerPreferenceConfig.getInstance();
File selectedDirectory = imageFileChooser.getSelectedFile().getParentFile();
config.setLastUsedBorderImagesDir(selectedDirectory.getPath());
}
ImgChooseWrapper.getInstance(imagePreviewPane, imageFileChooser, DEFAULT_IMAGE_LAYOUT_STYLE, new ChangeListener() { ImgChooseWrapper.getInstance(imagePreviewPane, imageFileChooser, DEFAULT_IMAGE_LAYOUT_STYLE, new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {

Loading…
Cancel
Save