forked from fanruan/design
hzzz
7 years ago
47 changed files with 952 additions and 711 deletions
@ -0,0 +1,22 @@
|
||||
package com.fr.design.env; |
||||
|
||||
import com.fr.base.Env; |
||||
import com.fr.core.env.EnvConfig; |
||||
import com.fr.core.env.impl.LocalEnvConfig; |
||||
import com.fr.dav.LocalEnv; |
||||
import com.fr.env.RemoteEnv; |
||||
|
||||
/** |
||||
* 根据配置生成运行环境 |
||||
*/ |
||||
public class EnvGenerator { |
||||
public static Env generate(EnvConfig config) { |
||||
Env env = null; |
||||
if (config instanceof LocalEnvConfig) { |
||||
env = new LocalEnv((LocalEnvConfig)config); |
||||
} else if (config instanceof RemoteEnvConfig) { |
||||
env = new RemoteEnv((RemoteEnvConfig) config); |
||||
} |
||||
return env; |
||||
} |
||||
} |
@ -0,0 +1,134 @@
|
||||
package com.fr.design.env; |
||||
|
||||
import com.fr.core.env.impl.AbstractEnvConfig; |
||||
import com.fr.general.Inter; |
||||
import com.fr.security.SecurityToolbox; |
||||
import com.fr.stable.AssistUtils; |
||||
import com.fr.stable.StableUtils; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.stable.xml.XMLPrintWriter; |
||||
import com.fr.stable.xml.XMLableReader; |
||||
|
||||
|
||||
public class RemoteEnvConfig extends AbstractEnvConfig { |
||||
|
||||
public static final int DEFAULT_RPC_PORT = 39999; |
||||
|
||||
private String host; |
||||
private int port; |
||||
private String username; |
||||
private String password; |
||||
|
||||
public RemoteEnvConfig() { |
||||
|
||||
} |
||||
|
||||
public RemoteEnvConfig(String host, int port, String username, String password) { |
||||
this.host = host; |
||||
this.port = port; |
||||
this.username = username; |
||||
this.password = password; |
||||
} |
||||
|
||||
@Override |
||||
public String getPath() { |
||||
return StableUtils.join(new Object[]{host, port}, ":"); |
||||
} |
||||
|
||||
public String getHost() { |
||||
return host; |
||||
} |
||||
|
||||
public void setHost(String host) { |
||||
this.host = host; |
||||
} |
||||
|
||||
public int getPort() { |
||||
return port; |
||||
} |
||||
|
||||
public void setPort(int port) { |
||||
this.port = port; |
||||
} |
||||
|
||||
public String getUsername() { |
||||
return username; |
||||
} |
||||
|
||||
public void setUsername(String username) { |
||||
this.username = username; |
||||
} |
||||
|
||||
public String getPassword() { |
||||
return password; |
||||
} |
||||
|
||||
public void setPassword(String password) { |
||||
this.password = password; |
||||
} |
||||
|
||||
@Override |
||||
public String getDescription(String name) { |
||||
return username + "@" + name + "[" + Inter.getLocText("Fine-Designer_Basic_Remote_Env") + "]"; |
||||
} |
||||
|
||||
@Override |
||||
public void readXML(XMLableReader reader) { |
||||
super.readXML(reader); |
||||
if (reader.isChildNode()) { |
||||
String tagName = reader.getTagName(); |
||||
if ("Attr".equals(tagName)) { |
||||
this.host = reader.getAttrAsString("host", StringUtils.EMPTY); |
||||
this.port = reader.getAttrAsInt("port", DEFAULT_RPC_PORT); |
||||
this.username = reader.getAttrAsString("username", StringUtils.EMPTY); |
||||
String password = reader.getAttrAsString("password", StringUtils.EMPTY); |
||||
if (StringUtils.isNotEmpty(password)) { |
||||
this.password = SecurityToolbox.decrypt(password); |
||||
} |
||||
} else if ("Username".equals(tagName)) { |
||||
this.username = reader.getElementValue(); |
||||
} else if ("Password".equals(tagName)) { |
||||
String txt = reader.getElementValue(); |
||||
this.password = SecurityToolbox.decrypt(txt); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void writeXML(XMLPrintWriter writer) { |
||||
super.writeXML(writer); |
||||
writer.startTAG("Attr") |
||||
.attr("host", host) |
||||
.attr("port", port); |
||||
writer.end(); |
||||
writer.startTAG("Username").textNode(username).end(); |
||||
if (StringUtils.isNotEmpty(password)) { |
||||
writer.startTAG("Password").textNode(SecurityToolbox.encrypt(password)).end(); |
||||
} |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object o) { |
||||
return o instanceof RemoteEnvConfig |
||||
&& AssistUtils.equals(((RemoteEnvConfig) o).host, host) |
||||
&& AssistUtils.equals(((RemoteEnvConfig) o).port, port) |
||||
&& AssistUtils.equals(((RemoteEnvConfig) o).username, username) |
||||
&& AssistUtils.equals(((RemoteEnvConfig) o).password, password); |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
return AssistUtils.hashCode(host, port, username, password); |
||||
} |
||||
|
||||
@Override |
||||
public Object clone() throws CloneNotSupportedException { |
||||
RemoteEnvConfig cloned = (RemoteEnvConfig) super.clone(); |
||||
cloned.host = host; |
||||
cloned.port = port; |
||||
cloned.username = username; |
||||
cloned.password = password; |
||||
return cloned; |
||||
} |
||||
} |
@ -0,0 +1,36 @@
|
||||
package com.fr.design.designer.properties.mobile; |
||||
|
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.design.designer.creator.XMultiFileUploader; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; |
||||
import com.fr.design.gui.itable.AbstractPropertyTable; |
||||
import com.fr.design.widget.ui.designer.mobile.MultiFileUploaderDefinePane; |
||||
import com.fr.general.Inter; |
||||
|
||||
/** |
||||
* Created by plough on 2018/4/19. |
||||
*/ |
||||
public class MultiFileUploaderPropertyUI extends AbstractWidgetPropertyUIProvider { |
||||
|
||||
private XCreator xCreator; |
||||
|
||||
public MultiFileUploaderPropertyUI(XMultiFileUploader xMultiFileUploader) { |
||||
this.xCreator = xMultiFileUploader; |
||||
} |
||||
|
||||
@Override |
||||
public AbstractPropertyTable createWidgetAttrTable() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public BasicPane createWidgetAttrPane() { |
||||
return new MultiFileUploaderDefinePane(xCreator); |
||||
} |
||||
|
||||
@Override |
||||
public String tableTitle() { |
||||
return Inter.getLocText("FR-Designer_Mobile-Attr"); |
||||
} |
||||
} |
@ -0,0 +1,65 @@
|
||||
package com.fr.design.form.mobile; |
||||
|
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.designer.IntervalConstants; |
||||
import com.fr.design.dialog.mobile.MobileRadioCheckPane; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.form.main.mobile.FormMobileAttr; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
|
||||
/** |
||||
* Created by plough on 2018/5/31. |
||||
*/ |
||||
public class FormMobileOthersPane extends BasicBeanPane<FormMobileAttr> { |
||||
|
||||
private MobileRadioCheckPane appearRefreshCheckPane; // 页面再现时刷新
|
||||
private MobileRadioCheckPane promptWhenLeaveWithoutSubmitCheckPane; // 数据未提交离开提示
|
||||
|
||||
public FormMobileOthersPane() { |
||||
this.initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
JPanel borderPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow()); |
||||
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
contentPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L1, 0, 0)); |
||||
appearRefreshCheckPane = new MobileRadioCheckPane(Inter.getLocText("FR-Designer_Appear_Refresh")); |
||||
contentPane.add(appearRefreshCheckPane, BorderLayout.WEST); |
||||
promptWhenLeaveWithoutSubmitCheckPane = new MobileRadioCheckPane(Inter.getLocText("FR-Designer_Prompt_When_Leave_Without_Submit")); |
||||
contentPane.add(promptWhenLeaveWithoutSubmitCheckPane, BorderLayout.CENTER); |
||||
borderPane.add(contentPane); |
||||
this.add(borderPane); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(FormMobileAttr ob) { |
||||
if (ob == null) { |
||||
ob = new FormMobileAttr(); |
||||
} |
||||
this.appearRefreshCheckPane.populateBean(ob.isAppearRefresh()); |
||||
this.promptWhenLeaveWithoutSubmitCheckPane.populateBean(ob.isPromptWhenLeaveWithoutSubmit()); |
||||
} |
||||
|
||||
@Override |
||||
public FormMobileAttr updateBean() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(FormMobileAttr mobileAttr) { |
||||
if(mobileAttr != null) { |
||||
mobileAttr.setAppearRefresh(this.appearRefreshCheckPane.updateBean()); |
||||
mobileAttr.setPromptWhenLeaveWithoutSubmit(this.promptWhenLeaveWithoutSubmitCheckPane.updateBean()); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText("FR-Designer_Other"); |
||||
} |
||||
} |
@ -1,75 +0,0 @@
|
||||
package com.fr.design.mainframe; |
||||
|
||||
import com.fr.design.dialog.UIDialog; |
||||
import com.fr.design.gui.icontainer.UIScrollPane; |
||||
import com.fr.design.gui.itextarea.UITextArea; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* @author zack |
||||
* @date 2016-10-14 |
||||
* @since 8.0 |
||||
*/ |
||||
public class ElementCaseHelpDialog extends UIDialog { |
||||
|
||||
private static final int OUTER_WIDTH = 190; |
||||
private static final int OUTER_HEIGHT = 280; |
||||
|
||||
|
||||
private String helpMsg; |
||||
private UIScrollPane helpArea; |
||||
|
||||
|
||||
public ElementCaseHelpDialog(Frame parent, String helpMsg) { |
||||
super(parent); |
||||
this.helpMsg = helpMsg; |
||||
initHelpArea(); |
||||
JPanel panel = (JPanel) getContentPane(); |
||||
initComponents(panel); |
||||
setSize(new Dimension(OUTER_WIDTH, OUTER_HEIGHT)); |
||||
} |
||||
|
||||
private void initHelpArea() { |
||||
UITextArea textArea = new UITextArea(helpMsg); |
||||
textArea.setEditable(false); |
||||
textArea.setBorder(null); |
||||
helpArea = new UIScrollPane(textArea); |
||||
helpArea.setBounds(0, 0, OUTER_WIDTH, OUTER_HEIGHT); |
||||
helpArea.setBorder(null); |
||||
} |
||||
|
||||
private void initComponents(JPanel contentPane) { |
||||
contentPane.setLayout(new BorderLayout()); |
||||
add(helpArea, BorderLayout.CENTER); |
||||
this.applyClosingAction(); |
||||
this.setTitle(Inter.getLocText("FR-Designer_Help")); |
||||
} |
||||
|
||||
/** |
||||
* 打开帮助框 |
||||
*/ |
||||
public void showWindow() { |
||||
this.setResizable(false); |
||||
setVisible(true); |
||||
} |
||||
|
||||
/** |
||||
* 略 |
||||
*/ |
||||
@Override |
||||
public void checkValid() throws Exception { |
||||
|
||||
} |
||||
|
||||
public void setLocationRelativeTo(JFrame c, int x, int y) { |
||||
int dx = 0, dy = 0; |
||||
Point compLocation = c.getLocationOnScreen();//获取设计器Jframe坐标作为相对位置原点
|
||||
setLocation(dx + x, dy + y); |
||||
dx = compLocation.x; |
||||
dy = compLocation.y + c.getRootPane().getY();//加上底层容器的y坐标(其实就是设计器最上方图标栏的高度)
|
||||
setLocation(dx + x, dy + y); |
||||
} |
||||
} |
Before Width: | Height: | Size: 19 MiB After Width: | Height: | Size: 21 MiB |
@ -0,0 +1,60 @@
|
||||
package com.fr.design.report.mobile; |
||||
|
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.designer.IntervalConstants; |
||||
import com.fr.design.dialog.mobile.MobileRadioCheckPane; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.general.Inter; |
||||
import com.fr.report.mobile.ElementCaseMobileAttr; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
|
||||
/** |
||||
* Created by plough on 2018/5/31. |
||||
*/ |
||||
public class MobileOthersPane extends BasicBeanPane<ElementCaseMobileAttr> { |
||||
|
||||
private MobileRadioCheckPane appearRefreshCheckPane; // 页面再现时刷新
|
||||
|
||||
public MobileOthersPane() { |
||||
this.initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
JPanel borderPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow()); |
||||
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
contentPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L1, 0, 0)); |
||||
appearRefreshCheckPane = new MobileRadioCheckPane(Inter.getLocText("FR-Designer_Appear_Refresh")); |
||||
contentPane.add(appearRefreshCheckPane, BorderLayout.WEST); |
||||
borderPane.add(contentPane); |
||||
this.add(borderPane); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(ElementCaseMobileAttr ob) { |
||||
if (ob == null) { |
||||
ob = new ElementCaseMobileAttr(); |
||||
} |
||||
this.appearRefreshCheckPane.populateBean(ob.isAppearRefresh()); |
||||
} |
||||
|
||||
@Override |
||||
public ElementCaseMobileAttr updateBean() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(ElementCaseMobileAttr mobileAttr) { |
||||
if(mobileAttr != null) { |
||||
mobileAttr.setAppearRefresh(this.appearRefreshCheckPane.updateBean()); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText("FR-Designer_Other"); |
||||
} |
||||
} |
Loading…
Reference in new issue