Java Code Examples for org.apache.wicket.model.Model.of()

The following are Jave code examples for showing how to use of() of the org.apache.wicket.model.Model class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: vlo-curation   File: AllFacetValuesPage.java   View Source Code Vote up 7 votes
public AllFacetValuesPage(PageParameters params) {
    super(params);

    this.selectionModel = Model.of(parametersConverter.fromParameters(params));
    final StringValue facetValue = params.get(SELECTED_FACET_PARAM);
    if (facetValue.isEmpty()) {
        Session.get().error("No facet provided for all values page");
        throw new RestartResponseException(new FacetedSearchPage(selectionModel));
    }

    final String facet = facetParamMapper.getFacet(facetValue.toString());

    if (vloConfig.getFacetsInSearch().contains(facet)) {
        // create a new model so that all values will be retrieved
        setModel(new FacetFieldModel(facet, facetFieldsService, selectionModel)); // gets all facet values
    }
    if (getModelObject() == null) {
        Session.get().error(String.format("Facet '%s' could not be found", facet));
        ErrorPage.triggerErrorPage(ErrorPage.ErrorType.PAGE_NOT_FOUND, params);
    }

    addComponents();
}
 
Example 2
Project: gitplex-mit   File: UserSingleChoiceEditor.java   View Source Code Vote up 6 votes
@Override
protected void onInitialize() {
	super.onInitialize();

	User user;
	if (getModelObject() != null)
		user = GitPlex.getInstance(UserManager.class).findByName(getModelObject());
	else
		user = null;
	
	UserFacade facade = user!=null?user.getFacade():null;
   	input = new UserSingleChoice("input", Model.of(facade), new UserChoiceProvider(type));
       input.setConvertEmptyInputStringToNull(true);
       
       // add this to control allowClear flag of select2
   	input.setRequired(propertyDescriptor.isPropertyRequired());
       
       add(input);
}
 
Example 3
Project: Unicorn   File: SelectEntryPanel.java   View Source Code Vote up 6 votes
/**
 * Constructor for a checkbox inside of a form. The checkbox informs the
 * given {@link AbstractDataProvider} about ajax state changes.
 *
 * @param id
 * @param entryId
 * @param dataProvider
 */
public SelectEntryPanel(final String id, final int entryId, final AbstractDataProvider dataProvider) {
	super(id);
	final Form<Void> form = new Form<Void>("form");

	final CheckBox checkBox = new CheckBox("checkBoxID", Model.of(dataProvider.isEntrySelected(entryId)));
	checkBox.add(new AjaxFormComponentUpdatingBehavior("onchange") {

		private static final long serialVersionUID = 1L;

		@Override
		protected void onUpdate(final AjaxRequestTarget target) {
			if (dataProvider.isEntrySelected(entryId)) {
				dataProvider.deselectEntry(entryId);
			} else if (!dataProvider.isEntrySelected(entryId)) {
				dataProvider.selectEntry(entryId);
			}
		}
	});

	form.add(checkBox);

	this.add(form);
}
 
Example 4
Project: Unicorn   File: ProbabilityEntryPanel.java   View Source Code Vote up 6 votes
public ProbabilityEntryPanel(final String id, final int entryId, final SimulationTreeTableProvider<Object> simulationTreeTableProvider) {
	super(id);
	final Form<Void> form = new Form<Void>("form");

	this.textField = new TextField<String>("textFieldID", Model.of(simulationTreeTableProvider.getProbabilityForEntry(entryId)));
	this.textField.setOutputMarkupPlaceholderTag(true);
	this.textField.setOutputMarkupId(true);
	this.textField.add(new AjaxFormComponentUpdatingBehavior("onchange") {

		private static final long serialVersionUID = 1L;

		@Override
		protected void onUpdate(final AjaxRequestTarget target) {

			simulationTreeTableProvider.setProbabilityForEntry(ProbabilityEntryPanel.this.textField.getValue(), entryId);
		}
	});

	form.add(this.textField);

	this.add(form);
}
 
