Java Code Examples for org.apache.wicket.markup.html.panel.Panel

The following are top voted examples for showing how to use org.apache.wicket.markup.html.panel.Panel. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: vlo-curation   File: FacetedSearchPage.java   View source code 6 votes vote down vote up
private Panel createSearchForm(String id) {
    final SearchFormPanel form = new SearchFormPanel(id, getModel()) {

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            // reset expansion state of search results
            searchResultsPanel.resetExpansion();

            //transition from simple
            if (simpleModeModel.getObject()) {
                simpleModeModel.setObject(false);
                if (target != null) {
                    target.prependJavaScript("cb|transitionFromSimple(cb);");
                    target.add(searchContainer); //update everything within container
                }
            }

            updateSelection(target);
        }

    };
    form.setOutputMarkupId(true);
    return form;
}
 
Example 2
Project: Unicorn   File: FilesPanel.java   View source code 6 votes vote down vote up
private void addScenarioTabs() {
	tabs = new ArrayList<ITab>();

	// tabs.add(new AbstractTab(new Model<String>("GET Scenario 3")) {
	// @Override
	// public Panel getPanel(final String panelId) {
	// return new Scenario3Panel(panelId, panel);
	// }
	// });

	final Map<String, List<ReplayFileBean>> fileBeans = ReplayerContainer.getFileBeans();

	for (final String category : fileBeans.keySet()) {
		tabs.add(new AbstractTab(new Model<String>(category)) {
			@Override
			public Panel getPanel(final String panelId) {
				return new CategoryPanel(panelId, panel, category, fileBeans.get(category));
			}
		});
	}

	this.layoutForm.addOrReplace(new Collapsible("collapsible", tabs, Model.of(-1)));
}
 
Example 3
Project: invesdwin-nowicket   File: ModelTab.java   View source code 6 votes vote down vote up
@Override
public WebMarkupContainer getPanel(final String containerId) {
    final Object modelValue = panelModel.getObject();
    final Panel panel = PanelFactory.get().getPanel(containerId, modelValue);
    final Boolean behaviorAdded = panel.getMetaData(KEY_DISABLED_BEHAVIOR_ADDED);
    if (behaviorAdded == null || !behaviorAdded) {
        panel.setMetaData(KEY_DISABLED_BEHAVIOR_ADDED, true);
        panel.add(new Behavior() {
            @Override
            public void onConfigure(final Component component) {
                super.onConfigure(component);
                component.setEnabled(ModelTab.this.isEnabled());
            }
        });
    } else {
        throw new IllegalStateException(
                "KEY_DISABLED_BEHAVIOR_ADDED not expected, since panels are normally not cached!");
    }
    return panel;
}
 
Example 4
Project: invesdwin-nowicket   File: ShowModalPanelGuiTask.java   View source code 6 votes vote down vote up
@Override
public void process(final Component component) {
    Assertions.assertThat(isShowing()).isFalse();
    final Panel modalPanel = PanelFactory.get().getPanel(ModalContainer.PANEL_MARKUP_ID, modelObject);
    if (modal == null) {
        final HtmlContext parentContext = HtmlContext.get(component);
        if (parentContext != null) {
            modal = parentContext.getComponentRegistry().getComponent(ModalHtmlElement.WICKET_ID);
        }
    }
    if (modal == null) {
        modal = Components.findComponent(ModalContainer.class, component);
    }
    if (modal == null) {
        //use root modal
        modal = Components.findComponent(ModalContainer.class, component.getPage());
    }
    Assertions.assertThat(modal).as("No %s found in component hierarchy!", ModalContainer.class).isNotNull();
    final IModel<String> title = getTitle(modalPanel);
    modal.show(title, modalPanel, dimension);
}
 
Example 5
Project: artifactory   File: BuildBrowserRootPage.java   View source code 6 votes vote down vote up
/**
 * Returns the module-specific tabbed panel to display
 *
 * @param forcedModule ID module to display instead of a one that might be specified in the parameters
 * @return Module specific tabbed panel
 */
