org.apache.wicket.model.ResourceModel Java Examples

The following examples show how to use org.apache.wicket.model.ResourceModel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SignInPage.java    From ontopia with Apache License 2.0 7 votes vote down vote up
public SignInPage(PageParameters params) {
super(params);
    
add(new StartPageHeaderPanel("header"));
add(new FooterPanel("footer"));

   add(new Label("title", new ResourceModel("page.title.signin")));

   add(new Label("message", new AbstractReadOnlyModel<String>() {
       @Override
       public String getObject() {
         OntopolySession session = (OntopolySession)Session.findOrCreate();
         return session.getSignInMessage();
       }
     }));
   add(new SignInForm("form"));
 }
 
Example #2
Source File: StudentCourseGradeStatisticsPanel.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public void onInitialize() {
	super.onInitialize();

	final String siteId = ((Model<String>) getDefaultModel()).getObject();

	StudentCourseGradeStatisticsPanel.this.window.setTitle(new ResourceModel("label.statistics.title.coursegrade"));

	final CourseGradeChart chart = new CourseGradeChart("chart", siteId, studentGrade);
	add(chart);

	add(new GbAjaxLink<Void>("done") {
		private static final long serialVersionUID = 1L;

		@Override
		public void onClick(final AjaxRequestTarget target) {
			StudentCourseGradeStatisticsPanel.this.window.close(target);
		}
	});
}
 
Example #3
Source File: AssociationTransformFunctionBoxPanel.java    From ontopia with Apache License 2.0 6 votes vote down vote up
public AssociationTransformFunctionBoxPanel(String id, final TopicModel<Topic> topicModel) {
  super(id);
  add(new Label("title", new ResourceModel("transform.association.instances")));   
  
  Button addButton = new Button("button", new ResourceModel("transform"));
  addButton.add(new AjaxFormComponentUpdatingBehavior("onclick") {
    @Override
    protected void onUpdate(AjaxRequestTarget target) {
      Topic instance = topicModel.getTopic();
      Map<String,String> pageParametersMap = new HashMap<String,String>();
      pageParametersMap.put("topicMapId", instance.getTopicMap().getId());
      pageParametersMap.put("topicId", instance.getId());
      setResponsePage(AssociationTransformPage.class, new PageParameters(pageParametersMap));
    }          
  });
  add(addButton);
}
 
Example #4
Source File: StartWidgetView.java    From openmeetings with Apache License 2.0 6 votes vote down vote up
@Override
protected void onInitialize() {
	add(new WebMarkupContainer("step1").add(new PublicRoomsEventBehavior()));
	add(new WebMarkupContainer("step2").add(new PublicRoomsEventBehavior()));
	add(new WebMarkupContainer("step3").add(new WebMarkupContainer("avTest").add(AttributeModifier.append("href"
			, RequestCycle.get().urlFor(HashPage.class, new PageParameters().add(APP, APP_TYPE_SETTINGS)).toString()))));

	add(new WebMarkupContainer("step4").add(new PublicRoomsEventBehavior()));
	add(new Label("123msg", Application.getString("widget.start.desc")) //Application here is used to substitute {0}
			.setEscapeModelStrings(false));
	add(new BootstrapButton("start", new ResourceModel("788"), Buttons.Type.Outline_Primary).add(new PublicRoomsEventBehavior()));
	add(new BootstrapButton("calendar", new ResourceModel("291"), Buttons.Type.Outline_Primary).add(new AjaxEventBehavior(EVT_CLICK) {
		private static final long serialVersionUID = 1L;

		@Override
		protected void onEvent(AjaxRequestTarget target) {
			((MainPage)getPage()).updateContents(CALENDAR, target);
		}
	}));
	super.onInitialize();
}
 
