@Override protected void onInitialize() { ContentViewOrEditPanel contentViewOrEditPanel = new ContentViewOrEditPanel("contentViewOrEditPanel", (IModel<Product>) getDefaultModel()); SubCategoryViewOrEditPanel subCategoryViewOrEditPanel = new SubCategoryViewOrEditPanel( "subCategoryViewOrEditPanel", (IModel<Product>) getDefaultModel()); Form<Product> productEditForm = new Form<Product>("productEditForm"); productEditForm.setModel( new CompoundPropertyModel<Product>((IModel<Product>) getDefaultModel())); productEditForm.add(new TextField<String>("number")); productEditForm.add(new TextField<String>("name")); productEditForm.add(new TextArea<String>("description")); productEditForm.add( new UrlTextField(ITEM_URL, new PropertyModel<String>(getDefaultModelObject(), ITEM_URL))); productEditForm.add(new NumberTextField<Integer>("amount")); productEditForm.add(new NumberTextField<Integer>("discount")); productEditForm.add(new NumberTextField<Integer>("shippingCost")); productEditForm.add(new NumberTextField<Integer>("tax")); productEditForm.add(new NumberTextField<Integer>("itemHeight")); productEditForm.add(new TextField<String>("itemHeightUnit")); productEditForm.add(new NumberTextField<Integer>("itemLength")); productEditForm.add(new TextField<String>("itemLengthUnit")); productEditForm.add(new NumberTextField<Integer>("itemWeight")); productEditForm.add(new TextField<String>("itemWeightUnit")); productEditForm.add(new NumberTextField<Integer>("itemWidth")); productEditForm.add(new TextField<String>("itemWidthUnit")); productEditForm.add(new BootstrapCheckbox("bestsellers")); productEditForm.add(new BootstrapCheckbox("latestCollection")); productEditForm.add(new NumberTextField<Integer>("rating")); productEditForm.add(new BootstrapCheckbox("recommended")); productEditForm.add(new NumberTextField<Integer>("stock.maxQuantity")); productEditForm.add(new NumberTextField<Integer>("stock.minQuantity")); productEditForm.add(new NumberTextField<Integer>("stock.quantity")); add(productEditForm.setOutputMarkupId(true)); add( contentViewOrEditPanel .add(contentViewOrEditPanel.new ContentEditFragement()) .setOutputMarkupId(true)); add( subCategoryViewOrEditPanel .add(subCategoryViewOrEditPanel.new SubCategoryEditFragement()) .setOutputMarkupId(true)); add(new NotificationPanel("feedback").hideAfter(Duration.seconds(5)).setOutputMarkupId(true)); add(new CancelAjaxLink().setOutputMarkupId(true)); add(new SaveAjaxButton(productEditForm).setOutputMarkupId(true)); super.onInitialize(); }
@Override protected void onInitialize() { ContentViewOrEditPanel contentViewOrEditPanel = new ContentViewOrEditPanel("contentViewOrEditPanel", (IModel<Product>) getDefaultModel()); SubCategoryViewOrEditPanel subCategoryViewOrEditPanel = new SubCategoryViewOrEditPanel( "subCategoryViewOrEditPanel", (IModel<Product>) getDefaultModel()); Form<Product> productViewForm = new Form<Product>("productViewForm"); productViewForm.setModel( new CompoundPropertyModel<Product>((IModel<Product>) getDefaultModel())); productViewForm.add(new Label("number")); productViewForm.add(new Label("name")); productViewForm.add(new Label("description")); productViewForm.add(new Label(ITEM_URL)); productViewForm.add(new Label("amount")); productViewForm.add(new Label("discount")); productViewForm.add(new Label("shippingCost")); productViewForm.add(new Label("tax")); productViewForm.add(new Label("itemHeight")); productViewForm.add(new Label("itemHeightUnit")); productViewForm.add(new Label("itemLength")); productViewForm.add(new Label("itemLengthUnit")); productViewForm.add(new Label("itemWeight")); productViewForm.add(new Label("itemWeightUnit")); productViewForm.add(new Label("itemWidth")); productViewForm.add(new Label("itemWidthUnit")); productViewForm.add(new Label("bestsellers")); productViewForm.add(new Label("latestCollection")); productViewForm.add(new Label("rating")); productViewForm.add(new Label("recommended")); productViewForm.add(new Label("stock.maxQuantity")); productViewForm.add(new Label("stock.minQuantity")); productViewForm.add(new Label("stock.quantity")); add(new EditAjaxLink().setOutputMarkupId(true)); add(productViewForm.setOutputMarkupId(true)); add( contentViewOrEditPanel .add(contentViewOrEditPanel.new ContentViewFragement()) .setOutputMarkupId(true)); add( subCategoryViewOrEditPanel .add(subCategoryViewOrEditPanel.new SubCategoryViewFragement()) .setOutputMarkupId(true)); super.onInitialize(); }