Example 5
Project: openNaEF   File: HistoryUtil.java   View Source Code Vote up 5 votes
public static ExternalLink createHistoryLink(NaefDto dto) {
    try {
        CoreConfiguration config = CoreConfiguration.getInstance();
        String url = config.getInventoryHistoryUrl() + (dto != null ? DtoUtil.getMvoId(dto).toString() : "");
        ExternalLink link = new ExternalLink("history", Model.of(url), Model.of("History"));
        link.setEnabled(dto != null);
        link.setVisible(dto != null);
        return link;
    } catch (Exception e) {
        throw ExceptionUtils.throwAsRuntime(e);
    }
}
 
Example 6
Project: openNaEF   File: HistoryUtil.java   View Source Code Vote up 5 votes
public static ExternalLink createHistoryLink(NaefDto dto, String label) {
    try {
        CoreConfiguration config = CoreConfiguration.getInstance();
        String url = config.getInventoryHistoryUrl() + (dto != null ? DtoUtil.getMvoId(dto).toString() : "");
        ExternalLink link = new ExternalLink("history", Model.of(url), Model.of(label));
        link.setEnabled(dto != null);
        link.setVisible(dto != null);
        return link;
    } catch (Exception e) {
        throw ExceptionUtils.throwAsRuntime(e);
    }
}
 
Example 7
Project: gitplex-mit   File: DatePropertyEditor.java   View Source Code Vote up 5 votes
@Override
protected void onInitialize() {
	super.onInitialize();
	
	DateTextFieldConfig config = new DateTextFieldConfig();
	config.autoClose(true);
	config.clearButton(true);
	config.withFormat(DateEditSupport.DATE_INPUT_FORMAT);
	input = new DateTextField("input", Model.of(getModelObject()), config);
	input.setType(getPropertyDescriptor().getPropertyClass());
	Method propertyGetter = getPropertyDescriptor().getPropertyGetter();
	if (propertyGetter.getAnnotation(OmitName.class) != null)
		input.add(AttributeModifier.replace("placeholder", EditableUtils.getName(propertyGetter)));
	
	add(input);

	add(new AttributeAppender("class", new LoadableDetachableModel<String>() {

		@Override
		protected String load() {
			if (hasErrors(true))
				return " has-error";
			else
				return "";
		}
		
	}));
}
 
Example 8
Project: gitplex-mit   File: ProjectSettingTab.java   View Source Code Vote up 5 votes
public ProjectSettingTab(String title, String iconClass,  
		Class<? extends ProjectSettingPage> mainPageClass, 
		Class<? extends ProjectSettingPage> additionalPageClass1, 
		Class<? extends ProjectSettingPage> additionalPageClass2,
		Class<? extends ProjectSettingPage> additionalPageClass3) {
	super(Model.of(title), mainPageClass, additionalPageClass1, additionalPageClass2, additionalPageClass3);
	this.iconClass = iconClass;
}
 
Example 9
Project: gitplex-mit   File: UserTab.java   View Source Code Vote up 5 votes
public UserTab(String title, String iconClass, Class<? extends UserPage> mainPageClass, 
		Class<? extends UserPage> additionalPageClass1, 
		Class<? extends UserPage> additionalPageClass2) {
	super(Model.of(title), mainPageClass, additionalPageClass1, additionalPageClass2);
	
	this.iconClass = iconClass;
}
 
Example 10
Project: vlo-curation   File: FacetFieldValuesProviderTest.java   View Source Code Vote up 5 votes
/**
 * Test of iterator method, of class FacetFieldValuesProvider.
 */
