forked from fanruan/design
Browse Source
* commit '6f975b1733943dc78bf9f4f0c5e08920e60cf750': KERNEL-493 统一设计器和平台的数据连接bugfix/10.0
richie
6 years ago
8 changed files with 237 additions and 7 deletions
@ -0,0 +1,39 @@
|
||||
package com.fr.design.upm.database; |
||||
|
||||
import com.fr.web.struct.AssembleComponent; |
||||
import com.fr.web.struct.Atom; |
||||
import com.fr.web.struct.browser.RequestClient; |
||||
import com.fr.web.struct.category.ScriptPath; |
||||
import com.fr.web.struct.category.StylePath; |
||||
import com.fr.web.struct.impl.FineUI; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @version 10.0 |
||||
* Created by richie on 2019-05-16 |
||||
*/ |
||||
public class UniverseDatabaseComponent extends AssembleComponent { |
||||
|
||||
public static final UniverseDatabaseComponent KEY = new UniverseDatabaseComponent(); |
||||
|
||||
private UniverseDatabaseComponent() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public ScriptPath script(RequestClient req) { |
||||
return ScriptPath.build("/com/fr/design/upm/database/database.js"); |
||||
} |
||||
|
||||
@Override |
||||
public StylePath style(RequestClient req) { |
||||
return StylePath.EMPTY; |
||||
} |
||||
|
||||
@Override |
||||
public Atom[] refer() { |
||||
return new Atom[]{ |
||||
FineUI.KEY |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,32 @@
|
||||
package com.fr.design.upm.database; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.dialog.UIDialog; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @version 10.0 |
||||
* Created by richie on 2019-05-16 |
||||
*/ |
||||
public class UniverseDatabaseDialog extends UIDialog { |
||||
|
||||
public UniverseDatabaseDialog(Frame frame, BasicPane pane) { |
||||
super(frame); |
||||
setUndecorated(true); |
||||
JPanel panel = (JPanel) getContentPane(); |
||||
panel.setLayout(new BorderLayout()); |
||||
add(pane, BorderLayout.CENTER); |
||||
setSize(new Dimension(800, 500)); |
||||
GUICoreUtils.centerWindow(this); |
||||
setResizable(false); |
||||
} |
||||
|
||||
@Override |
||||
public void checkValid() throws Exception { |
||||
|
||||
} |
||||
} |
@ -0,0 +1,36 @@
|
||||
package com.fr.design.upm.database; |
||||
|
||||
import com.fr.design.dialog.UIDialog; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @version 10.0 |
||||
* Created by richie on 2019-05-16 |
||||
*/ |
||||
public class UniverseDatabaseOpener { |
||||
|
||||
private static UIDialog dialog = null; |
||||
|
||||
public static UIDialog getDialog() { |
||||
return dialog; |
||||
} |
||||
|
||||
public static void showUniverseDatabaseDialog() { |
||||
UniverseDatabasePane upmPane = new UniverseDatabasePane(); |
||||
if (dialog == null) { |
||||
dialog = new UniverseDatabaseDialog(DesignerContext.getDesignerFrame(), upmPane); |
||||
} |
||||
dialog.setVisible(true); |
||||
} |
||||
|
||||
public static void closeWindow() { |
||||
if (dialog != null) { |
||||
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); |
||||
dialog.setVisible(false); |
||||
dialog = null; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,38 @@
|
||||
package com.fr.design.upm.database; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.ui.ModernUIPane; |
||||
import com.teamdev.jxbrowser.chromium.JSValue; |
||||
import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; |
||||
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; |
||||
|
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @version 10.0 |
||||
* Created by richie on 2019-05-16 |
||||
*/ |
||||
public class UniverseDatabasePane extends BasicPane { |
||||
|
||||
private ModernUIPane<Object> modernUIPane; |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return "Database"; |
||||
} |
||||
|
||||
public UniverseDatabasePane() { |
||||
setLayout(new BorderLayout()); |
||||
modernUIPane = new ModernUIPane.Builder<Object>() |
||||
.withComponent(UniverseDatabaseComponent.KEY) |
||||
.prepare(new ScriptContextAdapter() { |
||||
@Override |
||||
public void onScriptContextCreated(ScriptContextEvent event) { |
||||
JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window"); |
||||
} |
||||
}) |
||||
.build(); |
||||
add(modernUIPane, BorderLayout.CENTER); |
||||
} |
||||
} |
@ -0,0 +1,57 @@
|
||||
window.addEventListener("load", function (ev) { |
||||
var combo1 = BI.createWidget({ |
||||
type: "bi.vertical", |
||||
items: [ |
||||
{ |
||||
type: "bi.text_value_combo", |
||||
text: "选项1", |
||||
width: 300, |
||||
items: [ |
||||
{ |
||||
el: { |
||||
type: "bi.single_select_radio_item", |
||||
width: 290, |
||||
text: "选项1", |
||||
value: 1 |
||||
}, |
||||
text: "选项1", |
||||
value: 1, |
||||
lgap: 10 |
||||
}, |
||||
{ |
||||
el: { |
||||
type: "bi.single_select_radio_item", |
||||
width: 290, |
||||
text: "选项2", |
||||
value: 2 |
||||
}, |
||||
lgap: 10, |
||||
text: "选项2", |
||||
value: 2 |
||||
}, |
||||
{ |
||||
el: { |
||||
type: "bi.single_select_radio_item", |
||||
width: 290, |
||||
text: "选项3", |
||||
value: 3 |
||||
}, |
||||
lgap: 10, |
||||
text: "选项3", |
||||
value: 3 |
||||
} |
||||
] |
||||
} |
||||
] |
||||
}); |
||||
|
||||
BI.createWidget({ |
||||
type:"bi.absolute", |
||||
element: "body", |
||||
items: [{ |
||||
el: combo1, |
||||
left: 100, |
||||
top: 100 |
||||
}] |
||||
}); |
||||
}); |
Loading…
Reference in new issue