當前位置: 首頁>>代碼示例>>Java>>正文


Java ViewNavigator類代碼示例

本文整理匯總了Java中com.holonplatform.vaadin.navigator.ViewNavigator的典型用法代碼示例。如果您正苦於以下問題:Java ViewNavigator類的具體用法?Java ViewNavigator怎麽用?Java ViewNavigator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ViewNavigator類屬於com.holonplatform.vaadin.navigator包,在下文中一共展示了ViewNavigator類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: nav2

import com.holonplatform.vaadin.navigator.ViewNavigator; //導入依賴的package包/類
public void nav2() {
	// tag::nav2[]
	ViewNavigator navigator = getViewNavigator();

	navigator.navigateInWindow("myView"); // <1>

	Map<String, Object> parameters = new HashMap<>();
	parameters.put("parameter1", "test");
	parameters.put("parameter2", 34.5);

	navigator.navigateInWindow("myView", windowConfig -> {
		windowConfig.fullWidth();
		windowConfig.styleName("my-window-style");
	}, parameters); // <2>
	// end::nav2[]
}
 
開發者ID:holon-platform,項目名稱:holon-vaadin7,代碼行數:17,代碼來源:ExampleNavigator.java

示例2: init

import com.holonplatform.vaadin.navigator.ViewNavigator; //導入依賴的package包/類
@PostConstruct
public void init() {
	Components.configure(this)
			// set full to view content
			.fullSize().spacing()
			.add(Components.button().caption("Add new").styleName(ValoTheme.BUTTON_PRIMARY)
					// navigate to "manage" view
					.onClick(e -> ViewNavigator.require().toView("manage").navigate()).build())
			// build and add listing
			.addAndExpandFull(listing = Components.listing.properties(PRODUCT)
					// setup data source using Datastore with 'products' table name target and product ID as pk
					.dataSource(datastore, TARGET, ID)
					// froze the ID column
					.frozenColumns(1)
					// set the ID column width and style
					.width(ID, 120).style(ID, "id-column")
					// when user clicks on a row, open the 'view' named View providing product id parameter
					.withItemClickListener((i, p, e) -> ViewNavigator.require().toView("view")
							.withParameter("id", i.getValue(ID)).navigate())
					// set full size and build
					.fullSize().build());
}
 
開發者ID:holon-platform,項目名稱:holon-examples,代碼行數:23,代碼來源:Home.java

示例3: init

import com.holonplatform.vaadin.navigator.ViewNavigator; //導入依賴的package包/類
@PostConstruct
public void init() {
	Components.configure(this)
			// set full to view content
			.fullSize().spacing()
			.add(Components.button().caption("Add new").styleName(ValoTheme.BUTTON_PRIMARY)
					// navigate to "manage" view
					.onClick(e -> ViewNavigator.require().toView("manage").navigate()).build())
			// build and add listing
			.addAndExpandFull(listing = Components.listing.properties(MProduct.PRODUCT)
					// setup data source using Datastore with 'products' table name target and product ID as pk
					.dataSource(datastore, DataTarget.named("products"), MProduct.ID)
					// disable auto refresh: will be triggered on view enter
					.autoRefresh(false)
					// when user clicks on a row, open the 'view' named View providing product id parameter
					.withItemClickListener((i, p, e) -> ViewNavigator.require().toView("view")
							.withParameter("id", i.getValue(MProduct.ID)).navigate())
					// set full size and build
					.fullSize().build());
}
 
開發者ID:holon-platform,項目名稱:holon-examples,代碼行數:21,代碼來源:Home.java

示例4: postProcessBeforeInitialization

import com.holonplatform.vaadin.navigator.ViewNavigator; //導入依賴的package包/類
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
	if (bean instanceof View) {
		ViewNavigator navigator = ViewNavigator.require();
		if (navigator instanceof ViewConfigurationProvider) {
			return ViewNavigationUtils.injectContext((ViewConfigurationProvider) navigator, (View) bean);
		}
	}
	return bean;
}
 
開發者ID:holon-platform,項目名稱:holon-vaadin7,代碼行數:11,代碼來源:ViewContextInjectionPostProcessor.java

示例5: setup

import com.holonplatform.vaadin.navigator.ViewNavigator; //導入依賴的package包/類
@Override
public void setup() throws Exception {
	super.setup();
	navigator = applicationContext.getBean(ViewNavigator.class);
	viewer = applicationContext.getBean(ViewDisplayPanel.class);

	ui = createUi(SpringTestUI.class, "http://localhost");
}
 
