forked from fanruan/demo-show-charts
zheng
7 years ago
6 changed files with 74 additions and 0 deletions
@ -0,0 +1,34 @@
|
||||
package com.fr.plugin.demo; |
||||
|
||||
import com.fr.extended.chart.ExtendedTypePane; |
||||
|
||||
/** |
||||
* Created by shine on 2018/4/19. |
||||
*/ |
||||
public class DemoTypePane extends ExtendedTypePane<DemoChart> { |
||||
@Override |
||||
protected String[] getTypeIconPath() { |
||||
return new String[]{ |
||||
"com/fr/plugin/demo/dark.png", |
||||
"com/fr/plugin/demo/white.png" |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected String[] getTypeTipName() { |
||||
return new String[]{ |
||||
"深色主题", |
||||
"浅色主题" |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected int getTypeIndex(DemoChart chart) { |
||||
return chart.getThemeType().ordinal(); |
||||
} |
||||
|
||||
@Override |
||||
protected void setType(DemoChart chart, int index) { |
||||
chart.setThemeType(ThemeType.parseInt(index)); |
||||
} |
||||
} |
@ -0,0 +1,18 @@
|
||||
package com.fr.plugin.demo; |
||||
|
||||
/** |
||||
* Created by shine on 2018/4/19. |
||||
*/ |
||||
public enum ThemeType { |
||||
DARK, |
||||
WHITE; |
||||
|
||||
public static ThemeType parseInt(int index) { |
||||
for (ThemeType type : ThemeType.values()) { |
||||
if (type.ordinal() == index) { |
||||
return type; |
||||
} |
||||
} |
||||
return DARK; |
||||
} |
||||
} |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 4.8 KiB |
Loading…
Reference in new issue