@Test
public void testIteratorNameOrderDescending() {
    final FacetFieldValuesProvider instance = new FacetFieldValuesProvider(Model.of(facetField), 10, LOW_PRIORITY_VALUES, new SortParam<FieldValuesOrder>(FieldValuesOrder.NAME, false), valueConverterProvider);

    final long first = 0;
    final long count = 100;
    final Iterator<? extends FacetField.Count> result = instance.iterator(first, count);

    //sorted by name (descending)
    assertTrue(result.hasNext());
    FacetField.Count valueCount = result.next();
    assertEquals("Xlow priority", valueCount.getName()); // priority only affects sort by count

    assertTrue(result.hasNext());
    valueCount = result.next();
    assertEquals("third value", valueCount.getName());

    assertTrue(result.hasNext());
    valueCount = result.next();
    assertEquals("second value*", valueCount.getName());

    assertTrue(result.hasNext());
    valueCount = result.next();
    assertEquals("FOURTH value", valueCount.getName()); // case insensitive sorting

    assertTrue(result.hasNext());
    valueCount = result.next();
    assertEquals("first value", valueCount.getName());

    assertFalse(result.hasNext());
}
 
Example 11
Project: vlo-curation   File: SimpleSearchPage.java   View Source Code Vote up 5 votes
public SimpleSearchPage(PageParameters parameters) {
    super(parameters, Model.of(true));
    
    //see if another page would be more suitable
    final Set<String> keys = parameters.getNamedKeys();
    if (keys.contains(DOCUMENT_ID)) {
        //document id -> redirect to record page
        setResponsePage(new RecordPage(parameters));
    } else if (keys.contains(QUERY) || keys.contains(FILTER_QUERY)) {
        //query or selection parameters -> redirect to non-simple page
        setResponsePage(new FacetedSearchPage(parameters));
    }
}
 
Example 12
Project: engerek   File: PageService.java   View Source Code Vote up 5 votes
@Override
protected AbstractObjectMainPanel<ServiceType> createMainPanel(String id) {
	return new AbstractRoleMainPanel<ServiceType>(id, getObjectModel(), getAssignmentsModel(), getPolicyRulesModel(),
			getProjectionModel(), getInducementsModel(), this) {
		private static final long serialVersionUID = 1L;

		@Override
		public AbstractRoleMemberPanel<ServiceType> createMemberPanel(String panelId) {
			return new ServiceMemberPanel(panelId, Model.of(getObject().asObjectable()), PageService.this);
		}
	};
}
 
Example 13
Project: karate   File: ProjectFolderTreeProvider.java   View Source Code Vote up 4 votes
@Override
public IModel<ProjectFolderTreeNode> model(ProjectFolderTreeNode object) {
    return Model.of(object);
}
 
Example 14
Project: gitplex-mit   File: TooltipBehavior.java   View Source Code Vote up 4 votes
public TooltipBehavior(final TooltipConfig config) {
	this(Model.of(""), config);
}
 
Example 15
Project: gitplex-mit   File: RequestOverviewPage.java   View Source Code Vote up 4 votes
private Component newActivityRow(String id, PullRequestActivity activity) {
	WebMarkupContainer row = new WebMarkupContainer(id, Model.of(activity)) {

		@Override
		public void onEvent(IEvent<?> event) {
			super.onEvent(event);
			
			if (event.getPayload() instanceof RequestCommentDeleted) {
				RequestCommentDeleted commentRemoved = (RequestCommentDeleted) event.getPayload();
				remove();
				commentRemoved.getHandler().appendJavaScript(String.format("$('#%s').remove();", getMarkupId()));
			} 
		}
		
	};
	row.setOutputMarkupId(true);
	String anchor = activity.getAnchor();
	if (anchor != null)
		row.setMarkupId(anchor);
	
	if (row.get("content") == null) 
		row.add(activity.render("content"));
	
	WebMarkupContainer avatarColumn = new WebMarkupContainer("avatar");
	row.add(avatarColumn);
	
	if (activity instanceof OpenedActivity) {
		row.add(AttributeAppender.append("class", " discussion"));
		PullRequest request = ((OpenedActivity)activity).getRequest();
		avatarColumn.add(new AvatarLink("avatar", 
				User.getForDisplay(request.getSubmitter(), request.getSubmitterName())));
	} else if (activity instanceof CommentedActivity) {
		row.add(AttributeAppender.append("class", " discussion"));
		PullRequestComment comment = ((CommentedActivity)activity).getComment();
		avatarColumn.add(new AvatarLink("avatar", User.getForDisplay(comment.getUser(), comment.getUserName())));
	} else {
		row.add(AttributeAppender.append("class", " non-discussion"));
		avatarColumn.add(new WebMarkupContainer("avatar"));
	}
	
	if (activity instanceof UpdatedActivity)
		row.add(AttributeAppender.append("class", " update"));
	else
		row.add(AttributeAppender.append("class", " non-update"));

	return row;
}
 