Example #5
Source File: EventDetailDialog.java    From openmeetings with Apache License 2.0 6 votes vote down vote up
@Override
protected void onInitialize() {
	header(new ResourceModel("815"));
	setCloseOnEscapeKey(false);
	setBackdrop(Backdrop.FALSE);
	size(Size.Small);
	show(true);

	super.onInitialize();
	add(new Label("title"));
	add(new Label("description").setEscapeModelStrings(false));
	add(new Label("owner.timeZoneId"));
	add(new Label("start", getDateFormat().format(getModelObject().getStart())));
	add(new Label("end", getDateFormat().format(getModelObject().getEnd())));
	add(new Label("owner.firstname"));
	add(new Label("owner.lastname"));
	addButton(OmModalCloseButton.of());
}
 
Example #6
Source File: MyPictures.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
private void createGalleryForm(final String userUuid, long pageToDisplay) {

		Label galleryHeading = new Label("galleryHeading", new ResourceModel(
				"heading.pictures.my.pictures"));
		add(galleryHeading);

		Form galleryForm = new Form("galleryForm");
		galleryForm.setOutputMarkupId(true);

		populateGallery(galleryForm, userUuid, pageToDisplay);
		add(galleryForm);

		Label addPictureHeading = new Label("addPictureHeading",
				new ResourceModel("heading.pictures.addpicture"));
		add(addPictureHeading);
	}
 
Example #7
Source File: VizigatorLinkFunctionBoxPanel.java    From ontopia with Apache License 2.0 6 votes vote down vote up
@Override
protected Component getLink(String id) {
  PageParameters pageParameters = new PageParameters();
  pageParameters.put("topicMapId", getTopicMapId());
  pageParameters.put("topicId", getTopicId());
  
  return new BookmarkablePageLink<Page>(id, VizigatorPage.class, pageParameters) {
    @Override
    protected void onComponentTag(ComponentTag tag) {
      tag.setName("a");
      //tag.put("target", "_blank");
      super.onComponentTag(tag);
    }
    @Override
    protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
      replaceComponentTagBody(markupStream, openTag, new ResourceModel("vizigator.text2").getObject().toString());
    }
  };
}
 
Example #8
Source File: ConvertingErrorsDialog.java    From openmeetings with Apache License 2.0 6 votes vote down vote up
@Override
public Modal<BaseFileItem> show(IPartialPageRequestHandler handler) {
	BaseFileItem f = getModelObject();
	headerLabel.setDefaultModel(new ResourceModel(f.getType() == BaseFileItem.Type.RECORDING ? "887" : "convert.errors.file"));

	List<FileItemLog> logs = fileLogDao.get(f);
	if (f.getHash() == null) {
		message.setVisible(true);
		message.setDefaultModelObject(getString("888"));
	} else if (!f.exists()) {
		message.setVisible(true);
		message.setDefaultModelObject(getString(f.getType() == BaseFileItem.Type.RECORDING ? "1595" : "convert.errors.file.missing"));
	} else {
		message.setVisible(false);
	}
	if (!logs.isEmpty()) {
		logView.setVisible(false);
		logView.setList(logs).setVisible(true);
	}
	handler.add(container, headerLabel);
	return super.show(handler);
}
 
Example #9
Source File: FileTreePanel.java    From openmeetings with Apache License 2.0 6 votes vote down vote up
private ConfirmableAjaxBorder getTrashBorder() {
	if (trashBorder == null) {
		trashBorder = new ConfirmableAjaxBorder("trash", new ResourceModel("80"), new ResourceModel("713")) {
			private static final long serialVersionUID = 1L;

			@Override
			protected boolean isClickable() {
				return !readOnly && !selected.isEmpty();
			}

			@Override
			protected void onConfirm(AjaxRequestTarget target) {
				deleteAll(target);
			}
		};
	}
	return trashBorder;
}
 
