forked from fanruan/finekit
lucian
5 years ago
12 changed files with 241 additions and 56 deletions
@ -1,4 +1,4 @@ |
|||||||
package com.fanruan.api.conf.xml; |
package com.fanruan.api.conf.impl.xml; |
||||||
|
|
||||||
import java.util.Collection; |
import java.util.Collection; |
||||||
|
|
@ -1,4 +1,4 @@ |
|||||||
package com.fanruan.api.conf.xml; |
package com.fanruan.api.conf.impl.xml; |
||||||
|
|
||||||
import com.fr.stable.xml.XMLable; |
import com.fr.stable.xml.XMLable; |
||||||
|
|
@ -1,17 +0,0 @@ |
|||||||
package com.fanruan.api.design.mainframe; |
|
||||||
|
|
||||||
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; |
|
||||||
import com.fr.design.mainframe.HyperlinkGroupPaneActionImpl; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author Lucian.Chen |
|
||||||
* @version 10.0 |
|
||||||
* Created by Lucian.Chen on 2020/3/23 |
|
||||||
*/ |
|
||||||
public class HyperlinkGroupPaneAction { |
|
||||||
public static HyperlinkGroupPaneActionProvider getInstance() { |
|
||||||
|
|
||||||
return HyperlinkGroupPaneActionImpl.getInstance(); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,15 +0,0 @@ |
|||||||
package com.fanruan.api.design.ui.component.table.model; |
|
||||||
|
|
||||||
import com.fr.design.DesignModelAdapter; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author Lucian.Chen |
|
||||||
* @version 10.0 |
|
||||||
* Created by Lucian.Chen on 2020/3/27 |
|
||||||
*/ |
|
||||||
public class DesignModelAdapterKit { |
|
||||||
|
|
||||||
public static DesignModelAdapter<?, ?> getCurrentModelAdapter() { |
|
||||||
return DesignModelAdapter.getCurrentModelAdapter(); |
|
||||||
} |
|
||||||
} |
|
@ -1,18 +1,198 @@ |
|||||||
package com.fanruan.api.design.work; |
package com.fanruan.api.design.work; |
||||||
|
|
||||||
|
import com.fanruan.api.design.ui.component.UIButton; |
||||||
|
import com.fanruan.api.design.ui.component.UIRadioButton; |
||||||
|
import com.fanruan.api.design.util.GUICoreKit; |
||||||
import com.fanruan.api.report.cell.CellImage; |
import com.fanruan.api.report.cell.CellImage; |
||||||
|
import com.fr.base.Style; |
||||||
|
import com.fr.design.dialog.BasicPane; |
||||||
|
import com.fr.design.gui.frpane.ImgChooseWrapper; |
||||||
|
import com.fr.design.style.background.image.ImageFileChooser; |
||||||
|
import com.fr.design.style.background.image.ImagePreviewPane; |
||||||
|
import com.fr.report.cell.Elem; |
||||||
|
import com.fr.report.cell.painter.CellImagePainter; |
||||||
|
import com.fr.stable.Constants; |
||||||
|
|
||||||
|
import javax.swing.BorderFactory; |
||||||
|
import javax.swing.ButtonGroup; |
||||||
|
import javax.swing.JFileChooser; |
||||||
|
import javax.swing.JPanel; |
||||||
|
import javax.swing.JScrollPane; |
||||||
|
import java.awt.BorderLayout; |
||||||
|
import java.awt.GridLayout; |
||||||
|
import java.awt.Image; |
||||||
|
import java.awt.event.ActionEvent; |
||||||
|
import java.awt.event.ActionListener; |
||||||
|
import java.io.File; |
||||||
|
|
||||||
/** |
/** |
||||||
* @author Lucian.Chen |
* 这个类主要用于插入图片时的设置 |
||||||
* @version 10.0 |
|
||||||
* Created by Lucian.Chen on 2020/3/23 |
|
||||||
*/ |
*/ |
||||||
public class SelectImagePane extends com.fr.design.report.SelectImagePane { |
public class SelectImagePane extends BasicPane { |
||||||
|
private ImagePreviewPane previewPane = null; |
||||||
|
|
||||||
|
private ImageFileChooser imageFileChooser = null; |
||||||
|
private UIRadioButton defaultRadioButton = null; |
||||||
|
private UIRadioButton tiledRadioButton = null; |
||||||
|
private UIRadioButton extendRadioButton = null; |
||||||
|
private UIRadioButton adjustRadioButton = null; |
||||||
|
|
||||||
|
private Style imageStyle = null; |
||||||
|
|
||||||
|
private File imageFile; |
||||||
|
|
||||||
public SelectImagePane() { |
public SelectImagePane() { |
||||||
super(); |
this.setLayout(GUICoreKit.createBorderLayout()); |
||||||
|
|
||||||
|
// preview pane
|
||||||
|
JPanel previewContainerPane = GUICoreKit.createBorderLayoutPane(); |
||||||
|
this.add(previewContainerPane, BorderLayout.CENTER); |
||||||
|
|
||||||
|
JPanel previewOwnerPane = GUICoreKit.createBorderLayoutPane(); |
||||||
|
previewContainerPane.add(previewOwnerPane, BorderLayout.CENTER); |
||||||
|
|
||||||
|
previewOwnerPane.setBorder(GUICoreKit.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"), null)); |
||||||
|
|
||||||
|
previewPane = new ImagePreviewPane(); |
||||||
|
previewOwnerPane.add(new JScrollPane(previewPane)); |
||||||
|
|
||||||
|
JPanel selectFilePane = GUICoreKit.createBorderLayoutPane(); |
||||||
|
previewContainerPane.add(selectFilePane, BorderLayout.EAST); |
||||||
|
selectFilePane.setBorder(BorderFactory |
||||||
|
.createEmptyBorder(8, 2, 4, 0)); |
||||||
|
|
||||||
|
UIButton selectPictureButton = new UIButton( |
||||||
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Image_Select_Picture")); |
||||||
|
selectFilePane.add(selectPictureButton, BorderLayout.NORTH); |
||||||
|
selectPictureButton.setMnemonic('S'); |
||||||
|
selectPictureButton.addActionListener(selectPictureActionListener); |
||||||
|
|
||||||
|
JPanel layoutPane = GUICoreKit.createMediumHGapHighTopFlowInnerContainerPane(); |
||||||
|
selectFilePane.add(layoutPane, BorderLayout.CENTER); |
||||||
|
|
||||||
|
//布局
|
||||||
|
defaultRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default")); |
||||||
|
tiledRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Image_Titled")); |
||||||
|
extendRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Image_Extend")); |
||||||
|
adjustRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Image_Adjust")); |
||||||
|
|
||||||
|
defaultRadioButton.addActionListener(layoutActionListener); |
||||||
|
tiledRadioButton.addActionListener(layoutActionListener); |
||||||
|
extendRadioButton.addActionListener(layoutActionListener); |
||||||
|
adjustRadioButton.addActionListener(layoutActionListener); |
||||||
|
|
||||||
|
JPanel jp = new JPanel(new GridLayout(4, 1, 15, 15)); |
||||||
|
jp.add(defaultRadioButton); |
||||||
|
jp.add(tiledRadioButton); |
||||||
|
jp.add(extendRadioButton); |
||||||
|
jp.add(adjustRadioButton); |
||||||
|
layoutPane.add(jp); |
||||||
|
|
||||||
|
ButtonGroup layoutBG = new ButtonGroup(); |
||||||
|
layoutBG.add(defaultRadioButton); |
||||||
|
layoutBG.add(tiledRadioButton); |
||||||
|
layoutBG.add(extendRadioButton); |
||||||
|
layoutBG.add(adjustRadioButton); |
||||||
|
|
||||||
|
defaultRadioButton.setSelected(true); |
||||||
|
|
||||||
|
// init image file chooser.
|
||||||
|
imageFileChooser = new ImageFileChooser(); |
||||||
|
imageFileChooser.setMultiSelectionEnabled(false); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Select picture. |
||||||
|
*/ |
||||||
|
ActionListener selectPictureActionListener = new ActionListener() { |
||||||
|
|
||||||
|
@Override |
||||||
|
public void actionPerformed(ActionEvent evt) { |
||||||
|
int returnVal = imageFileChooser |
||||||
|
.showOpenDialog(SelectImagePane.this); |
||||||
|
if (returnVal != JFileChooser.CANCEL_OPTION) { |
||||||
|
File selectedFile = imageFileChooser.getSelectedFile(); |
||||||
|
imageFile = selectedFile; |
||||||
|
ImgChooseWrapper.getInstance(previewPane, imageFileChooser, imageStyle, null).dealWithImageFile(returnVal); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
// 调整图片样式,只有水平和垂直对齐以及拉伸。相对于背景,平铺不予考虑。
|
||||||
|
private void changeImageStyle() { |
||||||
|
previewPane.setImageStyle(this.imageStyle); |
||||||
|
previewPane.repaint(); |
||||||
|
} |
||||||
|
|
||||||
|
private void setImageStyle() { |
||||||
|
if (tiledRadioButton.isSelected()) { |
||||||
|
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_TILED); |
||||||
|
} else if (adjustRadioButton.isSelected()) { |
||||||
|
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_ADJUST); |
||||||
|
} else if (extendRadioButton.isSelected()) { |
||||||
|
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_EXTEND); |
||||||
|
} else { |
||||||
|
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
ActionListener layoutActionListener = new ActionListener() { |
||||||
|
|
||||||
|
@Override |
||||||
|
public void actionPerformed(ActionEvent evt) { |
||||||
|
setImageStyle(); |
||||||
|
changeImageStyle(); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String title4PopupWindow() { |
||||||
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Image"); |
||||||
|
} |
||||||
|
|
||||||
|
public void populate(Elem cell) { |
||||||
|
Style style = null; |
||||||
|
if (cell != null) { |
||||||
|
Object value = cell.getValue(); |
||||||
|
if (value instanceof Image) { |
||||||
|
setImage((Image) value); |
||||||
|
} else if (value instanceof CellImagePainter) { |
||||||
|
setImage(((CellImagePainter) value).getImage()); |
||||||
|
} |
||||||
|
|
||||||
|
style = cell.getStyle(); |
||||||
|
} |
||||||
|
if (style == null) { |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
if (style.getImageLayout() == Constants.IMAGE_TILED) { |
||||||
|
tiledRadioButton.setSelected(true); |
||||||
|
} else if (style.getImageLayout() == Constants.IMAGE_EXTEND) { |
||||||
|
extendRadioButton.setSelected(true); |
||||||
|
} else if (style.getImageLayout() == Constants.IMAGE_ADJUST) { |
||||||
|
adjustRadioButton.setSelected(true); |
||||||
|
} else { |
||||||
|
style.deriveImageLayout(Constants.IMAGE_CENTER); |
||||||
|
defaultRadioButton.setSelected(true); |
||||||
|
} |
||||||
|
this.imageStyle = style; |
||||||
|
changeImageStyle(); |
||||||
|
} |
||||||
|
|
||||||
|
public void setImage(Image image) { |
||||||
|
previewPane.setImage(image); |
||||||
} |
} |
||||||
|
|
||||||
public CellImage update() { |
public CellImage update() { |
||||||
return (CellImage) super.update(); |
CellImage cellImage = new CellImage(); |
||||||
|
cellImage.setImage(previewPane.getImageWithSuffix()); |
||||||
|
cellImage.setStyle(this.imageStyle); |
||||||
|
return cellImage; |
||||||
} |
} |
||||||
|
|
||||||
|
public File getSelectedImage() { |
||||||
|
return imageFile; |
||||||
} |
} |
||||||
|
} |
||||||
|
|
||||||
|
@ -1,12 +0,0 @@ |
|||||||
package com.fanruan.api.design.work; |
|
||||||
|
|
||||||
/** |
|
||||||
* 控件属性表绘制 |
|
||||||
* |
|
||||||
*/ |
|
||||||
public class WidgetPropertyPane { |
|
||||||
|
|
||||||
public static com.fr.design.mainframe.WidgetPropertyPane getInstance() { |
|
||||||
return com.fr.design.mainframe.WidgetPropertyPane.getInstance(); |
|
||||||
} |
|
||||||
} |
|
Loading…
Reference in new issue