Example 16
Project: openNaEF   File: RsvpLspCreationPage.java   View Source Code Vote up 4 votes
public RsvpLspCreationPage(WebPage backPage, RsvpLspIdPoolDto pool) {
    try {
        this.editorName = AAAWebUtil.checkAAA(this, OPERATION_NAME);
        if (pool == null) {
            throw new IllegalArgumentException("pool is null.");
        }
        this.pool = pool;
        this.backPage = backPage;

        Form<Void> backForm = new Form<Void>("backForm");
        add(backForm);
        Button backButton = new Button("back") {
            private static final long serialVersionUID = 1L;

            @Override
            public void onSubmit() {
                setResponsePage(getBackPage());
            }
        };
        backForm.add(backButton);

        add(new FeedbackPanel("feedback"));

        Label nodeLabel = new Label("poolName", Model.of(pool.getName()));
        add(nodeLabel);

        Form<Void> form = new Form<Void>("form");
        add(form);

        Button proceedButton = new Button("proceed") {
            private static final long serialVersionUID = 1L;

            @Override
            public void onSubmit() {
                processCreate();
                RsvpLspDto published = RsvpLspUtil.getRsvpLsp(getPool(), getLspName());
                setResponsePage(new RsvpLspEditPage(getBackPage(), published, getIngress()));
            }
        };
        form.add(proceedButton);

        TextField<Integer> idField = new TextField<Integer>("lspName", new PropertyModel<Integer>(this, "name"));
        idField.setRequired(true);
        form.add(idField);

        MplsNmsInventoryConnector conn = MplsNmsInventoryConnector.getInstance();
        DropDownChoice<NodeDto> ingressList = new DropDownChoice<NodeDto>(
                "ingressNodes",
                new PropertyModel<NodeDto>(this, "ingress"),
                conn.getActiveNodes(),
                new ChoiceRenderer<NodeDto>("name"));
        ingressList.setRequired(true);
        form.add(ingressList);
    } catch (Exception e) {
        throw ExceptionUtils.throwAsRuntime(e);
    }
}
 
Example 17
Project: gitplex-mit   File: UserTab.java   View Source Code Vote up 4 votes
public UserTab(String title, String iconClass, Class<? extends UserPage> mainPageClass) {
	super(Model.of(title), mainPageClass);
	
	this.iconClass = iconClass;
}
 
Example 18
Project: gitplex-mit   File: UpdateChangesLink.java   View Source Code Vote up 4 votes
public IModel<?> getBody() {
	return Model.of("<i class='fa fa-ext fa-file-diff'></i>");
}
 
Example 19
Project: openNaEF   File: VlanCreationPage.java   View Source Code Vote up 4 votes
public VlanCreationPage(WebPage backPage, VlanIdPoolDto pool) {
    try {
        this.editorName = AAAWebUtil.checkAAA(this, OPERATION_NAME);
        if (pool == null) {
            throw new IllegalArgumentException("pool is null.");
        }
        this.pool = pool;
        this.backPage = backPage;

        Form<Void> backForm = new Form<Void>("backForm");
        add(backForm);
        Button backButton = new Button("back") {
            private static final long serialVersionUID = 1L;

            @Override
            public void onSubmit() {
                setResponsePage(getBackPage());
            }
        };
        backForm.add(backButton);

        add(new FeedbackPanel("feedback"));

        Label nodeLabel = new Label("poolName", Model.of(pool.getName()));
        add(nodeLabel);

        Form<Void> form = new Form<Void>("form");
        add(form);

        Button proceedButton = new Button("proceed") {
            private static final long serialVersionUID = 1L;

            @Override
            public void onSubmit() {
                processCreate();
                PageUtil.setModelChanged(getBackPage());
                setResponsePage(getBackPage());
            }
        };
        form.add(proceedButton);

        Map<Integer, Integer> ids = new HashMap<Integer, Integer>();
        for (IdRange<Integer> idRange : pool.getIdRanges()) {
            for (int i = idRange.lowerBound; i <= idRange.upperBound; i++) {
                ids.put(i, i);
            }
        }

        List<Integer> vlanIdList = new ArrayList<Integer>(new TreeSet<Integer>(ids.keySet()));
        DropDownChoice<Integer> vlanList = new DropDownChoice<Integer>(
                "vlanIds",
                new PropertyModel<Integer>(this, "vlanId"),
                vlanIdList);
        vlanList.setRequired(true);
        form.add(vlanList);
    } catch (Exception e) {
        throw ExceptionUtils.throwAsRuntime(e);
    }
}
 