Example #10
Source File: SubclassCreationDialog.java    From inception with Apache License 2.0 6 votes vote down vote up
public ContentPanel(String aId, IModel<KBConcept> newSubclassConceptModel)
{
    super(aId);

    // add components for input form
    RequiredTextField<String> name = new RequiredTextField<>("name");
    name.add(AttributeModifier.append("placeholder",
            new ResourceModel("subclassNamePlaceholder")));

    LambdaAjaxButton<KBConcept> createButton = new LambdaAjaxButton<KBConcept>(
            "createSubclass", SubclassCreationDialog.this::actionCreateSubclass);
    createButton.add(new Label("createLabel", new ResourceModel("create")));

    // initialize input form and add it to the content panel
    Form<KBConcept> form = new Form<KBConcept>("form",
            CompoundPropertyModel.of(newSubclassConceptModel));
    form.add(name);
    form.add(createButton);
    form.setDefaultButton(createButton);
    add(form);
}
 
Example #11
Source File: SignInDialog.java    From openmeetings with Apache License 2.0 6 votes vote down vote up
@Override
protected void onInitialize() {
	add(form = new SignInForm("signin"));
	header(new ResourceModel("108"));
	show(true);
	setCloseOnEscapeKey(false);
	setBackdrop(Backdrop.STATIC);
	addButton(new SpinnerAjaxButton("button", new ResourceModel("112"), form, Buttons.Type.Outline_Primary)); // Login
	addButton(new BootstrapAjaxLink<>("button", Model.of(""), Buttons.Type.Outline_Secondary, new ResourceModel("123")) {
		private static final long serialVersionUID = 1L;

		public void onClick(AjaxRequestTarget target) {
			SignInDialog.this.close(target);
			register.setClientTimeZone();
			register.show(target);
		}
	}.setVisible(OpenmeetingsVariables.isAllowRegisterFrontend()));

	super.onInitialize();
}
 
Example #12
Source File: GalleryImageEdit.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
private AjaxFallbackButton createRemoveCancelButton(Form imageEditForm) {
	AjaxFallbackButton removeCancelButton = new AjaxFallbackButton(
			"galleryRemoveImageCancelButton", new ResourceModel(
					"button.cancel"), imageEditForm) {

		@Override
		protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
			target.appendJavaScript("$('#"
					+ removeConfirmContainer.getMarkupId() + "').hide();");

			imageOptionsContainer.setVisible(true);
			target.add(imageOptionsContainer);

			target.appendJavaScript("setMainFrameHeight(window.name);");
		}

	};
	return removeCancelButton;
}
 
Example #13
Source File: SakaiNavigatorLabel.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
private SakaiNavigatorLabel(final String id, final PageableComponent table) {
	super(id);
	Model model = new Model(new LabelModelObject(table)); 
	setDefaultModel(
			new StringResourceModel(
					"pager_textStatus", 
					this, 
					model,
					"Viewing {0} - {1} of {2} {3}",
					new Object[] {
						new PropertyModel(model, "from"),
						new PropertyModel(model, "to"),
						new PropertyModel(model, "of"),
						new ResourceModel("pager_textItem"),
					})
	);
}
 
Example #14
Source File: GalleryImageEdit.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
private AjaxFallbackButton createRemovePictureButton(Form imageEditForm) {
	AjaxFallbackButton removePictureButton = new AjaxFallbackButton(
			"galleryImageRemoveButton", new ResourceModel(
					"button.gallery.remove"), imageEditForm) {

		@Override
		protected void onSubmit(AjaxRequestTarget target, Form form) {

			imageOptionsContainer.setVisible(false);

			target.appendJavaScript("$('#"
					+ imageOptionsContainer.getMarkupId() + "').hide();");

			removeConfirmContainer.setVisible(true);
			target.add(removeConfirmContainer);
			target.appendJavaScript("setMainFrameHeight(window.name);");
		}

	};
	return removePictureButton;
}
 