開發者ID:holon-platform,項目名稱:holon-vaadin7,代碼行數:9,代碼來源:TestNavigator.java

示例6: config2

import com.holonplatform.vaadin.navigator.ViewNavigator; //導入依賴的package包/類
public void config2() {
	// tag::config2[]
	UI ui = getUI();
	ViewNavigator.builder() //
			.viewDisplay(ui) //
			.withView("view1", View1.class) // <1>
			.withView("view2", View2.class) // <2>
			.defaultViewName("view1") // <3>
			.buildAndBind(ui);
	// end::config2[]
}
 
開發者ID:holon-platform,項目名稱:holon-vaadin7,代碼行數:12,代碼來源:ExampleNavigator.java

示例7: nav1

import com.holonplatform.vaadin.navigator.ViewNavigator; //導入依賴的package包/類
public void nav1() {
	// tag::nav1[]
	ViewNavigator navigator = getViewNavigator();

	navigator.navigateTo("myView"); // <1>

	Map<String, Object> parameters = new HashMap<>();
	parameters.put("parameter1", "test");
	parameters.put("parameter2", 34.5);

	navigator.navigateTo("myView", parameters); // <2>
	// end::nav1[]
}
 
開發者ID:holon-platform,項目名稱:holon-vaadin7,代碼行數:14,代碼來源:ExampleNavigator.java

示例8: nav3

import com.holonplatform.vaadin.navigator.ViewNavigator; //導入依賴的package包/類
public void nav3() {
	// tag::nav3[]
	ViewNavigator navigator = getViewNavigator();

	navigator.toView("myView").withParameter("parameter1", "test").withParameter("parameter2", 34.5).navigate(); // <1>

	navigator.toView("myView").navigateInWindow(); // <2>

	navigator.toView("myView").navigateInWindow(windowConfig -> {
		windowConfig.fullWidth();
		windowConfig.styleName("my-window-style");
	}); // <3>
	// end::nav3[]
}
 
開發者ID:holon-platform,項目名稱:holon-vaadin7,代碼行數:15,代碼來源:ExampleNavigator.java

示例9: obtain

import com.holonplatform.vaadin.navigator.ViewNavigator; //導入依賴的package包/類
public void obtain() {
	// tag::obtain[]
	Optional<ViewNavigator> navigator = ViewNavigator.getCurrent(); // <1>

	ViewNavigator viewNavigator = ViewNavigator.require(); // <2>
	// end::obtain[]
}
 
開發者ID:holon-platform,項目名稱:holon-vaadin7,代碼行數:8,代碼來源:ExampleNavigator.java

示例10: navigateTo

import com.holonplatform.vaadin.navigator.ViewNavigator; //導入依賴的package包/類
/**
 * Navigate to given navigation state
 * @param navigationState Navigation state
 */
public void navigateTo(String navigationState) {
	final Optional<ViewNavigator> previous = Context.get().threadScope()
			.flatMap(s -> s.get(ViewNavigator.CONTEXT_KEY, ViewNavigator.class));
	try {

		Context.get().threadScope().map(s -> s.put(ViewNavigator.CONTEXT_KEY, navigator));

		// check fallback to default
		if (isDefaultViewAvailable() && !isViewAvailable(navigationState)) {
			if (navigationState == null || navigationState.trim().equals("")
					|| isNavigateToDefaultViewWhenViewNotAvailable()) {
				navigateToDefault();
				return;
			}
		}

		// call default navigation method
		try {
			navigateToState(null, sanitizeNavigationState(navigationState));
		} catch (Exception e) {
			throw new ViewNavigationException(null, "Failed to navigate to state: [" + navigationState + "]", e);
		}

		// check navigation is not towards a Window
		if (!viewWindows.containsKey(navigationState)) {
			// close all current Views displayed in a Window
			closeAllViewWindows();
		}

		// track navigation state in history if current View is not volatile
		if (navigator.getCurrentView() != null && !isVolatile(navigator.getCurrentView(), navigationState)) {
			trackInHistory(navigationState);
		}

	} finally {
		Context.get().threadScope().map(s -> s.remove(ViewNavigator.CONTEXT_KEY));
		previous.ifPresent((n) -> Context.get().threadScope().map(s -> s.put(ViewNavigator.CONTEXT_KEY, n)));
	}
}
 
開發者ID:holon-platform,項目名稱:holon-vaadin7,代碼行數:44,代碼來源:NavigatorActuator.java