Example 20
Project: openNaEF   File: AAAErrorPage.java   View Source Code Vote up 4 votes
public AAAErrorPage(String errorMessage) {
    Label label = new Label("errorMessage", Model.of(errorMessage));
    add(label);
}
 
Example 21
Project: gitplex-mit   File: GroupTab.java   View Source Code Vote up 4 votes
public GroupTab(String title, String iconClass, Class<? extends GroupPage> mainPageClass) {
	super(Model.of(title), mainPageClass);
	
	this.iconClass = iconClass;
}
 
Example 22
Project: gitplex-mit   File: UserTab.java   View Source Code Vote up 4 votes
public UserTab(String title, String iconClass, Class<? extends UserPage> mainPageClass, 
		Class<? extends UserPage> additionalPageClass1) {
	super(Model.of(title), mainPageClass, additionalPageClass1);
	
	this.iconClass = iconClass;
}
 
Example 23
Project: gitplex-mit   File: GroupTab.java   View Source Code Vote up 4 votes
public GroupTab(String title, String iconClass, Class<? extends GroupPage> mainPageClass, 
		Class<? extends GroupPage> additionalPageClass1) {
	super(Model.of(title), mainPageClass, additionalPageClass1);
	
	this.iconClass = iconClass;
}
 
Example 24
Project: openNaEF   File: SimpleNodeDetailPage.java   View Source Code Vote up 4 votes
private void populateSlotInfo(NodeDto node) {
    ListView<SlotDto> slotTable = new ListView<SlotDto>("slotTable", slotsModel) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<SlotDto> item) {
            final SlotDto slot = item.getModelObject();
            slot.renew();
            final ModuleDto module = slot.getModule();
            String endOfUseClass = null;
            if (NodeUtil.isEndOfUse(slot)) {
                endOfUseClass = "end-of-use";
            }
            AttributeAppender appender = new AttributeAppender("class", new Model<String>(endOfUseClass), " ");
            item.add(appender);

            Link<Void> editSlot = new Link<Void>("editSlot") {
                private static final long serialVersionUID = 1L;

                @Override
                public void onClick() {
                    setResponsePage(new SlotEditPage(SimpleNodeDetailPage.this, slot));
                }
            };
            item.add(editSlot);

            String slotId = NameUtil.getIfName(slot);
            editSlot.add(new Label("slotId", new Model<String>(slotId)));

            String slotType = HardwareRenderer.getSlotType(slot);
            item.add(new Label("slotType", new Model<String>(slotType)));

            String moduleName = HardwareRenderer.getModuleType(module);
            item.add(new Label("moduleName", new Model<String>(moduleName)));

            String operStatus = HardwareRenderer.getOperStatus(slot);
            item.add(new Label("operStatus", new Model<String>(operStatus)));

            String note = HardwareRenderer.getNote(slot);
            item.add(new Label("note", new Model<String>(note)));

            Label lastEditor = new Label("lastEditor", new Model<String>(HardwareRenderer.getLastEditor(slot)));
            item.add(lastEditor);
            Label lastEditTime = new Label("lastEditTime", new Model<String>(HardwareRenderer.getLastEditTime(slot)));
            item.add(lastEditTime);
            Label version = new Label("version", Model.of(HardwareRenderer.getVersion(slot)));
            item.add(version);

            Form<Void> deleteForm = new Form<Void>("removeModule");
            item.add(deleteForm);
            SubmitLink removeModuleLink = new SubmitLink("apply") {
                private static final long serialVersionUID = 1L;

                @Override
                public void onSubmit() {
                    ModuleRemovePage page = new ModuleRemovePage(SimpleNodeDetailPage.this, slot);
                    setResponsePage(page);
                }
            };
            removeModuleLink.setEnabled(slot.getModule() != null);
            removeModuleLink.setVisible(slot.getModule() != null);
            deleteForm.add(removeModuleLink);

            try {
                ExternalLink history = HistoryUtil.createHistoryLink(slot, "History");
                history.setEnabled(CoreConfiguration.getInstance().isDebug());
                history.setVisible(CoreConfiguration.getInstance().isDebug());
                item.add(history);
            } catch (Exception e) {
                throw ExceptionUtils.throwAsRuntime(e);
            }
        }
    };
    add(slotTable);
}
 
