本文整理匯總了Java中com.vaadin.navigator.ViewChangeListener.ViewChangeEvent類的典型用法代碼示例。如果您正苦於以下問題:Java ViewChangeEvent類的具體用法?Java ViewChangeEvent怎麽用?Java ViewChangeEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ViewChangeEvent類屬於com.vaadin.navigator.ViewChangeListener包,在下文中一共展示了ViewChangeEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fireViewOnShow
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; //導入依賴的package包/類
/**
* Fire {@link OnShow} view methods
* @param view View instance (not null)
* @param configuration View configuration (not null)
* @param event View change event
* @param refresh <code>true</code> if is a page refresh
* @throws ViewConfigurationException Error invoking view methods
*/
public static <E extends ViewChangeEvent & ViewNavigatorChangeEvent> void fireViewOnShow(View view,
ViewConfiguration configuration, E event, boolean refresh) throws ViewConfigurationException {
if (view == null) {
throw new ViewConfigurationException("Null view instance");
}
if (configuration == null) {
throw new ViewConfigurationException("Missing view configuration");
}
for (Method method : configuration.getOnShowMethods()) {
if (!refresh || configuration.isFireOnRefresh(method)) {
try {
if (method.getParameterCount() == 0) {
method.invoke(view, new Object[0]);
} else {
method.invoke(view, new Object[] { event });
}
} catch (Exception e) {
throw new ViewConfigurationException("Failed to fire OnShow method " + method.getName()
+ " on view class " + view.getClass().getName(), e);
}
}
}
}
示例2: fireViewOnLeave
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; //導入依賴的package包/類
/**
* Fire {@link OnLeave} view methods
* @param view View instance (not null)
* @param configuration View configuration (not null)
* @param event View change event
* @throws ViewConfigurationException Error invoking view methods
*/
public static <E extends ViewChangeEvent & ViewNavigatorChangeEvent> void fireViewOnLeave(View view,
ViewConfiguration configuration, E event) throws ViewConfigurationException {
if (view == null) {
throw new ViewConfigurationException("Null view instance");
}
if (configuration == null) {
throw new ViewConfigurationException("Missing view configuration");
}
for (Method method : configuration.getOnLeaveMethods()) {
try {
if (method.getParameterCount() == 0) {
method.invoke(view, new Object[0]);
} else {
method.invoke(view, new Object[] { event });
}
} catch (Exception e) {
throw new ViewConfigurationException("Failed to fire OnLeave method " + method.getName()
+ " on view class " + view.getClass().getName(), e);
}
}
}
示例3: checkViewOnShowOrLeaveMethod
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; //導入依賴的package包/類
/**
* Check given method has a valid signature for {@link OnShow} or {@link OnLeave} view method
* @param viewClass View class
* @param method Method to check
* @param message Error message annotation description
* @throws ViewConfigurationException Method is not valid
*/
private static void checkViewOnShowOrLeaveMethod(Class<?> viewClass, Method method, String message)
throws ViewConfigurationException {
if (method.getReturnType() != Void.class && method.getReturnType() != Void.TYPE) {
throw new ViewConfigurationException("Invalid " + message + " method in view class " + viewClass.getName()
+ ": method must be a void return method");
}
int params = method.getParameterCount();
if (params > 1) {
throw new ViewConfigurationException("Invalid " + message + " method in view class " + viewClass.getName()
+ ": method must have no parameters or only one parameter of type ViewChangeEvent");
}
if (params == 1) {
Parameter param = method.getParameters()[0];
if (param.isVarArgs() || !(ViewChangeEvent.class.isAssignableFrom(param.getType())
|| ViewNavigatorChangeEvent.class.isAssignableFrom(param.getType()))) {
throw new ViewConfigurationException(
"Invalid " + message + " method in view class " + viewClass.getName()
+ ": method must have no parameters or only one parameter of type ViewChangeEvent");
}
}
}
示例4: enter
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; //導入依賴的package包/類
@Override
public void enter(ViewChangeEvent event) {
pageHelper.setErrorHandler(this);
this.removeAllComponents();
// Get application
int appId = Integer.parseInt(event.getParameters());
Application app = pageHelper.getApp(appId);
// Header
this.addComponent(new PageHeader(app, "Endpoints"));
// Add endpoints links
app.endpoints().asList().stream()
.forEach(endpointUrl -> this.addComponent(new Link(endpointUrl+".json", new ExternalResource(endpointUrl+".json"), "_blank", 0, 0, BorderStyle.DEFAULT)));
}
示例5: fireViewOnLeave
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; //導入依賴的package包/類
/**
* Fire {@link OnLeave} view methods
* @param <E> Actual event type
* @param view View instance (not null)
* @param configuration View configuration (not null)
* @param event View change event
* @throws ViewConfigurationException Error invoking view methods
*/
public static <E extends ViewChangeEvent & ViewNavigatorChangeEvent> void fireViewOnLeave(View view,
ViewConfiguration configuration, E event) throws ViewConfigurationException {
if (view == null) {
throw new ViewConfigurationException("Null view instance");
}
if (configuration == null) {
throw new ViewConfigurationException("Missing view configuration");
}
for (Method method : configuration.getOnLeaveMethods()) {
try {
if (method.getParameterCount() == 0) {
method.invoke(view, new Object[0]);
} else {
method.invoke(view, new Object[] { event });
}
} catch (Exception e) {
throw new ViewConfigurationException("Failed to fire OnLeave method " + method.getName()
+ " on view class " + view.getClass().getName(), e);
}
}
}
示例6: enter
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; //導入依賴的package包/類
/**
* @see com.vaadin.navigator.View#enter(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent)
*/
@Override
public void enter(ViewChangeEvent event) {
cptMin = candidatController.getCompteMinima();
if (cptMin==null){
return;
}
String lockError = candidatController.getLockError(cptMin, ConstanteUtils.LOCK_ODF);
if (lockError!=null){
isLocked = true;
lockLabel.setVisible(true);
return;
}
lockLabel.setVisible(false);
isLocked = false;
}
示例7: enter
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; //導入依賴的package包/類
/**
* @see com.vaadin.navigator.View#enter(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent)
*/
@Override
public void enter(ViewChangeEvent event) {
userController.validSecurityUserCptMin();
restResultParam = event.getParameters();
if (restResultParam==null || restResultParam.equals("") || restResultParam.equals(ConstanteUtils.REST_VALID_ERROR)){
restResultParam = ConstanteUtils.REST_VALID_ERROR;
}
if (userController.isCandidat() && (restResultParam.equals(ConstanteUtils.REST_VALID_ALREADY_VALID) || restResultParam.equals(ConstanteUtils.REST_VALID_SUCCESS))){
connexionLayout.setVisible(false);
((MainUI) UI.getCurrent()).constructMainMenu();
}else if (restResultParam.equals(ConstanteUtils.REST_VALID_ALREADY_VALID) || restResultParam.equals(ConstanteUtils.REST_VALID_SUCCESS)){
connexionLayout.setVisible(true);
}else{
connexionLayout.setVisible(false);
}
updateLangue(cacheController.getLangueDefault());
}
示例8: enter
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; //導入依賴的package包/類
@Override
public void enter(ViewChangeEvent event) {
// set the view form product value
viewForm.setValue(
// load product using id parameter
datastore.query().target(DataTarget.named("products")).filter(MProduct.ID.eq(id))
.findOne(MProduct.PRODUCT)
// throw an exception if not found
.orElseThrow(() -> new DataAccessException("Product not found: " + id)));
}
示例9: preAfterViewChange
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; //導入依賴的package包/類
public void preAfterViewChange(ViewChangeEvent event) {
// fire OnShow on new view
if (event.getNewView() != null) {
ViewConfiguration configuration = getViewConfiguration(event.getNewView().getClass());
if (configuration != null) {
ViewNavigationUtils.fireViewOnShow(event.getNewView(), configuration,
DefaultViewNavigatorChangeEvent.create(event, previousViewName, navigator,
getViewWindow(buildNavigationState(event.getViewName(), event.getParameters()))),
false);
} else {
LOGGER.warn("Failed to obtain ViewConfiguration for view class " + event.getOldView().getClass()
+ ": OnShow methods firing skipped");
}
}
}
示例10: preAfterViewChange
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; //導入依賴的package包/類
public void preAfterViewChange(ViewChangeEvent event) {
// fire OnShow on new view
if (event.getNewView() != null) {
ViewConfiguration configuration = getViewConfiguration(event.getNewView().getClass());
if (configuration != null) {
ViewNavigationUtils.fireViewOnShow(event.getNewView(), configuration,
DefaultViewNavigatorChangeEvent.create(event, navigator,
getViewWindow(buildNavigationState(event.getViewName(), event.getParameters()))),
false);
} else {
LOGGER.warn("Failed to obtain ViewConfiguration for view class " + event.getOldView().getClass()
+ ": OnShow methods firing skipped");
}
}
}
示例11: enter
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; //導入依賴的package包/類
/**
* @see com.vaadin.navigator.View#enter(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent)
*/
@Override
public void enter(ViewChangeEvent event) {
if (majView(applicationContext.getMessage("stage.title", null, UI.getCurrent().getLocale()), true, ConstanteUtils.LOCK_STAGE)){
majComponents();
}
}
示例12: enter
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; //導入依賴的package包/類
/**
* @see com.vaadin.navigator.View#enter(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent)
*/
@Override
public void enter(ViewChangeEvent event) {
if (majView(applicationContext.getMessage("infoperso.title", null, UI.getCurrent().getLocale()), false, ConstanteUtils.LOCK_INFOS_PERSO)){
majComponentsInfoPerso(candidat);
}
if (isLectureSeule || isArchive){
changeContactBtn.setVisible(false);
}
}
示例13: enter
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; //導入依賴的package包/類
/**
* @see com.vaadin.navigator.View#enter(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent)
*/
@Override
public void enter(ViewChangeEvent event) {
Authentication auth = userController.getCurrentAuthentication();
setTxtMessageAccueil(auth);
refreshLayoutConnexion(auth);
}
示例14: enter
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; //導入依賴的package包/類
/**
* @see com.vaadin.navigator.View#enter(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent)
*/
@Override
public void enter(ViewChangeEvent event) {
if (majView(applicationContext.getMessage("formationpro.title", null, UI.getCurrent().getLocale()), true, ConstanteUtils.LOCK_FORMATION_PRO)){
majComponents();
}
}
示例15: enter
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; //導入依賴的package包/類
/**
* @see com.vaadin.navigator.View#enter(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent)
*/
@Override
public void enter(ViewChangeEvent event) {
String title;
if(parametreController.getIsGetCursusInterne()){
title = applicationContext.getMessage("cursusexterne.title", null, UI.getCurrent().getLocale());
}else{
title = applicationContext.getMessage("cursusexterne.title.withoutCursusInterne", null, UI.getCurrent().getLocale());
}
if (majView(title, true, ConstanteUtils.LOCK_CURSUS_EXTERNE)){
majComponentsPostBac(candidat.getCandidatCursusPostBacs());
}
}