Browse Source

整理模块

master
RichieJi 7 years ago
parent
commit
2b1369200f
  1. 93
      designer/src/com/fr/design/mainframe/bbs/BBSBrowserDialog.java
  2. 46
      designer/src/com/fr/design/mainframe/bbs/DisplayThread.java
  3. 7
      designer_base/src/com/fr/design/widget/component/BackgroundCompPane.java
  4. 6
      designer_base/src/com/fr/design/widget/component/ButtonBackgroundPane.java
  5. 6
      designer_form/src/com/fr/design/widget/ui/designer/component/TabFitLayoutBackgroundPane.java

93
designer/src/com/fr/design/mainframe/bbs/BBSBrowserDialog.java

@ -1,93 +0,0 @@
package com.fr.design.mainframe.bbs;
import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Frame;
import org.eclipse.swt.SWT;
import org.eclipse.swt.awt.SWT_AWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
/**
* 封装浏览器的dialog
*
*/
public class BBSBrowserDialog extends UIDialog {
private static final int WIDTH = 600;
private static final int HEIGHT = 400;
private DisplayThread displayThread;
private Canvas canvas;
private String url;
public BBSBrowserDialog(Frame parent) {
super(parent);
this.displayThread = new DisplayThread();
this.displayThread.start();
this.canvas = new Canvas();
setLayout(new BorderLayout());
add(canvas, BorderLayout.CENTER);
this.setSize(WIDTH, HEIGHT);
GUICoreUtils.centerWindow(this);
}
@Override
public String getTitle() {
return Inter.getLocText("FR-Designer_Forum");
}
/**
* 通知组件可以显示了
*
*/
public void addNotify() {
super.addNotify();
Display dis = displayThread.getDisplay();
dis.syncExec(new Runnable() {
public void run() {
Shell shell = SWT_AWT.new_Shell(displayThread.getDisplay(), canvas);
shell.setLayout(new FillLayout());
final Browser browser = new Browser(shell, SWT.NONE);
browser.setLayoutData(BorderLayout.CENTER);
browser.setUrl(url);
}
});
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
/**
* 检测面板中内容合法性
*
*/
public void checkValid() throws Exception {
}
/**
* 在窗口中显示指定的url
*
* @param url 指定的url
*
*/
public void showWindow(String url){
this.setUrl(url);
this.setVisible(true);
}
}

46
designer/src/com/fr/design/mainframe/bbs/DisplayThread.java

@ -1,46 +0,0 @@
package com.fr.design.mainframe.bbs;
import org.eclipse.swt.widgets.Display;
public class DisplayThread extends Thread {
private Display display;
Object sem = new Object();
/**
* 运行
*
*/
public void run() {
synchronized (sem) {
display = Display.getDefault();
sem.notifyAll();
}
swtEventLoop();
}
private void swtEventLoop() {
while (true) {
try{
if (!display.readAndDispatch()) {
display.sleep();
}
}catch (Exception e) {
continue;
}
}
}
public Display getDisplay() {
try {
synchronized (sem) {
while (display == null) {
sem.wait();
}
return display;
}
} catch (Exception e) {
return null;
}
}
}

7
designer_base/src/com/fr/design/widget/component/BackgroundCompPane.java

@ -10,7 +10,6 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleImgBackgroundEditor; import com.fr.design.mainframe.widget.accessibles.AccessibleImgBackgroundEditor;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.vividsolutions.jts.index.bintree.Interval;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -20,7 +19,7 @@ import java.awt.*;
*/ */
public abstract class BackgroundCompPane<T extends Widget> extends BasicPane { public abstract class BackgroundCompPane<T extends Widget> extends BasicPane {
protected UIButtonGroup backgroundHead; protected UIButtonGroup backgroundHead;
protected AccessibleImgBackgroundEditor initalBackgroundEditor; protected AccessibleImgBackgroundEditor initialBackgroundEditor;
protected AccessibleImgBackgroundEditor overBackgroundEditor; protected AccessibleImgBackgroundEditor overBackgroundEditor;
protected AccessibleImgBackgroundEditor clickBackgroundEditor; protected AccessibleImgBackgroundEditor clickBackgroundEditor;
private JPanel panel; private JPanel panel;
@ -32,7 +31,7 @@ public abstract class BackgroundCompPane<T extends Widget> extends BasicPane {
public void initComponent() { public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
UILabel headLabel = createUILable(); UILabel headLabel = createUILable();
initalBackgroundEditor = new AccessibleImgBackgroundEditor(); initialBackgroundEditor = new AccessibleImgBackgroundEditor();
overBackgroundEditor = new AccessibleImgBackgroundEditor(); overBackgroundEditor = new AccessibleImgBackgroundEditor();
clickBackgroundEditor = new AccessibleImgBackgroundEditor(); clickBackgroundEditor = new AccessibleImgBackgroundEditor();
String [] titles = new String[]{Inter.getLocText("FR-Designer_DEFAULT"), Inter.getLocText("FR-Designer_Custom")}; String [] titles = new String[]{Inter.getLocText("FR-Designer_DEFAULT"), Inter.getLocText("FR-Designer_Custom")};
@ -43,7 +42,7 @@ public abstract class BackgroundCompPane<T extends Widget> extends BasicPane {
double[] columnSize = {p, f}; double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 1},{1, 1}}; int[][] rowCount = {{1, 1},{1, 1},{1, 1}};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Initial")), initalBackgroundEditor}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Initial")), initialBackgroundEditor},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Over")), overBackgroundEditor}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Over")), overBackgroundEditor},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Click")), clickBackgroundEditor}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Click")), clickBackgroundEditor},
}; };

