use of com.vaadin.ui.TabSheet.Tab in project cuba by cuba-platform.
the class DefaultTabSheetDropHandler method handleComponentReordering.
@Override
protected void handleComponentReordering(DragAndDropEvent event) {
LayoutBoundTransferable transferable = (LayoutBoundTransferable) event.getTransferable();
TabSheetTargetDetails details = (TabSheetTargetDetails) event.getTargetDetails();
DDTabSheet tabSheet = (DDTabSheet) details.getTarget();
Component c = transferable.getComponent();
Tab tab = tabSheet.getTab(c);
HorizontalDropLocation location = details.getDropLocation();
int idx = details.getOverIndex();
if (location == HorizontalDropLocation.LEFT) {
// Left of previous tab
int originalIndex = tabSheet.getTabPosition(tab);
if (originalIndex > idx) {
tabSheet.setTabPosition(tab, idx);
} else if (idx - 1 >= 0) {
tabSheet.setTabPosition(tab, idx - 1);
}
} else if (location == HorizontalDropLocation.RIGHT) {
// Right of previous tab
int originalIndex = tabSheet.getTabPosition(tab);
if (originalIndex > idx) {
tabSheet.setTabPosition(tab, idx + 1);
} else {
tabSheet.setTabPosition(tab, idx);
}
}
}
use of com.vaadin.ui.TabSheet.Tab in project opennms by OpenNMS.
the class WallboardConfigView method openWallboardEditor.
/**
* This method opens a {@link WallboardEditor} for a given {@link Wallboard}.
*
* @param wallboard the wallboard to be edited
*/
public void openWallboardEditor(Wallboard wallboard) {
if (m_wallboardEditorMap.containsKey(wallboard)) {
m_tabSheet.setSelectedTab(m_wallboardEditorMap.get(wallboard));
} else {
WallboardEditor wallboardEditor = new WallboardEditor(m_dashletSelector, wallboard);
TabSheet.Tab tab = m_tabSheet.addTab(wallboardEditor, wallboard.getTitle(), null);
wallboardEditor.setTab(tab);
tab.setClosable(true);
m_wallboardEditorMap.put(wallboard, tab);
m_tabSheet.setSelectedTab(tab);
}
}
use of com.vaadin.ui.TabSheet.Tab in project ANNIS by korpling.
the class DocBrowserController method openDocVis.
public void openDocVis(String corpus, String doc, Visualizer visConfig, Button btn) {
final String canonicalTitle = corpus + " > " + doc + " - " + "Visualizer: " + visConfig.getDisplayName();
final String tabCaption = StringUtils.substring(canonicalTitle, 0, 15) + "...";
if (visibleVisHolder.containsKey(canonicalTitle)) {
Panel visHolder = visibleVisHolder.get(canonicalTitle);
ui.getSearchView().getTabSheet().setSelectedTab(visHolder);
return;
}
Panel visHolder = new Panel();
visHolder.setSizeFull();
visHolder.addDetachListener(new ClientConnector.DetachListener() {
@Override
public void detach(ClientConnector.DetachEvent event) {
visibleVisHolder.remove(canonicalTitle);
}
});
// first set loading indicator
ProgressBar progressBar = new ProgressBar(1.0f);
progressBar.setIndeterminate(true);
progressBar.setSizeFull();
VerticalLayout layoutProgress = new VerticalLayout(progressBar);
layoutProgress.setSizeFull();
layoutProgress.setComponentAlignment(progressBar, Alignment.MIDDLE_CENTER);
visHolder.setContent(layoutProgress);
Tab visTab = ui.getSearchView().getTabSheet().addTab(visHolder, tabCaption);
visTab.setDescription(canonicalTitle);
visTab.setIcon(EYE_ICON);
visTab.setClosable(true);
ui.getSearchView().getTabSheet().setSelectedTab(visTab);
// register visible visHolder
this.visibleVisHolder.put(canonicalTitle, visHolder);
Background.run(new DocVisualizerFetcher(corpus, doc, canonicalTitle, visConfig.getType(), visHolder, visConfig, btn, UI.getCurrent()));
}
use of com.vaadin.ui.TabSheet.Tab in project VaadinUtils by rlsutton1.
the class ReportFilterUIBuilder method buildLayout.
@Override
public List<ExpanderComponent> buildLayout(Boolean hideDateFields) {
List<ExpanderComponent> components = new LinkedList<ExpanderComponent>();
boolean hasExpandingComponents = false;
Accordion accordian = null;
if (hasFilters()) {
for (ReportParameter<?> rparam : rparams) {
if (rparam.showFilter()) {
// scheduler
if (!hideDateFields || !rparam.isDateField()) {
if (rparam.shouldExpand()) {
if (accordian == null) {
accordian = new Accordion();
accordian.setSizeFull();
}
final Tab tab = accordian.addTab(rparam.getComponent(), rparam.getLabel(""));
rparam.addValidateListener(new ValidateListener() {
@Override
public void setComponentError(ErrorMessage componentError) {
tab.setComponentError(componentError);
}
});
rparam.validate();
} else {
components.add(new ExpanderComponent(rparam.getComponent(), rparam.shouldExpand()));
}
}
}
}
}
if (accordian != null) {
hasExpandingComponents = true;
components.add(new ExpanderComponent(accordian, true));
}
if (!hasExpandingComponents) {
// there are no expanding components, so add an empty expanding
// component so the fields will group together at the top
components.add(new ExpanderComponent(new VerticalLayout(), true));
}
// add 15px high layout to pack up the bottom of the layout, otherwise
// on
// some sets of filters the last component is hidden
VerticalLayout spacer = new VerticalLayout();
spacer.setHeight("15");
components.add(new ExpanderComponent(spacer, false));
return components;
}
use of com.vaadin.ui.TabSheet.Tab in project cia by Hack23.
the class BallotChartsPageModContentFactoryImpl method createContent.
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
final VerticalLayout panelContent = createPanelContent();
final String pageId = getPageId(parameters);
final DataContainer<ViewRiksdagenVoteDataBallotSummary, RiksdagenVoteDataBallotEmbeddedId> dataContainer = getApplicationManager().getDataContainer(ViewRiksdagenVoteDataBallotSummary.class);
final DataContainer<ViewRiksdagenVoteDataBallotPartySummary, RiksdagenVoteDataBallotPartyEmbeddedId> dataPartyContainer = getApplicationManager().getDataContainer(ViewRiksdagenVoteDataBallotPartySummary.class);
final List<ViewRiksdagenVoteDataBallotSummary> ballots = dataContainer.findListByEmbeddedProperty(ViewRiksdagenVoteDataBallotSummary.class, ViewRiksdagenVoteDataBallotSummary_.embeddedId, RiksdagenVoteDataBallotEmbeddedId.class, RiksdagenVoteDataBallotEmbeddedId_.ballotId, pageId);
final List<ViewRiksdagenVoteDataBallotPartySummary> partyBallotList = dataPartyContainer.findListByEmbeddedProperty(ViewRiksdagenVoteDataBallotPartySummary.class, ViewRiksdagenVoteDataBallotPartySummary_.embeddedId, RiksdagenVoteDataBallotPartyEmbeddedId.class, RiksdagenVoteDataBallotPartyEmbeddedId_.ballotId, pageId);
if (!ballots.isEmpty()) {
getBallotMenuItemFactory().createBallotMenuBar(menuBar, pageId);
LabelFactory.createHeader2Label(panelContent, CHARTS);
final TabSheet tabsheet = new TabSheet();
tabsheet.setWidth(100, Unit.PERCENTAGE);
tabsheet.setHeight(100, Unit.PERCENTAGE);
panelContent.addComponent(tabsheet);
panelContent.setExpandRatio(tabsheet, ContentRatio.LARGE);
Collections.sort(ballots, (Comparator<ViewRiksdagenVoteDataBallotSummary>) (o1, o2) -> (o1.getEmbeddedId().getIssue() + o2.getEmbeddedId().getConcern()).compareTo(o1.getEmbeddedId().getIssue() + o2.getEmbeddedId().getConcern()));
for (final ViewRiksdagenVoteDataBallotSummary viewRiksdagenVoteDataBallotSummary : ballots) {
final HorizontalLayout tabContent = new HorizontalLayout();
tabContent.setWidth(100, Unit.PERCENTAGE);
tabContent.setHeight(100, Unit.PERCENTAGE);
final Tab tab = tabsheet.addTab(tabContent);
ballotChartDataManager.createChart(tab, tabContent, viewRiksdagenVoteDataBallotSummary);
}
final Map<String, List<ViewRiksdagenVoteDataBallotPartySummary>> concernIssuePartyBallotSummaryMap = createIssueConcernMap(partyBallotList);
for (final List<ViewRiksdagenVoteDataBallotPartySummary> partyBallotSummaryList : concernIssuePartyBallotSummaryMap.values()) {
final HorizontalLayout tabContent = new HorizontalLayout();
tabContent.setWidth(100, Unit.PERCENTAGE);
tabContent.setHeight(100, Unit.PERCENTAGE);
final Tab tab = tabsheet.addTab(tabContent);
ballotChartDataManager.createChart(tab, tabContent, partyBallotSummaryList);
}
panel.setCaption(new StringBuilder().append(NAME).append("::").append(BALLOT).append(pageId).toString());
getPageActionEventHelper().createPageEvent(ViewAction.VISIT_BALLOT_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId);
}
return panelContent;
}
Aggregations