Example #15
Source File: GalleryImageEdit.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
private AjaxFallbackButton createSetProfileImageCancelButton(Form imageEditForm) {
	AjaxFallbackButton removeCancelButton = new AjaxFallbackButton(
			"gallerySetProfileImageCancelButton", new ResourceModel(
					"button.cancel"), imageEditForm) {

		@Override
		protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
			target.appendJavaScript("$('#"
					+ setProfileImageConfirmContainer.getMarkupId() + "').hide();");

			imageOptionsContainer.setVisible(true);
			target.add(imageOptionsContainer);

			target.appendJavaScript("setMainFrameHeight(window.name);");
		}

	};
	return removeCancelButton;
}
 
Example #16
Source File: PropertyListPanel.java    From inception with Apache License 2.0 5 votes vote down vote up
public PropertyListPanel(String aId, IModel<KnowledgeBase> aKbModel, IModel<KBProperty> aModel)
{
    super(aId, aModel);

    setOutputMarkupId(true);

    selectedProperty = aModel;
    kbModel = aKbModel;
    preferences = Model.of(new Preferences());

    OverviewListChoice<KBProperty> overviewList = new OverviewListChoice<>("properties");
    overviewList.setChoiceRenderer(new ChoiceRenderer<>("uiLabel"));
    overviewList.setModel(selectedProperty);
    overviewList.setChoices(LambdaModel.of(this::getProperties));
    overviewList.add(new LambdaAjaxFormComponentUpdatingBehavior("change",
            this::actionSelectionChanged));
    
    add(overviewList);

    add(new Label("count", LambdaModel.of(() -> overviewList.getChoices().size())));

    LambdaAjaxLink addLink = new LambdaAjaxLink("add",
        target -> send(getPage(), Broadcast.BREADTH, new AjaxNewPropertyEvent(target)));
    addLink.add(new Label("label", new ResourceModel("property.list.add")));
    addLink.add(new WriteProtectionBehavior(kbModel));
    add(addLink);

    Form<Preferences> form = new Form<>("form", CompoundPropertyModel.of(preferences));
    form.add(new CheckBox("showAllProperties").add(
            new LambdaAjaxFormSubmittingBehavior("change", this::actionPreferenceChanged)));
    add(form);
}
 
Example #17
Source File: LinkFunctionBoxPanel.java    From ontopia with Apache License 2.0 5 votes vote down vote up
@Override
protected List<List<Component>> getFunctionBoxComponentList(String id) {
  List<Component> heading = Arrays.asList(new Component[] { getLabel(id) }); 
  List<Component> box = Arrays.asList(new Component[] {
      new Label(id, new ResourceModel("arrow.right")), getLink(id) });
  
  List<List<Component>> result = new ArrayList<List<Component>>(2);
  result.add(heading);
  result.add(box);
  return result;
}
 
Example #18
Source File: InstallWizard.java    From openmeetings with Apache License 2.0 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	add(tzDropDown);
	add(new RequiredTextField<String>("username").setLabel(new ResourceModel("install.wizard.params.step1.username")).add(minimumLength(USER_LOGIN_MINIMUM_LENGTH)));
	add(new PasswordTextField("password")
			.setResetPassword(false).setLabel(new ResourceModel("install.wizard.params.step1.password"))
			.add(new StrongPasswordValidator(new User())));
	add(new RequiredTextField<String>("email").setLabel(new ResourceModel("lbl.email")).add(RfcCompliantEmailAddressValidator.getInstance()));
	add(new RequiredTextField<String>("group").setLabel(new ResourceModel("install.wizard.params.step1.group")));
}
 
Example #19
Source File: ForgetPasswordDialog.java    From openmeetings with Apache License 2.0 5 votes vote down vote up
@Override
protected void onInitialize() {
	header(new ResourceModel("312"));
	setUseCloseHandler(true);

	addButton(new BootstrapAjaxButton("button", new ResourceModel("317"), form, Buttons.Type.Outline_Primary) {
		private static final long serialVersionUID = 1L;
	}); // Send
	addButton(OmModalCloseButton.of());

	add(form);
	super.onInitialize();
}
 