private Panel getModuleSpecificTabbedPanel(String forcedModule) {
    String buildName = getBuildName();
    String buildNumber = getBuildNumber();
    String buildStarted = null;
    String moduleId;

    /**
     * If the forced module is specified, it means that the user entered a request with a module id, but no build
     * started parameter
     */
    if (StringUtils.isNotBlank(forcedModule)) {
        moduleId = forcedModule;
    } else {
        //Normal request from artifactory, containing all needed parameters
        buildStarted = getStringParameter(BUILD_STARTED);
        moduleId = getModuleId();
    }
    Build build = getBuild(buildName, buildNumber, buildStarted);
    Module module = getModule(build, moduleId);
    pageParameters.set(BUILD_STARTED, buildStarted);
    pageParameters.set(MODULE_ID, moduleId);
    return new BuildTabbedPanel(CHILD_PANEL_ID, build, module);
}
 
Example 6
Project: sakai   File: ViewFriends.java   View source code 6 votes vote down vote up
public ViewFriends(final String userUuid) {
	
	log.debug("ViewFriends()");
	
	//get user viewing this page
	final String currentUserUuid = sakaiProxy.getCurrentUserId();
			
	//check person viewing this page (currentuserId) is allowed to view userId's friends - unless admin
	if(!sakaiProxy.isSuperUser()){
		boolean isFriendsListVisible = privacyLogic.isActionAllowed(userUuid, currentUserUuid, PrivacyType.PRIVACY_OPTION_MYFRIENDS);
		if(!isFriendsListVisible) {
			throw new ProfileFriendsIllegalAccessException("User: " + currentUserUuid + " is not allowed to view the friends list for: " + userUuid);
		}
	}
	
	//show confirmed friends panel for the given user
	Panel confirmedFriends = new ConfirmedFriends("confirmedFriends", userUuid);
	confirmedFriends.setOutputMarkupId(true);
	add(confirmedFriends);
	
	//post view event
	sakaiProxy.postEvent(ProfileConstants.EVENT_FRIENDS_VIEW_OTHER, "/profile/"+userUuid, false);
	
}
 
Example 7
Project: u-qasar.platform   File: WidgetAction.java   View source code 6 votes vote down vote up
@Override
public AbstractLink getLink(String id) {
	return new AjaxLink<Void>(id) {

		private static final long serialVersionUID = 1L;

		@Override
		public void onClick(AjaxRequestTarget target) {
			if (widget.hasSettings()) {
				WidgetPanel widgetPanel = findParent(WidgetPanel.class);
				Panel settingsPanel = widgetPanel.getSettingsPanel();
				settingsPanel.setVisible(true);
				target.add(settingsPanel);
			}
		}
		
	};
}
 
Example 8
Project: syncope   File: SchemasPanel.java   View source code 6 votes vote down vote up
private List<ITab> buildTabList() {

        final List<ITab> tabs = new ArrayList<>();

        for (final SchemaType schemaType : SchemaType.values()) {
            tabs.add(new AbstractTab(new Model<>(schemaType.name())) {

                private static final long serialVersionUID = 1037272333056449378L;

                @Override
                public Panel getPanel(final String panelId) {
                    return new SchemaTypePanel(panelId, schemaType, pageReference);
                }
            });
        }
        return tabs;
    }
 
Example 9
Project: syncope   File: AnyDirectoryPanel.java   View source code 6 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
protected Panel customResultBody(final String panelId, final AnyWrapper<A> item, final Serializable result) {
    if (!(result instanceof ProvisioningResult)) {
        throw new IllegalStateException("Unsupported result type");
    }

    return new StatusPanel(
            panelId,
            ((ProvisioningResult<A>) result).getEntity(),
            new ListModel<>(new ArrayList<>()),
            ((ProvisioningResult<A>) result).getPropagationStatuses().stream().
                    map(input -> {
                        ConnObjectTO before = input.getBeforeObj();
                        ConnObjectWrapper afterObjWrapper = new ConnObjectWrapper(
                                ((ProvisioningResult<A>) result).getEntity(),
                                input.getResource(),
                                input.getAfterObj());
                        return Pair.of(before, afterObjWrapper);
                    }).collect(Collectors.toList()),
            pageRef);
}
 
Example 10
Project: syncope   File: ConnObjectPanel.java   View source code 6 votes vote down vote up
/**
 * Get panel for attribute value (not remote status).
 *
 * @param id component id to be replaced with the fragment content.
 * @param attrTO remote attribute.
 * @return fragment.
 */