Example 25
Project: gitplex-mit   File: ProjectSettingTab.java   View Source Code Vote up 4 votes
public ProjectSettingTab(String title, String iconClass,
		Class<? extends ProjectSettingPage> mainPageClass, 
		Class<? extends ProjectSettingPage> additionalPageClass1) {
	super(Model.of(title), mainPageClass, additionalPageClass1);
	this.iconClass = iconClass;
}
 
Example 26
Project: openNaEF   File: VirtualPortCreationPage.java   View Source Code Vote up 4 votes
public VirtualPortCreationPage(WebPage backPage, final NodeDto node) {
    if (node == null) {
        throw new IllegalArgumentException("node is missing.");
    } else if (!NodeUtil.isVirtualNode(node)) {
        throw new IllegalArgumentException("This node isn't virtual node: " + node.getName());
    }
    try {
        this.editorName = AAAWebUtil.checkAAA(this, OPERATION_NAME);
        this.backPage = backPage;
        this.node = node;
        Label nodeNameLabel = new Label("nodeName", Model.of(this.node.getName()));
        add(nodeNameLabel);
        Form<Void> backForm = new Form<Void>("backForm");
        add(backForm);
        Button backButton = new Button("back") {
            private static final long serialVersionUID = 1L;

            @Override
            public void onSubmit() {
                setResponsePage(getBackPage());
            }
        };
        backForm.add(backButton);
        add(new FeedbackPanel("feedback"));
        this.form = new Form<Void>("editInterface");
        add(this.form);
        Button proceedButton = new Button("proceed") {
            private static final long serialVersionUID = 1L;

            @Override
            public void onSubmit() {
                processUpdate();
                PageUtil.setModelChanged(getBackPage());
                setResponsePage(getBackPage());
            }
        };
        form.add(proceedButton);

        TextField<String> ifNameField = new TextField<String>("ifName", new PropertyModel<String>(this, "ifName"));
        ifNameField.setRequired(true);
        this.form.add(ifNameField);
        List<PortType> portTypes = Arrays.asList(PortType.values());
        DropDownChoice<PortType> ifTypeField = new DropDownChoice<PortType>("ifType",
                new PropertyModel<PortType>(this, "ifType"),
                portTypes,
                new ChoiceRenderer<PortType>("caption"));
        ifTypeField.setRequired(true);
        this.form.add(ifTypeField);
    } catch (Exception e) {
        throw ExceptionUtils.throwAsRuntime(e);
    }
}
 
Example 27
Project: engerek   File: AbstractAssignmentDetailsPanel.java   View Source Code Vote up 4 votes
protected IModel<String> getAdditionalNameLabelStyleClass(){
    return Model.of("");
}
 
Example 28
Project: vlo-curation   File: BootstrapDropdown.java   View Source Code Vote up 4 votes
public BootstrapDropdown(String id, IModel<List<DropdownMenuItem>> itemsModel) {
    super(id, itemsModel);
    this.openStateModel = Model.of(false);
}
 