Example #20
Source File: ProjectsOverviewPage.java    From inception with Apache License 2.0 5 votes vote down vote up
public ProjectsOverviewPage()
{
    add(projectListContainer = createProjectList());
    add(createNewProjectLink());
    add(createStartTutorialLink());
    add(createImportProjectForm());
    add(roleFilters = createRoleFilters());
    add(confirmLeaveDialog = new ConfirmationDialog(MID_CONFIRM_LEAVE,
            new StringResourceModel("leaveDialog.title", this),
            new StringResourceModel("leaveDialog.text", this)));
    activeRoleFilters = Model.ofSet(new HashSet<>());
    
    emptyListLabel = new Label(MID_EMPTY_LIST_LABEL, new ResourceModel("noProjects"));
    projectListContainer.add(emptyListLabel);
}
 
Example #21
Source File: ExpiredMessageDialog.java    From openmeetings with Apache License 2.0 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	withErrorIcon();
	header(new ResourceModel("204"));
	setBackdrop(Backdrop.TRUE);
	show(true);
	setUseCloseHandler(true);
	addButton(OmModalCloseButton.of("54"));
}
 
Example #22
Source File: InviteUserToRoomDialog.java    From openmeetings with Apache License 2.0 5 votes vote down vote up
@Override
protected void onInitialize() {
	header(new ResourceModel("1131"));

	addButton(OmModalCloseButton.of());
	add(publicRooms = new InviteRoomListPanel("publicRooms", new ArrayList<Room>(), getString("1135")));
	add(privateRooms = new InviteRoomListPanel("privateRooms", new ArrayList<Room>(), getString("1135")));
	add(inviteMsg);
	super.onInitialize();
}
 
Example #23
Source File: RoomPanel.java    From openmeetings with Apache License 2.0 5 votes vote down vote up
private void createWaitModerator(final boolean autoopen) {
	waitModerator = new Alert("wait-moderator", new ResourceModel("wait-moderator.message"), new ResourceModel("wait-moderator.title")) {
		private static final long serialVersionUID = 1L;

		@Override
		protected Component createMessage(String markupId, IModel<String> message) {
			return super.createMessage(markupId, message).setEscapeModelStrings(false);
		}
	};
	waitModerator.type(Alert.Type.Warning).setCloseButtonVisible(false);
	waitModerator.setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true).setVisible(autoopen);
}
 
Example #24
Source File: ConfirmationDialog.java    From openmeetings with Apache License 2.0 5 votes vote down vote up
private BootstrapAjaxLink<String> getOkButton() {
	if (okButton == null) {
		okButton = new BootstrapAjaxLink<>("button", null, Buttons.Type.Outline_Danger, new ResourceModel("54")) {
			private static final long serialVersionUID = 1L;

			@Override
			public void onClick(AjaxRequestTarget target) {
				close(target);
				onConfirm(target);
			}
		};
		okButton.setIconType(FontAwesome5IconType.exclamation_triangle_s);
	}
	return okButton;
}
 
Example #25
Source File: OntopolyAbstractPage.java    From ontopia with Apache License 2.0 5 votes vote down vote up
private static List<MenuItem> getMainMenuItems(TopicMapModel topicMapModel) {
  PageParameters parameters = new PageParameters();
  parameters.add("topicMapId", topicMapModel.getTopicMap().getId());

  List<MenuItem> mainMenuItems = Arrays.asList(new MenuItem[] {
      new MenuItem(new Label("caption", new ResourceModel("description")),
          DescriptionPage.class, parameters),
      new MenuItem(new Label("caption", new ResourceModel("administration")),
          AdminPage.class, parameters),
      new MenuItem(new Label("caption", new ResourceModel("ontology")),
          TopicTypesPage.class, parameters),
      new MenuItem(new Label("caption", new ResourceModel("instances")),
          InstanceTypesPage.class, parameters) });
  return mainMenuItems;
}
 
