I suggest you use a profiler. Profiler4j or jProfiler. and find out the reason!
** Martin 2009/8/13 Mostafa Mohamed <es.most...@gmail.com>: > Hi, > > We're working on a wicket/spring/hibernate webapp (research > repository) and today i was working on an 'Add Publication Panel'. i > added some > validation today but whenever i click on the link that shows the panel > in the main content area it takes like 10/15 seconds to show it. > Tomcat > doesn't show any errors and everything is working. here's my Add > Publication Panel. i have no idea as to what could be causing this. > > here's my panel's .java > > public class AddPublicationPanel extends BasicPanel { > > �...@springbean > private IBrowseService browseService; > �...@springbean > private IAddEditService addEditService; > > �...@springbean > private IBook book; > �...@springbean > private IConferencePaper conferencePaper; > �...@springbean > private ITechnicalReport technicalReport; > �...@springbean > private IWorkshop workshop; > �...@springbean > private IArticle article; > �...@springbean > private IBookChapter bookChapter; > �...@springbean(name = "book") > private IPublication publication; > > private List<Short> year; > private List<Byte> month; > > private Form form; > private WebMarkupContainer detailsBook, detailsConferencePaper, > detailsTechnicalReport, detailsWorkshop, detailsArticle, > detailsBookChapter, detailsCurrent; > private AjaxFallbackLink addAuthor, removeAuthor; > > private AutoCompleteTextFieldUser[] authors; > > public AddPublicationPanel() { > super("block", "Add Publication"); > > initLists(); > initCommon(); > initDetails(); > > } > > private void initCommon() { > add(new FeedbackPanel("feedback")); > add(form = new Form("form", new CompoundPropertyModel( > publication)) { > protected void onSubmit() { > switch (publication.getPublicationType()) { > case BOOK: > break; > case BOOK_CHAPTER: > break; > case ARTICLE: > break; > case CONFERENCE_PAPER: > break; > case WORKSHOP: > break; > case TECHNICAL_REPORT: > break; > } > } > }); > // title > form.add(new TextField("title").setRequired(true).add( > StringValidator.maximumLength(128))); > // year > form.add(new DropDownChoice("year", year)); > // month > form.add(new DropDownChoice("month", month, new ChoiceRenderer() { > �...@override > public Object getDisplayValue(Object object) { > return (new DateFormatSymbols().getMonths())[((Byte) object) > .intValue()]; > } > })); > // abstractText > form.add(new TextArea("abstractText").add(StringValidator > .maximumLength(2048))); // > required?????????????????????????????? > // reproducible > form.add(new CheckBox("reproducible")); > // passwordProtected > form.add(new CheckBox("passwordProtected")); > // keywords > form.add(new TextField("keywords").add( > new PatternValidator("(\\s*\\w+\\s*,*\\s*)*,*\\s*")).add( > StringValidator.maximumLength(2048))); > > // authors (internal & external) > authors = new AutoCompleteTextFieldUser[10]; > for (int i = 0; i < 10; i++) > // use model to set authors (internal & external) > // later***************** > form.add((authors[i] = new AutoCompleteTextFieldUser("author" + i)) > .setVisible(false).setOutputMarkupId(true) > .setOutputMarkupPlaceholderTag(true)); > authors[0].setRequired(true).setVisible(true); > > form.add((addAuthor = (new AjaxFallbackLink("add") { > > �...@override > public void onClick(AjaxRequestTarget target) { > > int pointer; > for (pointer = 0; pointer < 10; pointer++) { > if (!authors[pointer].isVisible()) { > break; > } > } > if (pointer < 10) { > authors[pointer].setVisible(true); > if (pointer == 9) > this.setVisible(false); > if (pointer > 0) > removeAuthor.setVisible(true); > > if (target != null) { > target.addComponent(authors[pointer]); > target.addComponent(removeAuthor); > target.addComponent(this); > } > } > > } > > })).setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true)); > form.add((removeAuthor = (new AjaxFallbackLink("remove") { > > �...@override > public void onClick(AjaxRequestTarget target) { > > int pointer; > for (pointer = 0; pointer < 10; pointer++) { > if (!authors[pointer].isVisible()) { > break; > } > } > pointer--; > if (pointer > 0) > authors[pointer].setVisible(false); > if (pointer == 1) > this.setVisible(false); > if (pointer <= 9) > addAuthor.setVisible(true); > > if (target != null) { > target.addComponent(authors[pointer]); > target.addComponent(addAuthor); > target.addComponent(this); > } > > } > })).setVisible(false).setOutputMarkupId(true) > .setOutputMarkupPlaceholderTag(true)); > > // departments > form.add(new ListMultipleChoice("departments", > new LoadableDetachableModel() { > > �...@override > protected Object load() { > > return browseService.findAllDepartments(); > } > > }, new ChoiceRenderer("name", "id")).setRequired(true)); > > // publicationType > form.add((new DropDownChoice("publicationType", Arrays > .asList(PublicationType.values()), new ChoiceRenderer( > "displayName", "id")).setRequired(true)) > .add(new AjaxFormComponentUpdatingBehavior("onchange") { > > �...@override > protected void onUpdate(AjaxRequestTarget target) { > target.addComponent(detailsArticle); > target.addComponent(detailsBook); > target.addComponent(detailsBookChapter); > target.addComponent(detailsConferencePaper); > target.addComponent(detailsTechnicalReport); > target.addComponent(detailsWorkshop); > > if (publication.getPublicationType() == null) { > detailsCurrent.setVisible(false); > } else { > if (publication.getPublicationType().getId() == 0) > { > replaceDetails(detailsArticle).setModel( > new CompoundPropertyModel(article)); > publication = article; > } else { > if > (publication.getPublicationType().getId() == 1) { > replaceDetails(detailsBook).setModel( > new CompoundPropertyModel(book)); > publication = book; > } else { > if (publication.getPublicationType() > .getId() == 2) { > replaceDetails(detailsBookChapter) > .setModel( > new > CompoundPropertyModel( > bookChapter)); > publication = bookChapter; > > } else { > if (publication.getPublicationType() > .getId() == 3) { > replaceDetails( > detailsConferencePaper) > .setModel( > new > CompoundPropertyModel( > > conferencePaper)); > publication = conferencePaper; > > } else { > if (publication > .getPublicationType() > .getId() == 4) { > replaceDetails( > detailsTechnicalReport) > .setModel( > new > CompoundPropertyModel( > > technicalReport)); > publication = technicalReport; > > } else { > if (publication > .getPublicationType() > .getId() == 5) { > replaceDetails( > detailsWorkshop) > .setModel( > > new CompoundPropertyModel( > > workshop)); > publication = workshop; > > } > } > } > } > } > } > } > > } > })); > > // clear button > form.add((new AjaxFallbackButton("clear", form) { > �...@override > protected void onSubmit(AjaxRequestTarget target, Form form) { > form.clearInput(); > > if (target != null) > target.addComponent(form); > } > }).setDefaultFormProcessing(false)); > } > > private void initDetails() { > // article > (detailsArticle = new WebMarkupContainer("detailsArticle")).setVisible( > false).setOutputMarkupId(true).setOutputMarkupPlaceholderTag( > true); > detailsArticle > .add( > new TextField("journalName").setRequired(true).add( > StringValidator.maximumLength(128))) > .add( > new TextField("volume").add(NumberValidator.range(0, > Short.MAX_VALUE))) > .add( > new TextField("issue").add(NumberValidator.range(0, > Long.MAX_VALUE))) > .add( > new TextField("pages") > .add(StringValidator.maximumLength(64)) > .add( > new PatternValidator( > > "(\\s*\\d+\\s*((\\s*-\\s*\\d+)?\\s*[,;]?\\s*))*"))); > > // book > (detailsBook = new WebMarkupContainer("detailsBook")).setVisible(false) > .setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true); > detailsBook.add( > new TextField("ISBN").setRequired(true).add( > StringValidator.lengthBetween(10, 13))) > .add( > new TextField("series").add(StringValidator > .maximumLength(128))).add( > new TextField("edition").add(StringValidator > .maximumLength(64))).add( > new TextField("volume").add(NumberValidator.range(0, > Short.MAX_VALUE))).add( > new TextField("publisher.name").setRequired(true).add( > StringValidator.maximumLength(128))).add( > new TextField("publisher.address").add(StringValidator > .maximumLength(128))); > > // book chapter > (detailsBookChapter = new WebMarkupContainer("detailsBookChapter")) > .setVisible(false).setOutputMarkupId(true) > .setOutputMarkupPlaceholderTag(true); > detailsBookChapter > .add( > new TextField("bookISBN").setRequired(true).add( > StringValidator.lengthBetween(10, 13))) > .add( > new TextField("bookTitle").setRequired(true).add( > StringValidator.maximumLength(128))) > .add( > new TextField("series").add(StringValidator > .maximumLength(128))) > .add( > new TextField("edition").add(StringValidator > .maximumLength(64))) > .add( > new TextField("volume").add( > NumberValidator.range(0, 32767)).setType( > Short.class)) > .add( > new TextField("pages") > .setRequired(true) > .add(StringValidator.maximumLength(64)) > .add( > new PatternValidator( > > "(\\s*\\d+\\s*((\\s*-\\s*\\d+)?\\s*[,;]?\\s*))*"))) > .add( > new TextField("publisher.name").setRequired(true).add( > StringValidator.maximumLength(128))).add( > new TextField("publisher.address").add(StringValidator > .maximumLength(128))); > > // conference paper > (detailsConferencePaper = new WebMarkupContainer( > "detailsConferencePaper")).setVisible(false).setOutputMarkupId( > true).setOutputMarkupPlaceholderTag(true); > detailsConferencePaper > .add( > new TextField("conferenceBookTitle").setRequired(true) > .add(StringValidator.maximumLength(128))) > .add( > new TextField("conferenceAddress").add(StringValidator > .maximumLength(128))) > .add( > new TextField("pages") > .add(StringValidator.maximumLength(64)) > .add( > new PatternValidator( > > "(\\s*\\d+\\s*((\\s*-\\s*\\d+)?\\s*[,;]?\\s*))*"))) > .add( > new TextField("editors").add(StringValidator > .maximumLength(256))).add( > new TextField("sponsors").add(StringValidator > .maximumLength(512))).add( > new TextField("publisher.address").add(StringValidator > .maximumLength(128))).add( > new TextField("publisher.name").setRequired(true).add( > StringValidator.maximumLength(128))); > > // technical report > (detailsTechnicalReport = new WebMarkupContainer( > "detailsTechnicalReport")).setVisible(false).setOutputMarkupId( > true).setOutputMarkupPlaceholderTag(true); > detailsTechnicalReport.add( > new DropDownChoice("type", Arrays.asList(TechnicalReportType > .values()), new ChoiceRenderer("displayName", "id"))) > .add( > new TextField("institution").setRequired(true).add( > StringValidator.maximumLength(128))).add( > new TextField("institutionAddress").add(StringValidator > .maximumLength(128))); > // setting the default value of the technical report type to > // PRIMARY_RESEARCH > technicalReport.setType(TechnicalReportType.PRIMARY_RESEARCH); > > // workshop > (detailsWorkshop = new WebMarkupContainer("detailsWorkshop")) > .setVisible(false).setOutputMarkupId(true) > .setOutputMarkupPlaceholderTag(true); > detailsWorkshop.add( > new TextField("workshopTitle").setRequired(true).add( > StringValidator.maximumLength(128))).add( > new TextField("workshopNumber").add(NumberValidator.range(0, > Long.MAX_VALUE))).add( > new TextField("workshopAddress").add(StringValidator > .maximumLength(128))); > > detailsCurrent = detailsBook; > > form.add(detailsArticle).add(detailsBook).add(detailsBookChapter).add( > detailsConferencePaper).add(detailsConferencePaper).add( > detailsTechnicalReport).add(detailsWorkshop); > } > > private void initLists() { > // years > year = new ArrayList<Short>(); > for (short i = (short) > Calendar.getInstance().get(Calendar.YEAR); i >= 1950; i--) { > year.add(new Short(i)); > } > // setting the default value of year to current year > publication.setYear(new Short((short) Calendar.getInstance().get( > Calendar.YEAR))); > > // months > month = new ArrayList<Byte>(); > for (byte i = 0; i < 12; i++) { > month.add(new Byte((byte) i)); > } > } > > private Form replaceDetails(WebMarkupContainer replacement) { > detailsCurrent.setVisible(false); > (detailsCurrent = replacement).setVisible(true); > return form; > } > } > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >