Qinghui.Liu
4 years ago
56 changed files with 1407 additions and 614 deletions
@ -0,0 +1,48 @@
|
||||
package com.fr.design.actions.community; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.locale.impl.BugNeedMark; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.design.utils.BrowseUtils; |
||||
import com.fr.general.locale.LocaleCenter; |
||||
import com.fr.general.locale.LocaleMark; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.ActionEvent; |
||||
|
||||
/** |
||||
* @Author: Yuan.Wang |
||||
* @Date: 2020/7/28 |
||||
*/ |
||||
public class BugNeedAction extends UpdateAction { |
||||
public BugNeedAction() { |
||||
this.setMenuKeySet(BugAndNeed); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/need.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
LocaleMark<String> localeMark = LocaleCenter.getMark(BugNeedMark.class); |
||||
BrowseUtils.browser(localeMark.getValue()); |
||||
} |
||||
|
||||
public static final MenuKeySet BugAndNeed = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_BugAndNeed"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,49 @@
|
||||
package com.fr.design.actions.community; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.locale.impl.TechSupportMark; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.design.utils.BrowseUtils; |
||||
import com.fr.general.locale.LocaleCenter; |
||||
import com.fr.general.locale.LocaleMark; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.ActionEvent; |
||||
|
||||
/** |
||||
* @Author: Yuan.Wang |
||||
* @Date: 2020/7/28 |
||||
*/ |
||||
public class TechSupportAction extends UpdateAction { |
||||
public TechSupportAction() { |
||||
this.setMenuKeySet(TechSupport); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/support.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
LocaleMark<String> localeMark = LocaleCenter.getMark(TechSupportMark.class); |
||||
String str=localeMark.getValue(); |
||||
BrowseUtils.browser(localeMark.getValue()); |
||||
} |
||||
|
||||
public static final MenuKeySet TechSupport = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_TechSupport"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,9 @@
|
||||
package com.fr.design.event; |
||||
|
||||
/** |
||||
* @Author: Yuan.Wang |
||||
* @Date: 2020/7/29 |
||||
*/ |
||||
public interface StateChangeListener { |
||||
public void stateChange(); |
||||
} |
File diff suppressed because one or more lines are too long
@ -0,0 +1,29 @@
|
||||
package com.fr.design.locale.impl; |
||||
|
||||
import com.fr.general.CloudCenter; |
||||
import com.fr.general.GeneralContext; |
||||
import com.fr.general.locale.LocaleMark; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Locale; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @Author: Yuan.Wang |
||||
* @Date: 2020/7/29 |
||||
*/ |
||||
public class BugNeedMark implements LocaleMark<String> { |
||||
private Map<Locale, String> map = new HashMap<>(); |
||||
private static final String TW_BUG_AND_NEEDS = CloudCenter.getInstance().acquireUrlByKind("bbs.bug.needs.zh_TW"); |
||||
|
||||
public BugNeedMark() { |
||||
map.put(Locale.TAIWAN, TW_BUG_AND_NEEDS); |
||||
} |
||||
|
||||
@Override |
||||
public String getValue() { |
||||
String result = map.get(GeneralContext.getLocale()); |
||||
return result == null ? TW_BUG_AND_NEEDS : result; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,30 @@
|
||||
package com.fr.design.locale.impl; |
||||
|
||||
import com.fr.general.CloudCenter; |
||||
import com.fr.general.GeneralContext; |
||||
import com.fr.general.locale.LocaleMark; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Locale; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @Author: Yuan.Wang |
||||
* @Date: 2020/7/29 |
||||
*/ |
||||
public class TechSupportMark implements LocaleMark<String> { |
||||
private Map<Locale, String> map = new HashMap<>(); |
||||
private static final String EN_TECH_SUPPORT = CloudCenter.getInstance().acquireUrlByKind("bbs.tech.support.en_US"); |
||||
private static final String TW_TECH_SUPPORT = CloudCenter.getInstance().acquireUrlByKind("bbs.tech.support.zh_TW"); |
||||
|
||||
public TechSupportMark() { |
||||
map.put(Locale.US, EN_TECH_SUPPORT); |
||||
map.put(Locale.TAIWAN, TW_TECH_SUPPORT); |
||||
} |
||||
|
||||
@Override |
||||
public String getValue() { |
||||
String result = map.get(GeneralContext.getLocale()); |
||||
return result == null ? EN_TECH_SUPPORT : result; |
||||
} |
||||
} |
After Width: | Height: | Size: 385 B |
@ -0,0 +1,51 @@
|
||||
package com.fr.design.mainframe; |
||||
|
||||
import com.fr.invoke.Reflect; |
||||
import org.junit.Assert; |
||||
import org.junit.Test; |
||||
|
||||
/** |
||||
* Created by kerry on 2020-07-28 |
||||
*/ |
||||
public class JFormSliderPaneTest { |
||||
|
||||
@Test |
||||
public void testParseInputValue() { |
||||
JFormSliderPane sliderPane = new JFormSliderPane(); |
||||
int result = Reflect.on(sliderPane).call("parseInputValue", "100%").get(); |
||||
Assert.assertEquals(100, result); |
||||
result = Reflect.on(sliderPane).call("parseInputValue", "50%").get(); |
||||
Assert.assertEquals(50, result); |
||||
result = Reflect.on(sliderPane).call("parseInputValue", "50").get(); |
||||
Assert.assertEquals(50, result); |
||||
result = Reflect.on(sliderPane).call("parseInputValue", "50abc").get(); |
||||
Assert.assertEquals(100, result); |
||||
} |
||||
|
||||
@Test |
||||
public void testGetPreferredValue() { |
||||
JFormSliderPane sliderPane = new JFormSliderPane(); |
||||
int result = Reflect.on(sliderPane).call("getPreferredValue", 100).get(); |
||||
Assert.assertEquals(100, result); |
||||
result = Reflect.on(sliderPane).call("getPreferredValue", 0).get(); |
||||
Assert.assertEquals(10, result); |
||||
result = Reflect.on(sliderPane).call("getPreferredValue", 1000).get(); |
||||
Assert.assertEquals(400, result); |
||||
} |
||||
|
||||
@Test |
||||
public void testCalSliderValue() { |
||||
JFormSliderPane sliderPane = new JFormSliderPane(); |
||||
int result = Reflect.on(sliderPane).call("calSliderValue", 10).get(); |
||||
Assert.assertEquals(0, result); |
||||
result = Reflect.on(sliderPane).call("calSliderValue", 90).get(); |
||||
Assert.assertEquals(44, result); |
||||
result = Reflect.on(sliderPane).call("calSliderValue", 100).get(); |
||||
Assert.assertEquals(50, result); |
||||
result = Reflect.on(sliderPane).call("calSliderValue", 200).get(); |
||||
Assert.assertEquals(66, result); |
||||
result = Reflect.on(sliderPane).call("calSliderValue", 400).get(); |
||||
Assert.assertEquals(100, result); |
||||
|
||||
} |
||||
} |
Loading…
Reference in new issue