示例11: getViewNavigationState

import com.holonplatform.vaadin.navigator.ViewNavigator; //導入依賴的package包/類
/**
 * Get a view navigation state from redirect URI, if URI scheme is absent or is
 * {@link ViewNavigator#VIEW_URI_SCHEME}.
 * @param redirectURI Redirect URI
 * @return View navigation state
 */
private static String getViewNavigationState(String redirectURI) {
	if (redirectURI != null) {
		int schemeSeparator = redirectURI.indexOf("://");
		if (schemeSeparator < 0) {
			return redirectURI;
		}
		if (redirectURI.startsWith(ViewNavigator.VIEW_URI_SCHEME)) {
			return redirectURI.substring(ViewNavigator.VIEW_URI_SCHEME.length());
		}
	}
	return null;
}
 
開發者ID:holon-platform,項目名稱:holon-vaadin7,代碼行數:19,代碼來源:NavigatorActuator.java

示例12: getCurrentUIViewNavigator

import com.holonplatform.vaadin.navigator.ViewNavigator; //導入依賴的package包/類
/**
 * Try to obtain ViewNavigator from current thread-bound {@link UI}
 * @return If current {@link UI} is available and has a ViewNavigator setted, this one is retuned. Null otherwise.
 */
public static ViewNavigator getCurrentUIViewNavigator() {
	UI ui = UI.getCurrent();
	if (ui != null) {
		Navigator navigator = ui.getNavigator();
		if (navigator instanceof ViewNavigator) {
			return (ViewNavigator) navigator;
		}
	}
	return null;
}
 
開發者ID:holon-platform,項目名稱:holon-vaadin7,代碼行數:15,代碼來源:ViewNavigationUtils.java

示例13: DefaultNavigationBuilder

import com.holonplatform.vaadin.navigator.ViewNavigator; //導入依賴的package包/類
public DefaultNavigationBuilder(ViewNavigator navigator, String viewName) {
	super();

	ObjectUtils.argumentNotNull(navigator, "ViewNavigator must be not null");
	ObjectUtils.argumentNotNull(viewName, "View name must be not null");

	this.navigator = navigator;
	this.viewName = viewName;
	this.parameters = new HashMap<>(8);
}
 
開發者ID:holon-platform,項目名稱:holon-vaadin7,代碼行數:11,代碼來源:DefaultNavigationBuilder.java

示例14: save

import com.holonplatform.vaadin.navigator.ViewNavigator; //導入依賴的package包/類
@Transactional
private void save() {
	// check valid and get PropertyBox value
	form.getValueIfValid().ifPresent(value -> {

		// save and notify
		datastore.save(TARGET, value, DefaultWriteOption.BRING_BACK_GENERATED_IDS);
		// notify the saved id
		Notification.show("Saved [" + ((id != null) ? id : value.getValue(ID)) + "]");

		// go back home
		ViewNavigator.require().navigateToDefault();
	});

}
 
開發者ID:holon-platform,項目名稱:holon-examples,代碼行數:16,代碼來源:Manage.java

示例15: View

import com.holonplatform.vaadin.navigator.ViewNavigator; //導入依賴的package包/類
public View() {
	super();

	Components.configure(this)
			// set margins and size full to view content
			.margin().fullSize()
			// add view form using Product property set
			.addAndExpandFull(viewForm = Components.view.form().fullSize().properties(PRODUCT).build()).add(
					// horizontal layout as bottom toolbar
					Components.hl().fullWidth().spacing().styleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR)
							// EDIT action
							.add(Components.button().caption("Edit").fullWidth().styleName(ValoTheme.BUTTON_PRIMARY)
									// navigate to "manage" view providing product id parameter
									.onClick(e -> ViewNavigator.require().toView("manage").withParameter("id", id)
											.navigate())
									.build())
							// DELETE action
							.add(Components.button().caption("Delete").fullWidth()
									.styleName(ValoTheme.BUTTON_DANGER)
									// ask confirmation before delete
									.onClick(e -> Components.questionDialog().message("Are you sure?")
											.callback(answeredYes -> {
												// if confirmed, delete the current form product PropertyBox
												datastore.delete(TARGET, viewForm.getValue());
												// navigate back
												ViewNavigator.require().navigateBack();
											}).open())
									.build())
							.build());
}
 
開發者ID:holon-platform,項目名稱:holon-examples,代碼行數:31,代碼來源:View.java


注:本文中的com.holonplatform.vaadin.navigator.ViewNavigator類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。