private Panel getValuePanel(final String id, final String schemaName, final AttrTO attrTO) {
    Panel field;
    if (attrTO == null) {
        field = new AjaxTextFieldPanel(id, schemaName, new Model<>());
    } else if (CollectionUtils.isEmpty(attrTO.getValues())) {
        field = new AjaxTextFieldPanel(id, schemaName, new Model<>());
    } else if (ConnIdSpecialName.PASSWORD.equals(schemaName)) {
        field = new AjaxTextFieldPanel(id, schemaName, new Model<>("********"));
    } else if (attrTO.getValues().size() == 1) {
        field = new AjaxTextFieldPanel(id, schemaName, new Model<>(attrTO.getValues().get(0)));
    } else {
        field = new MultiFieldPanel.Builder<>(new ListModel<>(attrTO.getValues())).build(
                id,
                schemaName,
                new AjaxTextFieldPanel("panel", schemaName, new Model<>()));
    }

    field.setEnabled(false);
    return field;
}
 
Example 11
Project: syncope   File: RoleWizardBuilder.java   View source code 6 votes vote down vote up
public Details(final RoleWrapper modelObject) {
    add(new AjaxTextFieldPanel(
            "key", "key", new PropertyModel<>(modelObject.getInnerObject(), "key"), false).
            setEnabled(StringUtils.isEmpty(modelObject.getInnerObject().getKey())));

    // ------------------------
    // dynMembershipCond
    // ------------------------
    add(new Accordion("dynMembershipCond", Collections.<ITab>singletonList(
            new AbstractTab(new ResourceModel("dynMembershipCond", "Dynamic USER Membership Conditions")) {

        private static final long serialVersionUID = 1037272333056449378L;

        @Override
        public Panel getPanel(final String panelId) {
            return new UserSearchPanel.Builder(
                    new PropertyModel<>(modelObject, "dynClauses")).
                    required(true).build(panelId);
        }
    }), Model.of(StringUtils.isBlank(modelObject.getDynMembershipCond()) ? -1 : 0)).setOutputMarkupId(true));
    // ------------------------
}
 
Example 12
Project: panelized   File: ActionsColumn.java   View source code 6 votes vote down vote up
/**
 * Adds the given action. If the action is a panel, it is added as a child
 * to this container.
 */
public ActionsColumn<T> addAction(DataTableAction<T> action) {

    if (accessController == null) {
        throw new RuntimeException("You must set the access controller on the data table before adding actions");
    }

    if (accessController.canAccess(action.getClass())) {
        actions.add(action);
    }

    if (action instanceof Panel) {
        dataTablePanel.addPanel((Panel) action);
    }

    return this;
}
 
Example 13
Project: sakai   File: ViewFriends.java   View source code 6 votes vote down vote up
public ViewFriends(final String userUuid) {
	
	log.debug("ViewFriends()");
	
	//get user viewing this page
	final String currentUserUuid = sakaiProxy.getCurrentUserId();
			
	//check person viewing this page (currentuserId) is allowed to view userId's friends - unless admin
	if(!sakaiProxy.isSuperUser()){
		boolean isFriendsListVisible = privacyLogic.isActionAllowed(userUuid, currentUserUuid, PrivacyType.PRIVACY_OPTION_MYFRIENDS);
		if(!isFriendsListVisible) {
			throw new ProfileFriendsIllegalAccessException("User: " + currentUserUuid + " is not allowed to view the friends list for: " + userUuid);
		}
	}
	
	//show confirmed friends panel for the given user
	Panel confirmedFriends = new ConfirmedFriends("confirmedFriends", userUuid);
	confirmedFriends.setOutputMarkupId(true);
	add(confirmedFriends);
	
	//post view event
	sakaiProxy.postEvent(ProfileConstants.EVENT_FRIENDS_VIEW_OTHER, "/profile/"+userUuid, false);
	
}
 