Example 29
Project: Unicorn   File: BPMNSimulationPanel.java   View Source Code Vote up 4 votes
public BPMNSimulationPanel(final String id, final AbstractEapPage abstractEapPage) {
	super(id, abstractEapPage);

	this.layoutForm = new Form("outerLayoutForm");

	this.processUploadPanel = new BPMNProcessUploadPanel("bpmnProcessUploadPanel", abstractEapPage);
	this.layoutForm.add(this.processUploadPanel);

	this.treeTableProvider = new SimulationTreeTableProvider<Object>();
	this.createTreeTable(this.layoutForm);

	this.addTabs();

	this.instanceNumberInput = new TextField<String>("instanceNumberInput", Model.of(""));
	this.layoutForm.add(this.instanceNumberInput);

	this.daysNumberInput = new TextField<String>("daysNumberInput", Model.of(""));
	this.layoutForm.add(this.daysNumberInput);

	final AjaxButton simulateButton = new BlockingAjaxButton("simulateButton", this.layoutForm) {

		private static final long serialVersionUID = 1L;

		@Override
		public void onSubmit(final AjaxRequestTarget target, final Form form) {
			super.onSubmit(target, form);
			final String instanceNumber = BPMNSimulationPanel.this.instanceNumberInput.getValue();
			int numberOfInstances;
			if (instanceNumber != null && !instanceNumber.isEmpty()) {
				numberOfInstances = Integer.parseInt(BPMNSimulationPanel.this.instanceNumberInput.getValue());
			} else {
				numberOfInstances = 1;
			}
			final CorrelationProcess process = CorrelationProcess.findByName(BPMNSimulationPanel.this.processUploadPanel.getSelectedProcessName()).get(0);
			final BPMNProcess model = process.getBpmnProcess();
			if (model == null) {
				abstractEapPage.getFeedbackPanel().error("No BPMN model found.");
				target.add(abstractEapPage.getFeedbackPanel());
			} else {
				if (!BPMNSimulationPanel.this.treeTableProvider.hasEmptyFields()) {
					final Map<TypeTreeNode, List<Serializable>> attributeValues = BPMNSimulationPanel.this.treeTableProvider.getAttributeValuesFromModel();
					final Map<AbstractBPMNElement, String> elementDurationStrings = BPMNSimulationPanel.this.treeTableProvider.getBPMNElementWithDuration();
					final Map<AbstractBPMNElement, DerivationType> elementDerivationTypes = BPMNSimulationPanel.this.treeTableProvider.getBPMNElementWithDerivationType();
					final Map<AbstractBPMNElement, String> elementDerivations = BPMNSimulationPanel.this.treeTableProvider.getBPMNElementWithDerivation();
					final Map<BPMNXORGateway, List<Tuple<AbstractBPMNElement, String>>> xorSplitsWithSuccessorProbabilityStrings = BPMNSimulationPanel.this.treeTableProvider.getXorSuccessorsWithProbability();
					final Map<BPMNXORGateway, List<Tuple<AbstractBPMNElement, Integer>>> xorSplitsWithSuccessorProbabilities = SimulationUtils.convertProbabilityStrings(xorSplitsWithSuccessorProbabilityStrings);

					final Simulator simulator = new Simulator(process, model, attributeValues, elementDurationStrings, elementDerivations, elementDerivationTypes, xorSplitsWithSuccessorProbabilities);
					simulator.simulate(numberOfInstances);
					abstractEapPage.getFeedbackPanel().success(numberOfInstances + " have been simulated over " + BPMNSimulationPanel.this.daysNumberInput.getValue() + " days.");
					target.add(abstractEapPage.getFeedbackPanel());
				} else {
					abstractEapPage.getFeedbackPanel().error("Please fill all attribute fields.");
					target.add(abstractEapPage.getFeedbackPanel());
				}

			}

		}
	};
	this.layoutForm.add(simulateButton);

	this.add(this.layoutForm);
	this.processUploadPanel.setSimulationPanel(this);
}
 
