alex.sung
6 years ago
76 changed files with 410 additions and 128 deletions
@ -0,0 +1,34 @@
|
||||
package com.fr.design.preview; |
||||
|
||||
import com.fr.design.fun.impl.AbstractPreviewProvider; |
||||
import com.fr.locale.InterProviderFactory; |
||||
|
||||
|
||||
/** |
||||
* @author kerry |
||||
* @date 2018/5/22 |
||||
*/ |
||||
public class FormPreview extends AbstractPreviewProvider { |
||||
private static final int PREVIEW_TYPE = 5; |
||||
|
||||
@Override |
||||
public String nameForPopupItem() { |
||||
return InterProviderFactory.getProvider().getLocText("Fine-Design_Form_M_Form_Preview"); |
||||
} |
||||
|
||||
@Override |
||||
public String iconPathForPopupItem() { |
||||
return "com/fr/design/images/buttonicon/runs.png"; |
||||
} |
||||
|
||||
@Override |
||||
public String iconPathForLarge() { |
||||
return "com/fr/design/images/buttonicon/run24.png"; |
||||
} |
||||
|
||||
@Override |
||||
public int previewTypeCode() { |
||||
return PREVIEW_TYPE; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,48 @@
|
||||
package com.fr.design.preview; |
||||
|
||||
import com.fr.design.fun.impl.AbstractPreviewProvider; |
||||
import com.fr.general.Inter; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author kerry |
||||
* @date 2018/5/11 |
||||
*/ |
||||
public class MobilePreview extends AbstractPreviewProvider { |
||||
private static final int PREVIEW_TYPE = 4; |
||||
private static final String ACTION_TYPE = "path"; |
||||
|
||||
@Override |
||||
public String nameForPopupItem() { |
||||
return Inter.getLocText("Fine-Engine_Mobile_Preview"); |
||||
} |
||||
|
||||
@Override |
||||
public String iconPathForPopupItem() { |
||||
return "com/fr/design/images/buttonicon/mobile.png"; |
||||
} |
||||
|
||||
@Override |
||||
public String iconPathForLarge() { |
||||
return "com/fr/design/images/buttonicon/mobileb24.png"; |
||||
} |
||||
|
||||
@Override |
||||
public int previewTypeCode() { |
||||
return PREVIEW_TYPE; |
||||
} |
||||
|
||||
@Override |
||||
public String getActionType() { |
||||
return ACTION_TYPE; |
||||
} |
||||
|
||||
@Override |
||||
public Map<String, Object> parametersForPreview() { |
||||
Map<String, Object> map = new HashMap<String, Object>(); |
||||
map.put("op", "mobile"); |
||||
return map; |
||||
} |
||||
} |
@ -0,0 +1,89 @@
|
||||
package com.fr.start.server; |
||||
|
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.event.Event; |
||||
import com.fr.event.EventDispatcher; |
||||
import com.fr.event.Listener; |
||||
import com.fr.event.Null; |
||||
|
||||
import java.util.concurrent.ExecutorService; |
||||
import java.util.concurrent.Executors; |
||||
|
||||
/** |
||||
* 内置服务器启动监视器 |
||||
* Created by zack on 2018/8/21. |
||||
*/ |
||||
public class FineEmbedServerMonitor { |
||||
private int progress; |
||||
private static final int COMPLETE = 100;//启动完成
|
||||
private static final int STEP = 5;//随便设置一个假的进度条
|
||||
private static final int STEP_HEARTBEAT = 2000;//2秒更新进度
|
||||
private static volatile FineEmbedServerMonitor monitor; |
||||
|
||||
private FineEmbedServerMonitor() { |
||||
} |
||||
|
||||
static { |
||||
EventDispatcher.listen(EmbedServerEvent.AfterStop, new Listener<Null>() { |
||||
@Override |
||||
public void on(Event event, Null aNull) { |
||||
DesignerContext.getDesignerFrame().disposeProgressDialog(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
public static FineEmbedServerMonitor getInstance() { |
||||
if (monitor == null) { |
||||
synchronized (FineEmbedServerMonitor.class) { |
||||
if (monitor == null) { |
||||
monitor = new FineEmbedServerMonitor(); |
||||
} |
||||
} |
||||
} |
||||
return monitor; |
||||
} |
||||
|
||||
public int getProgress() { |
||||
if (progress == COMPLETE) { |
||||
return progress; |
||||
} else { |
||||
progress += STEP; |
||||
return progress; |
||||
} |
||||
} |
||||
|
||||
public void setComplete() { |
||||
this.progress = COMPLETE; |
||||
} |
||||
|
||||
public void reset() { |
||||
this.progress = 0; |
||||
} |
||||
|
||||
public boolean isComplete() { |
||||
return this.progress == COMPLETE; |
||||
} |
||||
|
||||
public void monitor() { |
||||
ExecutorService service = Executors.newSingleThreadExecutor(); |
||||
service.submit(new Runnable() { |
||||
|
||||
@Override |
||||
public void run() { |
||||
while (!isComplete()) { |
||||
if (!DesignerContext.getDesignerFrame().getProgressDialog().isVisible()) { |
||||
DesignerContext.getDesignerFrame().showProgressDialog(); |
||||
DesignerContext.getDesignerFrame().getProgressDialog().updateLoadingText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Embed_Server")); |
||||
} |
||||
DesignerContext.getDesignerFrame().updateProgress(getProgress()); |
||||
try { |
||||
Thread.sleep(STEP_HEARTBEAT); |
||||
} catch (InterruptedException ignore) { |
||||
} |
||||
} |
||||
DesignerContext.getDesignerFrame().disposeProgressDialog(); |
||||
} |
||||
}); |
||||
service.shutdown(); |
||||
} |
||||
} |
After Width: | Height: | Size: 550 B |
After Width: | Height: | Size: 1.0 KiB |
Loading…
Reference in new issue