Example 14
Project: nextreports-server   File: UpdateActionLink.java   View source code 6 votes vote down vote up
public void executeAction(AjaxRequestTarget target) {
    Entity entity = getActionContext().getEntity();
    try {
        Report report = (Report) entity;
        Panel workPanel;
        if (ReportConstants.NEXT.equals(report.getType())) {
            workPanel = new UploadNextReportPanel("work", report);
            //setResponsePage(new UploadNextReportPage(report));
        } else {
            workPanel = new UploadJasperReportPanel("work", report);
            //setResponsePage(new UploadJasperReportPage(report));
        }

        EntityBrowserPanel panel = findParent(EntityBrowserPanel.class);
        panel.forwardWorkspace(workPanel, target);

    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 15
Project: nextreports-server   File: StackPanel.java   View source code 6 votes vote down vote up
public void forwardWorkspace(Panel panel, AjaxRequestTarget target) {
    if (stack.size() > STACK_MAX_SIZE) {
        // clear all
        stack.pop();
        while (stack.size() > 1) {
            stack.pop();
        }
    }

    panel.setOutputMarkupId(true);
    workContainer.replace(panel);
    stack.push(panel);

    if (target != null) {
        target.add(workContainer);
    }
}
 
Example 16
Project: nextreports-server   File: SettingsTab.java   View source code 6 votes vote down vote up
public Panel getPanel(String panelId) {
	if (type == GENERAL_SETTINGS) {
		return new GeneralSettingsPanel("panel");
	} else if (type == DISTRIBUTION_SETTINGS) {
		return new DistributionSettingsPanel("panel");	
	} else if (type == JASPER_SETTINGS) {
		return new JasperSettingsPanel("panel");
	} else if (type == LOOK_SETTINGS) {
		return new ChangeLogoPanel("panel");
	} else if (type == SYNCHRONIZER_SETTINGS) {
		return new SynchronizerSettingsPanel("panel");
	} else if (type == THREAD_POOL_SETTINGS) {
		return new SchedulerSettingsPanel("panel");
	} else if (type == IFRAME_SETTINGS) {
		return new IFrameSettingsPanel("panel");
	} else if (type == INTEGRATION_SETTINGS) {
		return new IntegrationSettingsPanel("panel");
	} else if (type == HISTORY_SETTINGS) {			
		return new CleanHistorySettingsPanel("panel");
	} else {			
		return new GeneralSettingsPanel("panel");
	}
}
 
Example 17
Project: nextreports-server   File: HomePage.java   View source code 6 votes vote down vote up
private void onSlidebarClick(AjaxRequestTarget target, String sectionId) {
    String oldSectionId = sectionManager.getSelectedSectionId();
    Section section = sectionManager.getSection(sectionId);
    sectionManager.setSelectedSectionId(sectionId);
    Panel newPanel = section.createView("sectionPanel");
    newPanel.setOutputMarkupId(true);
    sectionPanel.replaceWith(newPanel);
    target.add(newPanel);
    sectionPanel = newPanel;

    // close slidebar
    target.appendJavaScript("closeSlidebar();");

    // refresh active class
    ListView<String> view = (ListView<String>) get("section");
    Iterator<Component> it= view.iterator();
    while (it.hasNext()) {
        ListItem<String> item = (ListItem<String>) it.next();
        String itemId = item.getModelObject();
        if (itemId.equals(sectionId) || itemId.equals(oldSectionId)) {
            target.add(item);
        }
    }
}
 
Example 18
Project: gitplex-mit   File: BlobDiffPanel.java   View source code 5 votes vote down vote up
private void showBlob(Blob blob) {
	if (blob.getText() != null) {
		if (blob.getText().getLines().size() > DiffUtils.MAX_DIFF_SIZE) {
			add(newFragment("Unable to diff as the file is too large.", true));
		} else if (change.getAdditions()+change.getDeletions() > WebConstants.MAX_SINGLE_FILE_DIFF_LINES) {
			add(newFragment("Diff is too large to be displayed.", true));
		} else if (change.getDiffBlocks().isEmpty()) {
			if (change.getNewBlobIdent().path != null)
				add(newFragment("Empty file added.", false));
			else
				add(newFragment("Empty file removed.", false));
		} else {
			add(new TextDiffPanel(CONTENT_ID, projectModel, requestModel, change, diffMode, blameModel, markSupport));
		}
	} else if (blob.isPartial()) {
		add(newFragment("File is too large to be loaded.", true));
	} else {
		Panel diffPanel = null;
		for (DiffRenderer renderer: GitPlex.getExtensions(DiffRenderer.class)) {
			diffPanel = renderer.render(CONTENT_ID, blob.getMediaType(), change);
			if (diffPanel != null)
				break;
		}
		if (diffPanel != null)
			add(diffPanel);
		else
			add(newFragment("Binary file.", false));
	}
}
 
Example 19
Project: gitplex-mit   File: BlobDiffPanel.java   View source code 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	
	if (change.getType() == ChangeType.ADD || change.getType() == ChangeType.COPY) {
		showBlob(change.getNewBlob());
	} else if (change.getType() == ChangeType.DELETE) {
		showBlob(change.getOldBlob());
	} else {
		if (change.getOldText() != null && change.getNewText() != null) {
			if (change.getOldText().getLines().size() + change.getNewText().getLines().size() > DiffUtils.MAX_DIFF_SIZE) {
				add(newFragment("Unable to diff as the file is too large.", true));
			} else if (change.getAdditions() + change.getDeletions() > WebConstants.MAX_SINGLE_FILE_DIFF_LINES) {
				add(newFragment("Diff is too large to be displayed.", true));
			} else if (change.getAdditions() + change.getDeletions() == 0 
					&& (markSupport == null || markSupport.getComments().isEmpty())) {
				add(newFragment("Content is identical", false));
			} else {
				add(new TextDiffPanel(CONTENT_ID, projectModel, requestModel, change, diffMode, blameModel, markSupport));
			}
		} else if (change.getOldBlob().isPartial() || change.getNewBlob().isPartial()) {
			add(newFragment("File is too large to be loaded.", true));
		} else if (change.getOldBlob().getMediaType().equals(change.getNewBlob().getMediaType())) {
			Panel diffPanel = null;
			for (DiffRenderer renderer: GitPlex.getExtensions(DiffRenderer.class)) {
				diffPanel = renderer.render(CONTENT_ID, change.getNewBlob().getMediaType(), change);
				if (diffPanel != null)
					break;
			}
			if (diffPanel != null)
				add(diffPanel);
			else
				add(newFragment("Binary file.", false));
		} else {
			add(newFragment("Binary file.", false));
		}
	}
}
 
Example 20
Project: gitplex-mit   File: ImageDiffRenderer.java   View source code 5 votes vote down vote up
@Override
public Panel render(String panelId, MediaType mediaType, BlobChange change) {
	if (mediaType.getType().equalsIgnoreCase("image"))
		return new ImageDiffPanel(panelId, change);
	else
		return null;
}
 
Example 21
Project: gitplex-mit   File: OpenedActivity.java   View source code 5 votes vote down vote up
@Override
public Panel render(String panelId) {
	return new OpenedPanel(panelId, new LoadableDetachableModel<PullRequest>() {

		@Override
		protected PullRequest load() {
			return getRequest();
		}
		
	});
}
 
Example 22
Project: gitplex-mit   File: ReferencedActivity.java   View source code 5 votes vote down vote up
@Override
public Panel render(String panelId) {
	return new ReferencedPanel(panelId, new LoadableDetachableModel<PullRequestReference>() {

		@Override
		protected PullRequestReference load() {
			return getReference();
		}
		
	});
}
 
Example 23
Project: gitplex-mit   File: CommentedActivity.java   View source code 5 votes vote down vote up
@Override
public Panel render(String panelId) {
	return new CommentedPanel(panelId, new LoadableDetachableModel<PullRequestComment>() {

		@Override
		protected PullRequestComment load() {
			return getComment();
		}
		
	});
}
 
Example 24
Project: gitplex-mit   File: StatusChangeActivity.java   View source code 5 votes vote down vote up
@Override
public Panel render(String panelId) {
	return new StatusChangePanel(panelId, new LoadableDetachableModel<PullRequestStatusChange>() {

		@Override
		protected PullRequestStatusChange load() {
			return getStatusChange();
		}
		
	});
}
 
Example 25
Project: gitplex-mit   File: UpdatedActivity.java   View source code 5 votes vote down vote up
@Override
public Panel render(String panelId) {
	return new UpdatedPanel(panelId, new LoadableDetachableModel<PullRequestUpdate>() {

		@Override
		protected PullRequestUpdate load() {
			return getUpdate();
		}
		
	});
}
 
Example 26
Project: engerek   File: PageOrgTree.java   View source code 5 votes vote down vote up
private void initLayout() {
  	AbstractOrgTabPanel tabbedPanel = new AbstractOrgTabPanel(ID_ORG_PANEL, this) {
	private static final long serialVersionUID = 1L;

	@Override
	protected Panel createTreePanel(String id, Model<String> model, PageBase pageBase) {
		return new TreeTablePanel(id, model, PageOrgTree.this);
	}
};

      tabbedPanel.setOutputMarkupId(true);
      add(tabbedPanel);
  }
 
Example 27
Project: engerek   File: HandlerPanelFactory.java   View source code 5 votes vote down vote up
public Panel createPanelForTask(String id, IModel<? extends HandlerDto> handlerDtoModel, PageTaskEdit parentPage) {
	HandlerDto handlerDto = handlerDtoModel.getObject();
	for (Map.Entry<Class<? extends HandlerDto>, Class<? extends Panel>> entry : panelsForHandlers.entrySet()) {
		//System.out.println("Checking " + entry.getKey());
		if (entry.getKey().isAssignableFrom(handlerDto.getClass())) {
			LOGGER.trace("Using {} for {}", entry.getValue(), entry.getKey());
			return instantiate(entry.getValue(), id, handlerDtoModel, parentPage);
		}
	}
	throw new IllegalStateException("No panel for " + handlerDto.getClass());
}
 
Example 28
Project: vlo-curation   File: FacetedSearchPage.java   View source code 5 votes vote down vote up
private Panel createOptionsPanel(String id) {
    final Panel panel = new AdvancedSearchOptionsPanel(id, getModel()) {

        @Override
        protected void selectionChanged(AjaxRequestTarget target) {
            updateSelection(target);
        }
    };
    panel.setOutputMarkupId(true);
    return panel;
}
 
Example 29
Project: vlo-curation   File: FacetedSearchPage.java   View source code 5 votes vote down vote up
private Panel createAvailabilityPanel(String id) {
    final Panel availabilityPanel = new AvailabilityFacetPanel(id, getModel(), fieldsModel) {

        @Override
        protected void selectionChanged(AjaxRequestTarget target) {
            updateSelection(target);
        }
    };
    availabilityPanel.setOutputMarkupId(true);
    return availabilityPanel;
}
 
Example 30
Project: vlo-curation   File: FacetedSearchPage.java   View source code 5 votes vote down vote up
private Panel createFacetsPanel(final String id) {

        final FacetsPanel panel = new FacetsPanel(id, facetNamesModel, fieldsModel, getModel()) {

            @Override
            protected void selectionChanged(AjaxRequestTarget target) {
                updateSelection(target);
            }

        };
        panel.setOutputMarkupId(true);
        return panel;
    }
 
Example 31
Project: Unicorn   File: SimpleSimulationPanel.java   View source code 5 votes vote down vote up
@Override
protected void addUnexpectedEventPanel(final List<ITab> tabs) {

	tabs.add(new AbstractTab(new Model<String>("Unexpected Events (instance-dependent)")) {

		@Override
		public Panel getPanel(final String panelId) {
			SimpleSimulationPanel.this.unexpectedEventPanel = new UnexpectedEventPanel(panelId, SimpleSimulationPanel.this.simulationPanel);
			return SimpleSimulationPanel.this.unexpectedEventPanel;
		}
	});

}
 
Example 32
Project: Unicorn   File: SimulationPanel.java   View source code 5 votes vote down vote up
private void addAdvancedValuesPanel(final List<ITab> tabs) {
	tabs.add(new AbstractTab(new Model<String>("Advanced values for attributes")) {

		@Override
		public Panel getPanel(final String panelId) {
			SimulationPanel.this.advancedValuesPanel = new AdvancedValuesPanel(panelId, SimulationPanel.this.simulationPanel);
			return SimulationPanel.this.advancedValuesPanel;
		}
	});
}
 
Example 33
Project: Unicorn   File: SimulationPanel.java   View source code 5 votes vote down vote up
protected void addIndependentUnexpectedEventPanel(final List<ITab> tabs) {
	tabs.add(new AbstractTab(new Model<String>("Unexpected Events (instance-independent)")) {

		@Override
		public Panel getPanel(final String panelId) {
			SimulationPanel.this.independentUnexpectedEventPanel = new IndependentUnexpectedEventPanel(panelId);
			return SimulationPanel.this.independentUnexpectedEventPanel;
		}
	});

}
 
Example 34
Project: Unicorn   File: BPMNSimulationPanel.java   View source code 5 votes vote down vote up
@Override
protected void addUnexpectedEventPanel(final List<ITab> tabs) {
	tabs.add(new AbstractTab(new Model<String>("Unexpected Events (instance-dependent)")) {

		@Override
		public Panel getPanel(final String panelId) {
			BPMNSimulationPanel.this.unexpectedEventPanel = new BPMNSimUnexpectedEventPanel(panelId, BPMNSimulationPanel.this.simulationPanel);
			return BPMNSimulationPanel.this.unexpectedEventPanel;
		}
	});

}
 
Example 35
Project: invesdwin-nowicket   File: PanelFactory.java   View source code 5 votes vote down vote up
public Panel getPanel(final String wicketId, final Object modelObject) {
    final Class<Panel> panelClass = findPanelClass(modelObject.getClass());
    Assertions.assertThat(panelClass)
            .as("Unable to find any %s for model class [%s] or any of its super classes!", PANEL_CLASS_MODEL_SUFFIX,
                    modelObject.getClass().getName())
            .isNotNull();
    return tryIModelConstructor(wicketId, modelObject, panelClass);
}
 
Example 36
Project: invesdwin-nowicket   File: PanelFactory.java   View source code 5 votes vote down vote up
private Panel tryNoModelConstructor(final String wicketId, final Object modelObject, final Class<Panel> panelClass,
        final Exception parentE) {
    try {
        final Constructor<Panel> constructor = panelClass.getConstructor(String.class, modelObject.getClass());
        return constructor.newInstance(wicketId, modelObject);
    } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
            | IllegalArgumentException | InvocationTargetException e) {
        LOG.catching(parentE);
        throw new RuntimeException(e);
    }
}
 