Example #26
Source File: SemesterPage.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public SemesterForm(String id, Semester sem) {
     super(id, new CompoundPropertyModel<Semester>(sem));
     add(new RequiredTextField<String>(PROP_EID));
     add(new TextField<String>(PROP_TITLE));
     add(new TextField(PROP_START));
     add(new TextField(PROP_END));
     add(new TextField<String>(PROP_DESC){
    
private static final long serialVersionUID = 1L;

@Override
     	    protected boolean shouldTrimInput() {
     	        return false;
     	    }
     });	        
     add(new CheckBox(PROP_CURRENT));
     
     updateButtonModel = new ResourceModel(LABEL_BUTTON_SAVE);
     addButtonModel = new ResourceModel(LABEL_BUTTON_ADD);	        
     okButton = new Button("okbutton", addButtonModel); 
     add(okButton); 
     
     Button cancelButton = new Button("cancelbutton", new ResourceModel(LABEL_BUTTON_CANCEL)){	        
private static final long serialVersionUID = 1L;

@Override
     	public void onSubmit() {
     		clearForm();
     	}
     	
     	@Override
     	public boolean isVisible() {	        	
     		return updateEID != null; // only show when editing
     	}
     };
     cancelButton.setDefaultFormProcessing(false);
     add(cancelButton);
     
 }
 
Example #27
Source File: GalleryImageEdit.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
private AjaxFallbackButton createRemoveConfirmButton(
		final String userId,
		final GalleryImage image, final int galleryPageIndex,
		final Label formFeedback, Form imageEditForm) {
	AjaxFallbackButton removeConfirmButton = new AjaxFallbackButton(
			"galleryRemoveImageConfirmButton", new ResourceModel(
					"button.gallery.remove.confirm"), imageEditForm) {

		@Override
		protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
			if (imageLogic.removeGalleryImage(
					userId, image.getId())) {

				setResponsePage(new MyPictures(galleryPageIndex));
				
			} else {
				// user alert
				formFeedback.setDefaultModel(new ResourceModel(
						"error.gallery.remove.failed"));
				formFeedback.add(new AttributeModifier("class", true,
						new Model("alertMessage")));

				target.add(formFeedback);
			}
		}
	};
	return removeConfirmButton;
}
 
Example #28
Source File: EventModel.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public String getEventName() {
	if(ReportManager.WHAT_EVENTS_ALLEVENTS.equals(eventName)){
		return (String) new ResourceModel("all").getObject();
	}else{
		return eventName;
	}
}
 
Example #29
Source File: LessonsWidget.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/** MiniStat:: Pages count */
private WidgetMiniStat getMiniStatPages() {

    return new WidgetMiniStat() {

        private static final long   serialVersionUID    = 1L;
        @Override
        public String getValue() {
            return Integer.toString(getTotalPages());
        }
        @Override
        public String getSecondValue() {
            return null;
        }
        @Override
        public String getTooltip() {
            return null;
        }
        @Override
        public boolean isWiderText() {
            return false;
        }
        @Override
        public String getLabel() {
            return (String) new ResourceModel("overview_title_pages_sum").getObject();
        }
        @Override
        public ReportDef getReportDefinition() {
            return null;
        }
    };
}
 
Example #30
Source File: AbstractTypesPage.java    From ontopia with Apache License 2.0 5 votes vote down vote up
public static IModel<String> getNameModelForType(int type) {
  if (type == TOPIC_TYPES_INDEX_IN_SUBMENU) {
    return new ResourceModel("topic.types");
  } else if (type == OCCURRENCE_TYPES_INDEX_IN_SUBMENU) {
    return new ResourceModel("occurrence.types");
  } else if (type == ASSOCIATION_TYPES_INDEX_IN_SUBMENU) {
    return new ResourceModel("association.types");
  } else if (type == ROLE_TYPES_INDEX_IN_SUBMENU) {
    return new ResourceModel("role.types");
  } else if (type == NAME_TYPES_INDEX_IN_SUBMENU) {
    return new ResourceModel("name.types");
  } else {
    return null;
  }
}