use of org.vaadin.sliderpanel.SliderPanelBuilder in project catma by forTEXT.
the class TagsView method initComponents.
private void initComponents() {
getHugeCardBar().setMoreOptionsButtonVisible(false);
HorizontalLayout content = new HorizontalLayout();
content.setSizeFull();
tagsetGrid = TreeGridFactory.createDefaultTreeGrid();
tagsetGrid.addStyleNames("flat-undecorated-icon-buttonrenderer");
tagsetGrid.setSizeFull();
tagsetGrid.setSelectionMode(SelectionMode.SINGLE);
tagsetGrid.addStyleName(MaterialTheme.GRID_BORDERLESS);
Label tagsetsLabel = new Label("Tagsets");
tagsetGridComponent = new ActionGridComponent<TreeGrid<TagsetTreeItem>>(tagsetsLabel, tagsetGrid);
resourcePanel = new TagResourcePanel(project, eventBus);
drawer = new SliderPanelBuilder(resourcePanel).mode(SliderMode.LEFT).expanded(false).build();
addComponent(content);
setExpandRatio(content, 1f);
content.addComponent(drawer);
content.addComponent(tagsetGridComponent);
content.setExpandRatio(tagsetGridComponent, 1f);
}
use of org.vaadin.sliderpanel.SliderPanelBuilder in project catma by forTEXT.
the class TaggerView method initComponents.
private void initComponents() {
setSizeFull();
VerticalLayout taggerPanel = new VerticalLayout();
taggerPanel.setSizeFull();
taggerPanel.setSpacing(true);
taggerPanel.setMargin(new MarginInfo(true, true, true, false));
boolean isRtl = sourceDocument == null ? false : sourceDocument.getSourceContentHandler().getSourceDocumentInfo().getIndexInfoSet().isRightToLeftWriting();
pager = new Pager(taggerID, approxMaxLineLength, maxPageLengthInLines, isRtl);
tagger = new Tagger(taggerID, pager, this, project);
// $NON-NLS-1$
tagger.addStyleName("tagger");
// $NON-NLS-1$
tagger.setWidth("100%");
taggerPanel.addComponent(tagger);
taggerPanel.setExpandRatio(tagger, 1.0f);
HorizontalLayout actionPanel = new HorizontalLayout();
actionPanel.setSpacing(false);
taggerPanel.addComponent(actionPanel);
pagerComponent = new PagerComponent(pager, new PageChangeListener() {
public void pageChanged(int number) {
tagger.setPage(number);
}
});
actionPanel.addComponent(pagerComponent);
linesPerPageSlider = new Slider(1, 100, 0);
// $NON-NLS-1$
linesPerPageSlider.setWidth("100px");
actionPanel.addComponent(linesPerPageSlider);
cbTraceSelection = new IconButton(VaadinIcons.TWIN_COL_SELECT);
// state
cbTraceSelection.setData(false);
cbTraceSelection.setDescription("Allow multiple discontinuous selections");
actionPanel.addComponent(cbTraceSelection);
btClearSearchHighlights = new IconButton(VaadinIcons.ERASER);
btClearSearchHighlights.setDescription("Clear all search highlights");
actionPanel.addComponent(btClearSearchHighlights);
cbAutoShowComments = new IconButton(VaadinIcons.COMMENT);
cbAutoShowComments.setDescription("Toggle live Comments");
// state
cbAutoShowComments.setData(true);
actionPanel.addComponent(cbAutoShowComments);
btAnalyze = new Button("Analyze");
// $NON-NLS-1$
btAnalyze.addStyleName("primary-button");
btAnalyze.setEnabled(project instanceof IndexedProject);
actionPanel.addComponent(btAnalyze);
rightSplitPanel = new VerticalSplitPanel();
rightSplitPanel.setSizeFull();
kwicPanel = new KwicPanel(eventBus, project, KwicProvider.buildKwicProviderByDocumentIdCache(project));
kwicPanel.setExpandResource(VaadinIcons.CLOSE);
kwicPanel.setCompressResource(VaadinIcons.CLOSE);
rightSplitPanel.addComponent(kwicPanel);
hideKwicPanel();
annotationPanel = new AnnotationPanel(project, userMarkupCollectionManager, selectedAnnotationId -> tagger.setTagInstanceSelected(selectedAnnotationId), collection -> handleCollectionValueChange(collection), tag -> tagger.addTagInstanceWith(tag), () -> sourceDocument, eventBus);
rightSplitPanel.addComponent(annotationPanel);
splitPanel = new TaggerSplitPanel();
splitPanel.addComponent(taggerPanel);
splitPanel.addComponent(rightSplitPanel);
splitPanel.setSplitPosition(initialSplitterPositionInPixels, Unit.PIXELS);
// $NON-NLS-1$
splitPanel.addStyleName("catma-tab-spacing");
SplitterPositionChangedListener listener = new SplitterPositionChangedListener() {
@Override
public void positionChanged(SplitterPositionChangedEvent event) {
float width = event.getPosition();
// TODO: if it is PERCENTAGE, work out the splitter position in pixels
if (event.getPositionUnit() != Unit.PIXELS) {
// $NON-NLS-1$
String message = "Must use PIXELS Unit for split position";
errorHandler.showAndLogError(message, new IllegalArgumentException(message));
}
int approxMaxLineLength = getApproximateMaxLineLengthForSplitterPanel(width);
List<ClientTagInstance> absoluteTagInstances = pager.getAbsoluteTagInstances();
Page currentPage = null;
if (pager.hasPages()) {
currentPage = pager.getCurrentPage();
}
pager.setApproxMaxLineLength(approxMaxLineLength);
if (pager.hasPages()) {
// recalculate pages
try {
pager.setText(sourceDocument.getContent(), comments);
int previousPageNumber = pager.getPageNumberFor(currentPage.getPageStart());
tagger.setPage(previousPageNumber);
tagger.setTagInstancesVisible(absoluteTagInstances, true);
pagerComponent.setPage(previousPageNumber);
} catch (IOException e) {
// $NON-NLS-1$
errorHandler.showAndLogError("Error showing the Document!", e);
}
}
}
};
splitPanel.addListener(SplitterPositionChangedEvent.class, listener, SplitterPositionChangedListener.positionChangedMethod);
resourcePanel = new AnnotateResourcePanel(project, sourceDocument, eventBus);
drawer = new SliderPanelBuilder(resourcePanel).mode(SliderMode.LEFT).expanded(sourceDocument == null).build();
addComponent(drawer);
addComponent(splitPanel);
setExpandRatio(splitPanel, 1.0f);
}
use of org.vaadin.sliderpanel.SliderPanelBuilder in project VaadinUtils by rlsutton1.
the class DashBoardView method postLoad.
void postLoad() {
VerticalLayout sliderHolder = new VerticalLayout();
sliderHolder.setWidth("80%");
sliderHolder.setHeight("40");
addComponent(sliderHolder);
setComponentAlignment(sliderHolder, Alignment.TOP_CENTER);
dashboardsSlider = new SliderPanelBuilder(dashboardPanels()).expanded(false).mode(SliderMode.TOP).tabPosition(SliderTabPosition.MIDDLE).style(style).caption("Dashboards").animationDuration(400).tabSize(30).autoCollapseSlider(true).build();
sliderHolder.addComponent(dashboardsSlider);
Tblportallayout portalLayout = findDefaultPortal();
createDashboard(portalLayout);
dashBoardSelector.select(portalLayout);
dashBoardHolderPanel.setSizeFull();
addComponent(dashBoardHolderPanel);
setExpandRatio(dashBoardHolderPanel, 1);
}
use of org.vaadin.sliderpanel.SliderPanelBuilder in project VaadinUtils by rlsutton1.
the class HelpSplitPanel method buildMainLayout.
private void buildMainLayout() {
addComponent((Component) component);
setExpandRatio((Component) component, 1);
helpPane = new Panel();
helpPane.setImmediate(false);
showHelpLoadingSplash();
helpSliderPanel = new SliderPanelBuilder(helpPane).expanded(false).mode(SliderMode.RIGHT).tabPosition(SliderTabPosition.MIDDLE).style(SliderPanelStyles.COLOR_BLUE).caption("Help").animationDuration(400).tabSize(30).autoCollapseSlider(true).fixedContentSize((int) (UI.getCurrent().getPage().getBrowserWindowWidth() * 0.75)).build();
helpLoader = new SlideOutLoader();
innerSecondPanel = new VerticalLayout();
innerSecondPanel.setSizeFull();
innerSecondPanel.setWidth("30");
innerSecondPanel.addComponent(helpSliderPanel);
innerSecondPanel.setComponentAlignment(helpSliderPanel, Alignment.MIDDLE_RIGHT);
addComponent(innerSecondPanel);
Page.getCurrent().addBrowserWindowResizeListener(new BrowserWindowResizeListener() {
private static final long serialVersionUID = -8548907013566961812L;
@Override
public void browserWindowResized(BrowserWindowResizeEvent event) {
helpSliderPanel.setFixedContentSize((int) (event.getWidth() * 0.75));
if (helpSliderPanel.isExpanded()) {
helpSliderPanel.collapse();
}
}
});
}
use of org.vaadin.sliderpanel.SliderPanelBuilder in project catma by forTEXT.
the class AnalyzeView method initComponents.
private void initComponents(Corpus corpus) {
setSizeFull();
setSpacing(true);
// left column Queries
VerticalLayout queryPanel = new VerticalLayout();
queryPanel.setSizeFull();
Label searchPanelLabel = new Label("Queries");
btQueryOptions = new IconButton(VaadinIcons.ELLIPSIS_DOTS_V);
// TODO: no query options so far
btQueryOptions.setVisible(false);
HorizontalLayout queryHeaderPanel = new HorizontalLayout(searchPanelLabel, btQueryOptions);
queryHeaderPanel.setWidth("100%");
queryHeaderPanel.setExpandRatio(searchPanelLabel, 1.0f);
queryHeaderPanel.setComponentAlignment(searchPanelLabel, Alignment.MIDDLE_CENTER);
queryHeaderPanel.setComponentAlignment(btQueryOptions, Alignment.MIDDLE_RIGHT);
queryPanel.addComponent(queryHeaderPanel);
VerticalLayout searchPanel = createSearchPanel();
queryPanel.addComponent(searchPanel);
resultsPanel = new VerticalLayout();
resultsPanel.setMargin(new MarginInfo(false, true, false, false));
resultsPanel.setWidth("100%");
Panel resultsScrollPanel = new Panel();
resultsScrollPanel.setSizeFull();
resultsScrollPanel.addStyleName(MaterialTheme.PANEL_BORDERLESS);
resultsScrollPanel.setContent(resultsPanel);
queryPanel.addComponent(resultsScrollPanel);
queryPanel.setExpandRatio(resultsScrollPanel, 1f);
// right column Visualizations
VerticalLayout vizPanel = new VerticalLayout();
vizPanel.setSizeFull();
Label vizPanelLabel = new Label("Visualizations");
btVizOptions = new IconButton(VaadinIcons.ELLIPSIS_DOTS_V);
// TODO: no viz options so far
btVizOptions.setVisible(false);
HorizontalLayout vizHeaderPanel = new HorizontalLayout(vizPanelLabel, btVizOptions);
vizHeaderPanel.setWidth("100%");
vizHeaderPanel.setExpandRatio(vizPanelLabel, 1.0f);
vizHeaderPanel.setComponentAlignment(vizPanelLabel, Alignment.MIDDLE_CENTER);
vizHeaderPanel.setComponentAlignment(btVizOptions, Alignment.MIDDLE_RIGHT);
vizPanel.addComponent(vizHeaderPanel);
HorizontalLayout vizIconsPanel = createVizIconsPanel();
vizIconsPanel.setWidth("100%");
vizPanel.addComponent(vizIconsPanel);
vizCardsPanel = new VerticalLayout();
vizCardsPanel.setWidth("100%");
Panel vizCardsScrollPanel = new Panel();
vizCardsScrollPanel.setSizeFull();
vizCardsScrollPanel.addStyleName(MaterialTheme.PANEL_BORDERLESS);
vizCardsScrollPanel.setContent(vizCardsPanel);
vizPanel.addComponent(vizCardsScrollPanel);
vizPanel.setExpandRatio(vizCardsScrollPanel, 1.0f);
// drawer
analyzeResourcePanel = new AnalyzeResourcePanel(this.eventBus, this.project, corpus, () -> corpusChanged());
drawer = new SliderPanelBuilder(analyzeResourcePanel).mode(SliderMode.LEFT).expanded(corpus.isEmpty()).build();
addComponent(drawer);
// content
contentPanel = new HorizontalLayout();
contentPanel.setSpacing(false);
contentPanel.setMargin(false);
contentPanel.setSizeFull();
contentPanel.addComponent(queryPanel);
contentPanel.setExpandRatio(queryPanel, 0.5f);
contentPanel.addComponent(vizPanel);
contentPanel.setExpandRatio(vizPanel, 0.5f);
addComponent(contentPanel);
setExpandRatio(contentPanel, 1f);
}
Aggregations