Example 37
Project: invesdwin-nowicket   File: PanelFactory.java   View source code 5 votes vote down vote up
public Class<Panel> findPanelClass(final Object modelObject) {
    if (modelObject == null) {
        return null;
    } else {
        return findPanelClass(modelObject.getClass());
    }
}
 
Example 38
Project: invesdwin-nowicket   File: PanelFactory.java   View source code 5 votes vote down vote up
public Class<Panel> findPanelClass(final Class<?> modelClass) {
    if (modelClass == null) {
        return null;
    }
    try {
        String relModelPath = modelClass.getName();
        final String modelNameSuffix = ModelClassContext.extractModelNameSuffix(modelClass);
        if (Strings.isNotBlank(modelNameSuffix)) {
            relModelPath = Strings.removeEnd(relModelPath, modelNameSuffix);
        }
        return (Class<Panel>) Class.forName(relModelPath + PANEL_CLASS_MODEL_SUFFIX);
    } catch (final ClassNotFoundException e) {
        return findPanelClass(modelClass.getSuperclass());
    }
}
 
Example 39
Project: invesdwin-nowicket   File: HtmlContext.java   View source code 5 votes vote down vote up
private IllegalStateException newHtmlContextAlreadyPresentException(final MarkupContainer markupContainer) {
    return new IllegalStateException(HtmlContext.class.getSimpleName() + " is already present on "
            + MarkupContainer.class.getSimpleName() + " [" + markupContainer.getClass().getSimpleName()
            + "]. Did you call " + GeneratedBinding.class.getSimpleName() + " twice? " //
            + "\nIf it was called by a base class, please consider that this framework can only generate the binding once per "
            + MarkupContainer.class.getSimpleName() + ". "
            + "\nPlease favor composition over inheritance to achieve your desired code reuse scenario using wicket "
            + Panel.class.getSimpleName() + "s. " //
            + "\nJust ensure that in an inheritance hierarchy, the " + GeneratedBinding.class.getSimpleName()
            + " is executed only once. " //
            + "\nWorst case, just bind a generated " + Panel.class.getSimpleName()
            + " manually in your base class, so you can run the " + GeneratedBinding.class.getSimpleName()
            + " in the outer most class without conflicts.");
}
 
Example 40
Project: invesdwin-nowicket   File: ShowModalPanelGuiTask.java   View source code 5 votes vote down vote up
private IModel<String> getTitle(final Panel modalPanel) {
    final HtmlContext modalContext = HtmlContext.get(modalPanel);
    if (modalContext != null) {
        final RootHtmlElement modalRootElement = modalContext.getElementRegistry()
                .getElement(RootHtmlElement.WICKET_ID);
        return modalRootElement.getTitleModel();
    } else if (modalPanel.getDefaultModelObject() != null) {
        return Model.of(Objects.toVisibleName(modalPanel.getDefaultModelObject().getClass().getName()));
    } else {
        return Model.of(Objects.toVisibleName(modalPanel.getClass().getName()));
    }
}