@ -0,0 +1,47 @@
|
||||
package com.fr.design.actions.community; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.design.utils.BrowseUtils; |
||||
import com.fr.general.CloudCenter; |
||||
|
||||
import javax.swing.KeyStroke; |
||||
import java.awt.event.ActionEvent; |
||||
|
||||
/** |
||||
* Created by XINZAI on 2018/8/23. |
||||
*/ |
||||
public class CenterAction extends UpAction{ |
||||
public CenterAction() |
||||
{ |
||||
this.setMenuKeySet(CENTER); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/center.png")); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent arg0) |
||||
{ |
||||
String url = CloudCenter.getInstance().acquireUrlByKind("bbs.center"); |
||||
BrowseUtils.browser(url); |
||||
|
||||
} |
||||
public static final MenuKeySet CENTER = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'C'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Commuinity_Center"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,48 @@
|
||||
package com.fr.design.actions.community; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
|
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.design.utils.BrowseUtils; |
||||
import com.fr.general.CloudCenter; |
||||
import javax.swing.KeyStroke; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
/** |
||||
* Created by XINZAI on 2018/8/23. |
||||
*/ |
||||
public class CusDemandAction extends UpAction{ |
||||
public CusDemandAction() |
||||
{ |
||||
this.setMenuKeySet(DEMAND); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/demand.png")); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent arg0) |
||||
{ |
||||
String url = CloudCenter.getInstance().acquireUrlByKind("bbs.demand"); |
||||
BrowseUtils.browser(url); |
||||
|
||||
} |
||||
public static final MenuKeySet DEMAND = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'D'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Commuinity_Demand"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,52 @@
|
||||
package com.fr.design.actions.community; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.design.utils.BrowseUtils; |
||||
import com.fr.general.CloudCenter; |
||||
|
||||
|
||||
import javax.swing.KeyStroke; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
|
||||
/** |
||||
* Created by XINZAI on 2018/8/23. |
||||
*/ |
||||
public class TechSolutionAction extends UpdateAction{ |
||||
public TechSolutionAction() |
||||
{ |
||||
this.setMenuKeySet(TSO); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images//bbs/solotion.png")); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent arg0) |
||||
{ |
||||
String url = CloudCenter.getInstance().acquireUrlByKind("bbs.solution"); |
||||
BrowseUtils.browser(url); |
||||
|
||||
} |
||||
public static final MenuKeySet TSO = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'T'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Commuinity_Solution"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
|
||||
} |
@ -0,0 +1,62 @@
|
||||
package com.fr.design.utils; |
||||
|
||||
import com.fr.base.FRContext; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.stable.OperatingSystem; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.JOptionPane; |
||||
import java.awt.Desktop; |
||||
import java.io.IOException; |
||||
import java.net.URI; |
||||
import java.net.URISyntaxException; |
||||
|
||||
/** |
||||
* Created by XINZAI on 2018/8/23. |
||||
*/ |
||||
public class BrowseUtils { |
||||
|
||||
/** |
||||
* 处理内存异常,win10下用rundll32打开 |
||||
* @param uri 网址 |
||||
* @param e |
||||
*/ |
||||
private static void startBrowserFromCommand(String uri, IOException e) { |
||||
|
||||
if (OperatingSystem.isWindows()) { |
||||
try { |
||||
// win10 内存用到到80%左右的时候, Desktop.browser经常提示"存储空间不足, 无法处理改命令", 用rundll32可以打开.
|
||||
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + uri); |
||||
} catch (IOException ee) { |
||||
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser_Duplicate")); |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} |
||||
} else { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 打开网页,用默认浏览器 |
||||
* @param url 网址 |
||||
*/ |
||||
public static void browser(String url) { |
||||
|
||||
if (StringUtils.isEmpty(url)) { |
||||
FRContext.getLogger().info("The URL is empty!"); |
||||
return; |
||||
} |
||||
try { |
||||
Desktop.getDesktop().browse(new URI(url)); |
||||
} catch (IOException exp) { |
||||
startBrowserFromCommand(url, exp); |
||||
} catch (URISyntaxException exp) { |
||||
FineLoggerFactory.getLogger().error(exp.getMessage(), exp); |
||||
} catch (Exception exp) { |
||||
FineLoggerFactory.getLogger().error(exp.getMessage(), exp); |
||||
FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url); |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
After Width: | Height: | Size: 350 B |
After Width: | Height: | Size: 560 B |
After Width: | Height: | Size: 217 B |
After Width: | Height: | Size: 505 B |
After Width: | Height: | Size: 348 B |
After Width: | Height: | Size: 362 B |
After Width: | Height: | Size: 543 B |
After Width: | Height: | Size: 340 B |
After Width: | Height: | Size: 407 B |
After Width: | Height: | Size: 450 B |