ju
7 years ago
37 changed files with 781 additions and 664 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"); |
||||
} |
||||
} |
@ -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); |
||||
} |
||||
} |
Loading…
Reference in new issue