Example 30
Project: engerek   File: ObjectNameColumn.java   View Source Code Vote up 4 votes
public IModel<String> getDataModel(IModel<SelectableBean<O>> rowModel) {
	SelectableBean<O> selectableBean = rowModel.getObject();
	O value = selectableBean.getValue();
	return Model.of(value == null ? "" : WebComponentUtil.getName(value));
}
 
Example 31
Project: Unicorn   File: RegisterPage.java   View Source Code Vote up 4 votes
private void buildMainLayout() {
	this.layoutForm = new WarnOnExitForm("layoutForm");

	this.mailInput = new TextField<String>("mailInput", Model.of(""));
	this.layoutForm.add(this.mailInput);

	this.nameInput = new TextField<String>("nameInput", Model.of(""));
	this.layoutForm.add(this.nameInput);

	this.passwordInput = new PasswordTextField("passwordInput", Model.of(""));
	this.layoutForm.add(this.passwordInput);

	this.repeatPasswordInput = new PasswordTextField("repeatPasswordInput", Model.of(""));
	this.layoutForm.add(this.repeatPasswordInput);

	this.addRegisterButton();

	this.add(this.layoutForm);
}
 
Example 32
Project: Unicorn   File: ExistingEventTypeEditor.java   View Source Code Vote up 4 votes
private Component addEventTypeInput() {
	this.eventTypeInput = new TextField<String>("eventTypeInput", Model.of(""));
	this.eventTypeInput.setOutputMarkupId(true);
	return this.eventTypeInput;
}
 
Example 33
Project: vlo-curation   File: FacetedSearchPage.java   View Source Code Vote up 4 votes
public FacetedSearchPage(IModel<QueryFacetsSelection> queryModel) {
    this(queryModel, Model.of(false));
}
 
Example 34
Project: Unicorn   File: ProcessInstanceProvider.java   View Source Code Vote up 4 votes
@Override
public IModel<CorrelationProcessInstance> model(final CorrelationProcessInstance processInstance) {
	return Model.of(processInstance);
}
 
Example 35
Project: Unicorn   File: EapProvider.java   View Source Code Vote up 4 votes
@Override
public IModel<E> model(final E entity) {
	return Model.of(entity);
}
 
Example 36
Project: vlo-curation   File: BreadCrumbPanel.java   View Source Code Vote up 4 votes
public BreadCrumbPanel(String id, IModel<QueryFacetsSelection> selectionModel, String facet) {
    super(id, selectionModel);
    this.facetModel = Model.of(facet);
    this.documentModel = new Model<>(null);
}
 
Example 37
Project: vlo-curation   File: SearchContextModelTest.java   View Source Code Vote up 4 votes
@Before
public void setUp() {
    selection = new QueryFacetsSelection();
    instance = new SearchContextModel(index, resultCount, Model.of(selection));
}
 
Example 38
Project: vlo-curation   File: VloBasePage.java   View Source Code Vote up 2 votes
/**
 * Override to give the page a custom or dynamic page title
 *
 * @return string model that provides the page title
 */
public IModel<String> getTitleModel() {
    return Model.of(DEFAULT_PAGE_TITLE);
}
 
Example 39
Project: vlo-curation   File: DocumentFieldModel.java   View Source Code Vote up 2 votes
/**
 * Uses the document model to create a {@link SolrFieldModel} to provide the
 * field values
 *
 * @param documentModel model that provides the document
 * @param fieldName name of the field to represent
 */
public DocumentFieldModel(IModel<SolrDocument> documentModel, String fieldName) {
    this(new SolrFieldModel<T>(documentModel, fieldName), Model.of(fieldName));
}
 
Example 40
Project: vlo-curation   File: ExpandablePanel.java   View Source Code Vote up 2 votes
/**
 * Creates the panel with its own expansion state model which is closed
 * initially
 *
 * @param id component id
 * @param model core model of this panel
 */
public ExpandablePanel(String id, IModel<T> model) {
    this(id, model, Model.of(ExpansionState.COLLAPSED));
}