本文整理汇总了Java中org.dashbuilder.displayer.DisplayerSubType类的典型用法代码示例。如果您正苦于以下问题:Java DisplayerSubType类的具体用法?Java DisplayerSubType怎么用?Java DisplayerSubType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DisplayerSubType类属于org.dashbuilder.displayer包,在下文中一共展示了DisplayerSubType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRenderersForType
import org.dashbuilder.displayer.DisplayerSubType; //导入依赖的package包/类
public List<RendererLibrary> getRenderersForType(DisplayerType type, DisplayerSubType subType) {
if (type == null) {
return subType == null ? renderersList : renderersBySubType.get(subType);
}
else if (subType == null) {
return renderersByType.get(type);
}
else {
List<RendererLibrary> types = renderersByType.get(type);
List<RendererLibrary> result = new ArrayList<RendererLibrary>(renderersBySubType.get(subType));
Iterator<RendererLibrary> it = result.iterator();
while (it.hasNext()) {
RendererLibrary rl = it.next();
if (!types.contains(rl)) {
it.remove();
}
}
return result;
}
}
示例2: init
import org.dashbuilder.displayer.DisplayerSubType; //导入依赖的package包/类
public void init(DisplayerType type, DisplayerSubType selectedSubType) {
view.clear();
RendererLibrary rendererLibrary = rendererManager.getRendererForType(type);
if (rendererLibrary != null) {
List<DisplayerSubType> supportedSubTypes = rendererLibrary.getSupportedSubtypes(type);
if (supportedSubTypes != null && !supportedSubTypes.isEmpty()) {
for (int i = 0; i < supportedSubTypes.size(); i++) {
DisplayerSubType subtype = supportedSubTypes.get(i);
// Double check the renderer library for invalid subtypes for this type
if (!type.getSubTypes().contains(subtype)) {
throw new RuntimeException("Wrong subtype (" + subtype + ") indicated for type " + type + " by renderer library " + rendererLibrary.getUUID());
}
boolean initiallySelected = selectedSubType != null ? subtype == selectedSubType : i == 0;
view.show(type, subtype);
if (initiallySelected) {
view.select(subtype);
}
}
} else {
view.showDefault(type);
}
}
}
示例3: show
import org.dashbuilder.displayer.DisplayerSubType; //导入依赖的package包/类
@Override
public void show(DisplayerType type, final DisplayerSubType subtype) {
String resourcePrefix = type.toString() + "_" + subtype.toString();
ImageResource selectedIR = (ImageResource) DisplayerImagesResources.INSTANCE.getResource(resourcePrefix + DisplayerImagesResources.SELECTED_SUFFIX);
ImageResource unselectedIR = (ImageResource) DisplayerImagesResources.INSTANCE.getResource(resourcePrefix + DisplayerImagesResources.UNSELECTED_SUFFIX);
String tooltip = DisplayerTypeConstants.INSTANCE.getString(resourcePrefix + "_tt");
final DisplayerSubTypeImageWidget dstiw = new DisplayerSubTypeImageWidget(selectedIR, unselectedIR, tooltip, false);
imageWidgets.put(subtype, dstiw);
subtypes.setWidget(subtypes.getRowCount(), 0, dstiw);
dstiw.setSelectClickHandler(e -> {
if (!dstiw.isSelected) {
select(subtype);
presenter.onSelect(subtype);
}
});
}
示例4: testBrandNewDisplayer
import org.dashbuilder.displayer.DisplayerSubType; //导入依赖的package包/类
@Test
public void testBrandNewDisplayer() {
when(view.getBrandNewDisplayerTitle()).thenReturn("New displayer");
presenter.init(null);
assertEquals(presenter.isBrandNewDisplayer(), true);
verify(displayerSettings).setTitle("New displayer");
verify(displayerPrototypes).getProto(any(DisplayerType.class));
verify(displayerLocator).lookupDisplayer(displayerSettings);
verify(displayer).draw();
verify(typeSelector).init(any(DisplayerType.class), any(DisplayerSubType.class));
verify(lookupEditor).init(lookupConstraints, null);
verify(settingsEditor).init(displayer);
verify(view).showDisplayer(displayer);
}
示例5: testSingleRenderer
import org.dashbuilder.displayer.DisplayerSubType; //导入依赖的package包/类
@Test
public void testSingleRenderer() {
List<RendererLibrary> rendererLibs = Arrays.asList((RendererLibrary) d3Lib);
when(rendererManager.getRenderersForType(any(DisplayerType.class), any(DisplayerSubType.class))).thenReturn(rendererLibs);
when(rendererManager.getRendererForDisplayer(settings)).thenReturn(d3Lib);
presenter.init(settings, RendererSelector.SelectorType.TAB, 300, selectCommand);
verify(tabListView).setVisible(false);
verify(tabListView, never()).setWidth(anyInt());
verify(tabListView, never()).clearRendererSelector();
verify(tabListView, never()).addRendererItem(anyString());
verify(tabListView, never()).setSelectedRendererIndex(anyInt());
verifyZeroInteractions(listBoxView, radioListView);
}
示例6: testMultipleRenderers
import org.dashbuilder.displayer.DisplayerSubType; //导入依赖的package包/类
@Test
public void testMultipleRenderers() {
List<RendererLibrary> rendererLibs = Arrays.asList((RendererLibrary) gwtLib, d3Lib, lienzoLib);
when(rendererManager.getRenderersForType(any(DisplayerType.class), any(DisplayerSubType.class))).thenReturn(rendererLibs);
when(rendererManager.getRendererForDisplayer(settings)).thenReturn(d3Lib);
presenter.init(settings, RendererSelector.SelectorType.LIST, 300, selectCommand);
verify(listBoxView).setVisible(true);
verify(listBoxView).setWidth(300);
verify(listBoxView).clearRendererSelector();
verify(listBoxView).addRendererItem("gwt");
verify(listBoxView).addRendererItem("d3");
verify(listBoxView).addRendererItem("lienzo");
verify(listBoxView).setSelectedRendererIndex(1);
verifyZeroInteractions(tabListView, radioListView);
}
示例7: createOptions
import org.dashbuilder.displayer.DisplayerSubType; //导入依赖的package包/类
@Override
protected Options createOptions() {
boolean isLine = DisplayerSubType.LINE.equals(subType);
LineChartOptions options = LineChartOptions.create();
options.setCurveType(isLine ? CurveType.NONE : CurveType.FUNCTION);
options.setWidth(width);
options.setHeight(height);
options.setBackgroundColor(bgColor);
options.setChartArea(createChartArea());
options.setLegend(createChartLegend());
options.setColors(colors);
options.setHAxis(createHAxis());
options.setVAxis(createVAxis());
if (animationOn) {
Animation anim = Animation.create();
anim.setDuration(animationDuration);
anim.setEasing(AnimationEasing.IN_AND_OUT);
options.setAnimation(anim);
}
return options;
}
示例8: getSupportedSubtypes
import org.dashbuilder.displayer.DisplayerSubType; //导入依赖的package包/类
@Override
public List<DisplayerSubType> getSupportedSubtypes(DisplayerType displayerType) {
switch (displayerType) {
case BARCHART:
return Arrays.asList(BAR, BAR_STACKED, COLUMN, COLUMN_STACKED);
case PIECHART:
return Arrays.asList(PIE, PIE_3D, DONUT);
case AREACHART:
return Arrays.asList(AREA, AREA_STACKED /*,STEPPED*/);
case LINECHART:
return Arrays.asList(LINE, SMOOTH);
case MAP:
return Arrays.asList(MAP_REGIONS, MAP_MARKERS);
default:
return Arrays.asList();
}
}
示例9: buildProjectSelectorSettings
import org.dashbuilder.displayer.DisplayerSubType; //导入依赖的package包/类
public DisplayerSettings buildProjectSelectorSettings(final OrganizationalUnit organizationalUnit) {
return DisplayerSettingsFactory.newSelectorSettings()
.dataset(GIT_CONTRIB)
.filter(createOrgUnitFilter(organizationalUnit))
.group(COLUMN_PROJECT)
.column(COLUMN_PROJECT,
translationService.getTranslation(LibraryConstants.Project))
.column(COUNT,
"#commits").format(translationService.getTranslation(LibraryConstants.NumberOfCommits),
"#,##0")
.sort("#commits",
DESCENDING)
.subtype(DisplayerSubType.SELECTOR_DROPDOWN).multiple(true)
.titleVisible(false)
.margins(0,
0,
10,
0)
.width(200)
.filterOn(false,
true,
true)
.buildSettings();
}
示例10: buildTopContributorSelectorSettings
import org.dashbuilder.displayer.DisplayerSubType; //导入依赖的package包/类
public DisplayerSettings buildTopContributorSelectorSettings(final OrganizationalUnit organizationalUnit) {
return DisplayerSettingsFactory.newSelectorSettings()
.dataset(GIT_CONTRIB)
.filter(createOrgUnitFilter(organizationalUnit))
.group(COLUMN_AUTHOR)
.column(COLUMN_AUTHOR,
translationService.getTranslation(LibraryConstants.TopContributor))
.column(COUNT,
"#commits").format(translationService.getTranslation(LibraryConstants.NumberOfCommits),
"#,##0")
.sort("#commits",
DESCENDING)
.subtype(DisplayerSubType.SELECTOR_DROPDOWN).multiple(true)
.titleVisible(false)
.margins(0,
0,
10,
0)
.width(200)
.filterOn(false,
true,
true)
.buildSettings();
}
示例11: buildDateSelectorSettings
import org.dashbuilder.displayer.DisplayerSubType; //导入依赖的package包/类
public DisplayerSettings buildDateSelectorSettings(final OrganizationalUnit organizationalUnit) {
return DisplayerSettingsFactory.newSelectorSettings()
.dataset(GIT_CONTRIB)
.filter(createOrgUnitFilter(organizationalUnit))
.column(COLUMN_DATE)
.format(translationService.getTranslation(LibraryConstants.Date),
"dd MMM, yyyy HH:mm")
.subtype(DisplayerSubType.SELECTOR_SLIDER)
.titleVisible(false)
.width(420)
.margins(0,
0,
20,
10)
.filterOn(false,
true,
true)
.buildSettings();
}
示例12: buildTopContributorSelectorSettings
import org.dashbuilder.displayer.DisplayerSubType; //导入依赖的package包/类
public DisplayerSettings buildTopContributorSelectorSettings(WorkspaceProject project) {
return DisplayerSettingsFactory.newSelectorSettings()
.dataset(GIT_CONTRIB)
.filter(createProjectFilter(project))
.group(COLUMN_AUTHOR)
.column(COLUMN_AUTHOR,
translationService.getTranslation(LibraryConstants.TopContributor))
.column(COUNT,
"#commits").format(translationService.getTranslation(LibraryConstants.NumberOfCommits),
"#,##0")
.sort("#commits",
DESCENDING)
.subtype(DisplayerSubType.SELECTOR_DROPDOWN).multiple(true)
.titleVisible(false)
.margins(0,
0,
10,
0)
.width(200)
.filterOn(false,
true,
true)
.buildSettings();
}
示例13: buildDateSelectorSettings
import org.dashbuilder.displayer.DisplayerSubType; //导入依赖的package包/类
public DisplayerSettings buildDateSelectorSettings(WorkspaceProject project) {
return DisplayerSettingsFactory.newSelectorSettings()
.dataset(GIT_CONTRIB)
.filter(createProjectFilter(project))
.column(COLUMN_DATE).format(translationService.getTranslation(LibraryConstants.Date), "dd MMM, yyyy HH:mm")
.subtype(DisplayerSubType.SELECTOR_SLIDER)
.titleVisible(false)
.width(420)
.margins(0,
0,
20,
10)
.filterOn(false,
true,
true)
.buildSettings();
}
示例14: init
import org.dashbuilder.displayer.DisplayerSubType; //导入依赖的package包/类
@PostConstruct
private void init() {
Collection<SyncBeanDef<RendererLibrary>> beanDefs = beanManager.lookupBeans(RendererLibrary.class);
for (SyncBeanDef<RendererLibrary> beanDef : beanDefs) {
RendererLibrary lib = beanDef.getInstance();
renderersList.add(lib);
for (DisplayerType displayerType : DisplayerType.values()) {
if (lib.isDefault(displayerType)) {
renderersDefault.put(displayerType, lib);
}
}
List<DisplayerType> types = lib.getSupportedTypes();
if (types != null && !types.isEmpty()) {
for (DisplayerType type : types) {
List<RendererLibrary> set = renderersByType.get(type);
if (set == null) {
set = new ArrayList<>();
renderersByType.put(type, set);
}
set.add(lib);
List<DisplayerSubType> subTypes = lib.getSupportedSubtypes(type);
if (subTypes != null && !subTypes.isEmpty()) {
for (DisplayerSubType subType : subTypes) {
List<RendererLibrary> subset = renderersBySubType.get(subType);
if (subset == null) {
subset = new ArrayList<>();
renderersBySubType.put(subType, subset);
}
subset.add(lib);
}
}
}
}
}
}
示例15: displayerTypeChanged
import org.dashbuilder.displayer.DisplayerSubType; //导入依赖的package包/类
void displayerTypeChanged(DisplayerType type, DisplayerSubType displayerSubType) {
// Create new settings for the selected type
selectedTypeSettings = displayerPrototypes.getProto(type, displayerSubType);
DataSet oldDataSet = displayerSettings.getDataSet();
DataSetLookup oldDataLookup = displayerSettings.getDataSetLookup();
// Check if the current data lookup is compatible with the new displayer type
if (oldDataSet == null && oldDataLookup != null) {
Displayer displayer = displayerLocator.lookupDisplayer(selectedTypeSettings);
DisplayerConstraints displayerConstraints = displayer.getDisplayerConstraints();
DataSetLookupConstraints dataConstraints = displayerConstraints.getDataSetLookupConstraints();
DataSetMetadata metadata = clientServices.getMetadata(oldDataLookup.getDataSetUUID());
// Keep the current data settings provided it satisfies the data constraints
ValidationError validationError = dataConstraints.check(oldDataLookup, metadata);
if (validationError == null) {
selectedTypeSettings.setDataSet(null);
selectedTypeSettings.setDataSetLookup(oldDataLookup);
applySelectedType();
}
// If the data lookup is not compatible then ask the user what to do
else {
view.showTypeChangedWarning(this::applySelectedType, this::abortSelectedType);
}
}
// If the displayer is static (no data lookup) then just display the selected displayer prototype
else {
applySelectedType();
}
}