6
designer_base/src/com/fr/design/widget/component/ButtonBackgroundPane.java

@ -21,7 +21,7 @@ public class ButtonBackgroundPane extends BackgroundCompPane<FreeButton> {
freeButton.setClickBackground(null); freeButton.setClickBackground(null);
}else{ }else{
freeButton.setCustomStyle(true); freeButton.setCustomStyle(true);
freeButton.setInitialBackground((Background) initalBackgroundEditor.getValue()); freeButton.setInitialBackground((Background) initialBackgroundEditor.getValue());
freeButton.setOverBackground((Background) overBackgroundEditor.getValue()); freeButton.setOverBackground((Background) overBackgroundEditor.getValue());
freeButton.setClickBackground((Background)clickBackgroundEditor.getValue()); freeButton.setClickBackground((Background)clickBackgroundEditor.getValue());
} }
@ -31,12 +31,12 @@ public class ButtonBackgroundPane extends BackgroundCompPane<FreeButton> {
public void populate(FreeButton freeButton){ public void populate(FreeButton freeButton){
if(!freeButton.isCustomStyle()){ if(!freeButton.isCustomStyle()){
backgroundHead.setSelectedIndex(0); backgroundHead.setSelectedIndex(0);
initalBackgroundEditor.setValue(null); initialBackgroundEditor.setValue(null);
overBackgroundEditor.setValue(null); overBackgroundEditor.setValue(null);
clickBackgroundEditor.setValue(null); clickBackgroundEditor.setValue(null);
}else{ }else{
backgroundHead.setSelectedIndex(1); backgroundHead.setSelectedIndex(1);
initalBackgroundEditor.setValue(freeButton.getInitialBackground()); initialBackgroundEditor.setValue(freeButton.getInitialBackground());
overBackgroundEditor.setValue(freeButton.getOverBackground()); overBackgroundEditor.setValue(freeButton.getOverBackground());
clickBackgroundEditor.setValue(freeButton.getClickBackground()); clickBackgroundEditor.setValue(freeButton.getClickBackground());
} }

6
designer_form/src/com/fr/design/widget/ui/designer/component/TabFitLayoutBackgroundPane.java

@ -24,7 +24,7 @@ public class TabFitLayoutBackgroundPane extends BackgroundCompPane<WTabFitLayout
wTabFitLayout.setClickBackground(null); wTabFitLayout.setClickBackground(null);
}else{ }else{
wTabFitLayout.setCustomStyle(true); wTabFitLayout.setCustomStyle(true);
wTabFitLayout.setInitialBackground((Background) initalBackgroundEditor.getValue()); wTabFitLayout.setInitialBackground((Background) initialBackgroundEditor.getValue());
wTabFitLayout.setOverBackground((Background) overBackgroundEditor.getValue()); wTabFitLayout.setOverBackground((Background) overBackgroundEditor.getValue());
wTabFitLayout.setClickBackground((Background)clickBackgroundEditor.getValue()); wTabFitLayout.setClickBackground((Background)clickBackgroundEditor.getValue());
} }
@ -34,12 +34,12 @@ public class TabFitLayoutBackgroundPane extends BackgroundCompPane<WTabFitLayout
public void populate(WTabFitLayout wTabFitLayout){ public void populate(WTabFitLayout wTabFitLayout){
if(!wTabFitLayout.isCustomStyle()){ if(!wTabFitLayout.isCustomStyle()){
backgroundHead.setSelectedIndex(0); backgroundHead.setSelectedIndex(0);
initalBackgroundEditor.setValue(null); initialBackgroundEditor.setValue(null);
overBackgroundEditor.setValue(null); overBackgroundEditor.setValue(null);
clickBackgroundEditor.setValue(null); clickBackgroundEditor.setValue(null);
}else{ }else{
backgroundHead.setSelectedIndex(1); backgroundHead.setSelectedIndex(1);
initalBackgroundEditor.setValue(wTabFitLayout.getInitialBackground()); initialBackgroundEditor.setValue(wTabFitLayout.getInitialBackground());
overBackgroundEditor.setValue(wTabFitLayout.getOverBackground()); overBackgroundEditor.setValue(wTabFitLayout.getOverBackground());
clickBackgroundEditor.setValue(wTabFitLayout.getClickBackground()); clickBackgroundEditor.setValue(wTabFitLayout.getClickBackground());
} }

Loading…
Cancel
Save