Java Code Examples for org.apache.wicket.markup.html.basic.Label#setOutputMarkupPlaceholderTag()

The following examples show how to use org.apache.wicket.markup.html.basic.Label#setOutputMarkupPlaceholderTag() . 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: AnnotationInfoPanel.java    From webanno with Apache License 2.0 6 votes vote down vote up
private Label createSelectedAnnotationTypeLabel()
{
    Label label = new Label("selectedAnnotationType", LoadableDetachableModel.of(() -> {
        try {
            AnnotationDetailEditorPanel editorPanel = findParent(
                    AnnotationDetailEditorPanel.class);
            return String.valueOf(selectFsByAddr(editorPanel.getEditorCas(),
                    getModelObject().getSelection().getAnnotation().getId())).trim();
        }
        catch (IOException e) {
            return "";
        }
    }));
    label.setOutputMarkupPlaceholderTag(true);
    // We show the extended info on the selected annotation only when run in development mode
    label.add(visibleWhen(() -> getModelObject().getSelection().getAnnotation().isSet()
            && DEVELOPMENT.equals(getApplication().getConfigurationType())));
    return label;
}
 
Example 2
Source File: ConceptFeatureEditor.java    From inception with Apache License 2.0 5 votes vote down vote up
public ConceptFeatureEditor(String aId, MarkupContainer aItem, IModel<FeatureState> aModel,
        IModel<AnnotatorState> aStateModel, AnnotationActionHandler aHandler)
{
    super(aId, aItem, new CompoundPropertyModel<>(aModel));
    
    IModel<String> iriModel = LoadableDetachableModel.of(this::iriTooltipValue);
    
    iriBadge = new IriInfoBadge("iriInfoBadge", iriModel);
    iriBadge.add(visibleWhen(() -> isNotBlank(iriBadge.getModelObject())));
    add(iriBadge);
    
    openIriLink = new ExternalLink("openIri", iriModel);
    openIriLink.add(visibleWhen(() -> isNotBlank(iriBadge.getModelObject())));
    add(openIriLink);

    add(new DisabledKBWarning("disabledKBWarning", Model.of(getModelObject().feature)));

    add(focusComponent = new AutoCompleteField(MID_VALUE, _query -> 
            getCandidates(aStateModel, aHandler, _query)));
    
    AnnotationFeature feat = getModelObject().feature;
    ConceptFeatureTraits traits = readFeatureTraits(feat);
    
    add(new KeyBindingsPanel("keyBindings", () -> traits.getKeyBindings(), aModel, aHandler)
            // The key bindings are only visible when the label is also enabled, i.e. when the
            // editor is used in a "normal" context and not e.g. in the keybindings 
            // configuration panel
            .add(visibleWhen(() -> getLabelComponent().isVisible())));
    
    description = new Label("description", LoadableDetachableModel.of(this::descriptionValue));
    description.setOutputMarkupPlaceholderTag(true);
    description.add(visibleWhen(
        () -> getLabelComponent().isVisible() && getModelObject().getValue() != null));
    add(description);
}
 
Example 3
Source File: SentenceOrientedPagingStrategy.java    From webanno with Apache License 2.0 5 votes vote down vote up
@Override
public Component createPositionLabel(String aId, IModel<AnnotatorState> aModel)
{
    Label label = new Label(aId, () -> {
        AnnotatorState state = aModel.getObject();
        return String.format("%d-%d / %d sentences [doc %d / %d]",
                state.getFirstVisibleUnitIndex(), state.getLastVisibleUnitIndex(),
                state.getUnitCount(), state.getDocumentIndex() + 1,
                state.getNumberOfDocuments());
    });
    label.setOutputMarkupPlaceholderTag(true);
    return label;
}
 
Example 4
Source File: LineOrientedPagingStrategy.java    From webanno with Apache License 2.0 5 votes vote down vote up
@Override
public Component createPositionLabel(String aId, IModel<AnnotatorState> aModel)
{
    Label label = new Label(aId, () -> {
        AnnotatorState state = aModel.getObject();
        return String.format("%d-%d / %d lines [doc %d / %d]",
                state.getFirstVisibleUnitIndex(), state.getLastVisibleUnitIndex(),
                state.getUnitCount(), state.getDocumentIndex() + 1,
                state.getNumberOfDocuments());
    });
    label.setOutputMarkupPlaceholderTag(true);
    return label;
}
 
Example 5
Source File: AnnotationInfoPanel.java    From webanno with Apache License 2.0 5 votes vote down vote up
private Label createSelectedAnnotationLayerLabel()
{
    Label label = new Label("selectedAnnotationLayer",
            CompoundPropertyModel.of(getDefaultModel()).bind("selectedAnnotationLayer.uiName"));
    label.setOutputMarkupPlaceholderTag(true);
    label.add(visibleWhen(() -> getModelObject().getPreferences().isRememberLayer()));
    return label;
}
 
Example 6
Source File: LayerSelectionPanel.java    From webanno with Apache License 2.0 5 votes vote down vote up
private Label createRelationHint()
{
    Label label = new Label("relationHint", Model.of());
    label.setOutputMarkupPlaceholderTag(true);
    label.setEscapeModelStrings(false);
    label.add(LambdaBehavior.onConfigure(_this -> {
        if (layerSelector.getModelObject() != null) {
            List<AnnotationLayer> relLayers = annotationService
                    .listAttachedRelationLayers(layerSelector.getModelObject());
            if (relLayers.isEmpty()) {
                _this.setVisible(false);
            }
            else if (relLayers.size() == 1) {
                _this.setDefaultModelObject("Create a <b>"
                        + escapeMarkup(relLayers.get(0).getUiName(), false, false)
                        + "</b> relation by drawing an arc between annotations of this layer.");
                _this.setVisible(true);
            }
            else {
                _this.setDefaultModelObject(
                        "Whoops! Found more than one relation layer attaching to this span layer!");
                _this.setVisible(true);
            }
        }
        else {
            _this.setVisible(false);
        }
    }));
    return label;
}
 
Example 7
Source File: ActiveLearningSidebar.java    From inception with Apache License 2.0 5 votes vote down vote up
private Label createNoRecommendationLabel()
{
    Label noRecommendation = new Label(CID_NO_RECOMMENDATION_LABEL,
            "There are no further suggestions.");
    noRecommendation.add(visibleWhen(() -> {
        ActiveLearningUserState alState = alStateModel.getObject();
        return alState.isSessionActive() 
                && !alState.getSuggestion().isPresent()
                && !activeLearningService.hasSkippedSuggestions(
                        getModelObject().getUser(), alState.getLayer());
    }));
    noRecommendation.setOutputMarkupPlaceholderTag(true);
    return noRecommendation;
}
 
Example 8
Source File: OrienteerCloudOModulesConfigurationsPanel.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
public OrienteerCloudOModulesConfigurationsPanel(String id, final OArtifactsModalWindowPage windowPage, ISortableDataProvider<OArtifact, String> provider) {
    super(id);
    setOutputMarkupPlaceholderTag(true);
    Form orienteerModulesForm = new Form("orienteerCloudOModulesConfigsForm");
    Label feedback = new Label("feedback");
    feedback.setVisible(false);
    feedback.setOutputMarkupPlaceholderTag(true);
    IModel<DisplayMode> modeModel = DisplayMode.VIEW.asModel();
    List<IColumn<OArtifact, String>> columns = getColumns(modeModel);
    OrienteerDataTable<OArtifact, String> table = new OrienteerDataTable<>("availableModules", columns, provider, 10);
    table.addCommand(new AjaxCommand<OArtifact>(new ResourceModel(BACK_BUT), table) {
        @Override
        public void onClick(Optional<AjaxRequestTarget> targetOptional) {
            windowPage.showOrienteerModulesPanel(false);
            targetOptional.ifPresent(target->target.add(windowPage));
        }

        @Override
        protected void onInstantiation() {
            super.onInstantiation();
            setIcon(FAIconType.angle_left);
            setBootstrapType(BootstrapType.PRIMARY);
            setAutoNotify(false);
        }
    });
    table.addCommand(new InstallOModuleCommand(table, windowPage, false, feedback));
    table.addCommand(new InstallOModuleCommand(table, windowPage,true, feedback));
    orienteerModulesForm.add(table);
    orienteerModulesForm.add(feedback);
    add(orienteerModulesForm);
}
 
Example 9
Source File: DefineDrillEntityPanel.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
public DefineDrillEntityPanel(String id, String type, final DrillDownEntity drillEntity, Entity entity) {
	super(id, new CompoundPropertyModel<DrillDownEntity>(drillEntity));
	
	this.type = type;
	
	final Label widgetLabel = new Label("entityLabel", getString(type));		
	add(widgetLabel);
	
	final DropDownChoice<Entity> entityChoice = new DropDownChoice<Entity>("entities", 
			new PropertyModel<Entity>(drillEntity, "entity"), new WidgetDropDownModel(), new EntityChoiceRenderer());
	entityChoice.setOutputMarkupPlaceholderTag(true);
	entityChoice.setOutputMarkupId(true);
	entityChoice.setRequired(true);
	add(entityChoice);
	
	final Label linkLabel = new Label("linkLabel", getString("ActionContributor.Drill.parameter"));
	linkLabel.setOutputMarkupId(true);
	linkLabel.setOutputMarkupPlaceholderTag(true);
	add(linkLabel);
	
	final DropDownChoice<String> paramChoice = new DropDownChoice<String>("parameters",
               new PropertyModel<String>(drillEntity, "linkParameter"), parameters, new ChoiceRenderer<String>());
       paramChoice.setRequired(true);
       paramChoice.setLabel(new Model<String>( getString("ActionContributor.Drill.parameter")));
       paramChoice.setOutputMarkupId(true);
       paramChoice.setOutputMarkupPlaceholderTag(true);
       add(paramChoice);
       
       final Label columnLabel = new Label("columnLabel",  getString("ActionContributor.Drill.column"));            
       columnLabel.setOutputMarkupId(true);
       columnLabel.setOutputMarkupPlaceholderTag(true);
	add(columnLabel);
                   
       final TextField<Integer> columnField = new TextField<Integer>("column");            
       columnField.setOutputMarkupId(true);
       columnField.setOutputMarkupPlaceholderTag(true);
       add(columnField);
       
       if (drillEntity.getIndex() == 0) {
       	if (entity instanceof Chart) {
       		columnLabel.setVisible(false);            	
       		columnField.setVisible(false);            		 
       	}
       } else {
       	if (DrillDownUtil.getLastDrillType(entity) == DrillDownEntity.CHART_TYPE) {
       		columnLabel.setVisible(false);            	
       		columnField.setVisible(false);            		   
       	} 
       }
       
       entityChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {

           @Override
           protected void onUpdate(AjaxRequestTarget target) {
          	updateParameters(drillEntity);                     
              target.add(paramChoice);
           }

       }); 
       
}
 
Example 10
Source File: SortPanel.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
public SortPanel(IModel<Analysis> model) {		
	super(FormPanel.CONTENT_ID);				
	
	sortProperty = new ArrayList<String>(model.getObject().getSortProperty());		
	ascending = new ArrayList<Boolean>(model.getObject().getAscending());
	
	sortObject = new SortObject();
	sortObject.setColumn(model.getObject().getSimpleColumns().get(0));
	sortObject.setOrder(Boolean.TRUE);		
	
	ContextImage urlImage = new ContextImage("infoImage","images/information.png");        
       urlImage.add(new SimpleTooltipBehavior(AnalysisUtil.getAnalysisInfo(model.getObject(), 5, storageService.getSettings())));
       add(urlImage);
	
	add(new Label("column", new StringResourceModel("SortPanel.column", null, null)));
	columnChoice = new DropDownChoice<String>("columnChoice", 
				new PropertyModel<String>(this, "sortObject.column"), model.getObject().getSimpleColumns(),
				new ChoiceRenderer<String>() {
				@Override
				public Object getDisplayValue(String fullColumnName) {
					return DatabaseUtil.getColumnAlias(fullColumnName);
				}
	});
	columnChoice.setOutputMarkupPlaceholderTag(true);
	columnChoice.setRequired(true);
		add(columnChoice); 
	
	add(new Label("order", new StringResourceModel("SortPanel.order", null, null)));  
	orderChoice = new DropDownChoice<Boolean>("orderChoice", 
				new PropertyModel<Boolean>(this, "sortObject.order"), Arrays.asList(Boolean.TRUE, Boolean.FALSE));
	orderChoice.setOutputMarkupPlaceholderTag(true);
	orderChoice.setRequired(true);
		add(orderChoice); 
		
		AjaxSubmitLink addLink = new AjaxSubmitLink("addLink") {						
			@Override
			protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
				if (editIndex != -1) {
					int index = sortProperty.indexOf(sortObject.getColumn()); 					
					if ( (index != -1) && (index != editIndex) ) {
						error(getString("SortPanel.duplicateColumn"));	    
            		target.add(getFeedbackPanel());
        			return;
					}
					if (editIndex == 0)  {
						if (sortProperty.get(editIndex).equals(sortObject.getColumn())) {
							changeFirstSortOrder = true;
						} else {
							firstSortRemoved = true;
						}
					}
					sortProperty.set(editIndex, sortObject.getColumn());
					ascending.set(editIndex, sortObject.getOrder()); 	
					resetEdit(target);
				} else {
 				if (sortProperty.contains(sortObject.getColumn())) {
 					error(getString("SortPanel.duplicateColumn"));	    
            		target.add(getFeedbackPanel());
        			return;
 				}
 				sortProperty.add(sortObject.getColumn());
 				ascending.add(sortObject.getOrder());
 			}
				target.add(table);
				target.add(getFeedbackPanel());
			} 
			
	    };
	    
	    addTextModel = Model.of(""); 	    
	    label = new Label("addMessage", addTextModel);
	    label.setOutputMarkupPlaceholderTag(true);
	    addLink.add(label);
	    add(addLink);
		
		addTable();
	
}
 
Example 11
Source File: GroupPanel.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
public GroupPanel(IModel<Analysis> model) {		
	super(FormPanel.CONTENT_ID);
	
	groups = new LinkedList<String>(model.getObject().getGroups());		
	
	groupObject = model.getObject().getColumns().get(0);		
	
	ContextImage urlImage = new ContextImage("infoImage","images/information.png");        
       urlImage.add(new SimpleTooltipBehavior(AnalysisUtil.getAnalysisInfo(model.getObject(), 5, storageService.getSettings())));
       add(urlImage);
	
	add(new Label("column", new StringResourceModel("GroupPanel.column", null, null)));
	columnChoice = new DropDownChoice<String>("columnChoice", 
				new PropertyModel<String>(this, "groupObject"), model.getObject().getSimpleColumns());
	columnChoice.setOutputMarkupPlaceholderTag(true);
	columnChoice.setRequired(true);
		add(columnChoice); 
			
		AjaxSubmitLink addLink = new AjaxSubmitLink("addLink") {						
			@Override
			protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
				if (editIndex != -1) {
					int index = groups.indexOf(groupObject); 					
					if ( (index != -1) && (index != editIndex) ) {
						error(getString("GroupPanel.duplicateGroup"));	    
            		target.add(getFeedbackPanel());
        			return;
					} 					
					groups.set(editIndex, groupObject); 					 	
					resetEdit(target);
				} else {
 				if (groups.contains(groupObject)) {
 					error(getString("GroupPanel.duplicateGroup"));	    
            		target.add(getFeedbackPanel());
        			return;
 				}
 				groups.add(groupObject);	 				
 			}
				target.add(table);
				target.add(getFeedbackPanel());
			} 
			
	    };
	    
	    addTextModel = Model.of(""); 	    
	    label = new Label("addMessage", addTextModel);
	    label.setOutputMarkupPlaceholderTag(true);
	    addLink.add(label);
	    add(addLink);
		
		addTable();
	
}
 
Example 12
Source File: OrienteerArtifactsManagerWidget.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
public OrienteerArtifactsManagerWidget(String id, IModel<OArtifact> model, IModel<ODocument> widgetDocumentModel) {
      super(id, model, widgetDocumentModel);
      Form form = new Form("form");
      Label feedback = new Label("feedback");
      feedback.setOutputMarkupPlaceholderTag(true);
      feedback.setVisible(false);
      IModel<DisplayMode> modeModel = DisplayMode.VIEW.asModel();
      List<IColumn<OArtifact, String>> columns = getColumns(modeModel);
      IModel<List<OArtifact>> installedModulesModel = new AbstractListModel<OArtifact>() {

	@Override
	protected Collection<OArtifact> getData() {
		return OrienteerClassLoaderUtil.getOArtifactsMetadataAsList();
	}
};

ISortableDataProvider<OArtifact, String> installedModulesProvider = new JavaSortableDataProvider<>(installedModulesModel);
      
      IModel<List<OArtifact>> availableModulesModel = new AbstractListModel<OArtifact>() {
      	List<OArtifact> downloadedModules;

	@Override
	protected Collection<OArtifact> getData() {
		if(downloadedModules==null || downloadedModules.isEmpty()) {
			try {
				downloadedModules = OrienteerClassLoaderUtil.getOrienteerArtifactsFromServer();
			} catch (IOException e) {
				LOG.error("It's not possible to download modules file from the internet", e);
				error(e.getMessage());
			}
		}
		return downloadedModules;
	}
};
      ISortableDataProvider<OArtifact, String> availableModulesProvider = new JavaSortableDataProvider<>(availableModulesModel);
      final OrienteerDataTable<OArtifact, String> modulesTable =
              new OrienteerDataTable<>("oArtifactsTable", columns, installedModulesProvider, 20);
      modulesTable.addCommand(new AddOArtifactCommand(modulesTable, new OArtifactsModalWindowPage(availableModulesProvider)));
      modulesTable.addCommand(new EditOArtifactsCommand(modulesTable, modeModel));
      modulesTable.addCommand(new SaveOArtifactCommand(modulesTable, modeModel, feedback));
      modulesTable.addCommand(new DeleteOArtifactCommand(modulesTable));
      modulesTable.addCommand(new ReloadOrienteerCommand(modulesTable, new ResourceModel(RELOAD_ORIENTEER)));
      form.add(modulesTable);
      form.add(feedback);
      add(form);
  }
 
Example 13
Source File: AdministratePage.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public AdministratePage(){
	disableLink(administrateLink);
	
	//Form Feedback (Saved/Error)
	final Label formFeedback = new Label("formFeedback");
	formFeedback.setOutputMarkupPlaceholderTag(true);
	final String formFeedbackId = formFeedback.getMarkupId();
	add(formFeedback);
	
	//Add Delegated Access to My Workspaces:
	final Label addDaMyworkspaceStatusLabel = new Label("lastRanInfo", new AbstractReadOnlyModel<String>() {
		@Override
		public String getObject() {
			String lastRanInfoStr = projectLogic.getAddDAMyworkspaceJobStatus();
			if(lastRanInfoStr == null){
				lastRanInfoStr = new ResourceModel("addDaMyworkspace.job.status.none").getObject();
			}else{
				try{
					long lastRanInfoInt = Long.parseLong(lastRanInfoStr);
					if(lastRanInfoInt == -1){
						return new ResourceModel("addDaMyworkspace.job.status.failed").getObject();
					}else if(lastRanInfoInt == 0){
						return new ResourceModel("addDaMyworkspace.job.status.scheduled").getObject();
					}else{
						Date successDate = new Date(lastRanInfoInt);
						return new ResourceModel("addDaMyworkspace.job.status.success").getObject() + " " + format.format(successDate);
					}
				}catch (Exception e) {
					return new ResourceModel("na").getObject();
				}
			}
			return lastRanInfoStr;
		}
	});
	addDaMyworkspaceStatusLabel.setOutputMarkupPlaceholderTag(true);
	final String addDaMyworkspaceStatusLabelId = addDaMyworkspaceStatusLabel.getMarkupId();
	
	add(addDaMyworkspaceStatusLabel);
	
	Form<?> addDaMyworkspaceForm = new Form("addDaMyworkspaceForm");
	
	AjaxButton addDaMyworkspaceButton = new AjaxButton("addDaMyworkspace", new StringResourceModel("addDaMyworkspaceTitle", null)){
		@Override
		protected void onSubmit(AjaxRequestTarget target, Form<?> arg1) {
			projectLogic.scheduleAddDAMyworkspaceJobStatus();
			
			//display a "saved" message
			formFeedback.setDefaultModel(new ResourceModel("success.addDaMyworkspace"));
			formFeedback.add(new AttributeModifier("class", true, new Model("success")));
			target.add(formFeedback);
			
			target.appendJavaScript("hideFeedbackTimer('" + formFeedbackId + "');");
			
			target.add(addDaMyworkspaceStatusLabel,addDaMyworkspaceStatusLabelId);
		}
	};
	addDaMyworkspaceForm.add(addDaMyworkspaceButton);
	
	add(addDaMyworkspaceForm);
}
 
Example 14
Source File: MyBusinessEdit.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public MyBusinessEdit(final String id, final UserProfile userProfile,
		List<CompanyProfile> companyProfilesToAdd,
		List<CompanyProfile> companyProfilesToRemove,
		TabDisplay tabDisplay) {

	super(id);

	log.debug("MyBusinessEdit()");

	this.companyProfilesToAdd = companyProfilesToAdd;
	this.companyProfilesToRemove = companyProfilesToRemove;

	// heading
	add(new Label("heading", new ResourceModel("heading.business.edit")));

	// setup form
	Form form = new Form("form", new Model(userProfile));
	form.setOutputMarkupId(true);

	// form submit feedback
	final Label formFeedback = new Label("formFeedback");
	formFeedback.setOutputMarkupPlaceholderTag(true);
	form.add(formFeedback);

	// add warning message if superUser and not editing own profile
	Label editWarning = new Label("editWarning");
	editWarning.setVisible(false);
	if (sakaiProxy.isSuperUserAndProxiedToUser(
			userProfile.getUserUuid())) {
		editWarning.setDefaultModel(new StringResourceModel(
				"text.edit.other.warning", null, new Object[] { userProfile
						.getDisplayName() }));
		editWarning.setEscapeModelStrings(false);
		editWarning.setVisible(true);
	}
	form.add(editWarning);

	// business biography
	WebMarkupContainer businessBiographyContainer = new WebMarkupContainer(
			"businessBiographyContainer");
	businessBiographyContainer.add(new Label("businessBiographyLabel",
			new ResourceModel("profile.business.bio")));
	TextArea businessBiography = new TextArea(
			"businessBiography", new PropertyModel<String>(userProfile,
					"businessBiography"));
	businessBiography.setMarkupId("businessbioinput");
	businessBiography.setOutputMarkupId(true);
	//businessBiography.setEditorConfig(CKEditorConfig.createCkConfig());
	businessBiographyContainer.add(businessBiography);
	form.add(businessBiographyContainer);

	// company profiles
	WebMarkupContainer companyProfileEditsContainer = createCompanyProfileEditsContainer(userProfile, tabDisplay);
	form.add(companyProfileEditsContainer);

	AjaxFallbackButton addCompanyProfileButton = createAddCompanyProfileButton(
			id, userProfile, form, formFeedback);
	form.add(addCompanyProfileButton);

	AjaxFallbackButton removeCompanyProfileButton = createRemoveCompanyProfileButton(
			id, userProfile, form);
	form.add(removeCompanyProfileButton);

	AjaxFallbackButton submitButton = createSaveChangesButton(id,
			userProfile, form, formFeedback);
	//submitButton.add(new CKEditorTextArea.CKEditorAjaxSubmitModifier());
	form.add(submitButton);

	AjaxFallbackButton cancelButton = createCancelChangesButton(id,
			userProfile, form);
	form.add(cancelButton);

	add(form);
}
 
Example 15
Source File: GalleryImageEdit.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public GalleryImageEdit(String id,
		final String userId, final GalleryImage image,
		final long galleryPageIndex) {

	super(id);

	log.debug("GalleryImageEdit()");

	// feedback label for user alert in event remove/set actions fail
	final Label formFeedback = new Label("formFeedback");
	formFeedback.setOutputMarkupPlaceholderTag(true);
	add(formFeedback);

	Form imageEditForm = new Form("galleryImageEditForm");

	imageEditForm.setOutputMarkupId(true);
	add(imageEditForm);

	imageOptionsContainer = new WebMarkupContainer("galleryImageOptionsContainer");
	imageOptionsContainer.setOutputMarkupId(true);
	imageOptionsContainer.setOutputMarkupPlaceholderTag(true);

	imageOptionsContainer.add(new Label("removePictureLabel",
			new ResourceModel("pictures.removepicture")));

	AjaxFallbackButton removePictureButton = createRemovePictureButton(imageEditForm);
	imageOptionsContainer.add(removePictureButton);

	Label setProfileImageLabel = new Label("setProfileImageLabel",
			new ResourceModel("pictures.setprofileimage"));
	imageOptionsContainer.add(setProfileImageLabel);

	AjaxFallbackButton setProfileImageButton = createSetProfileImageButton(imageEditForm);

	if ((true == sakaiProxy.isOfficialImageEnabledGlobally() && 
			false == sakaiProxy.isUsingOfficialImageButAlternateSelectionEnabled())
			|| preferencesLogic.getPreferencesRecordForUser(userId).isUseOfficialImage()) {
		
		setProfileImageLabel.setVisible(false);
		setProfileImageButton.setVisible(false);
	}
	
	imageOptionsContainer.add(setProfileImageButton);

	imageEditForm.add(imageOptionsContainer);

	removeConfirmContainer = new WebMarkupContainer("galleryRemoveImageConfirmContainer");
	removeConfirmContainer.setOutputMarkupId(true);
	removeConfirmContainer.setOutputMarkupPlaceholderTag(true);

	Label removeConfirmLabel = new Label("removePictureConfirmLabel",
			new ResourceModel("pictures.removepicture.confirm"));
	removeConfirmContainer.add(removeConfirmLabel);

	AjaxFallbackButton removeConfirmButton = createRemoveConfirmButton(
			userId, image, (int) galleryPageIndex, formFeedback,
			imageEditForm);
	//removeConfirmButton.add(new FocusOnLoadBehaviour());
	removeConfirmContainer.add(removeConfirmButton);

	AjaxFallbackButton removeCancelButton = createRemoveCancelButton(imageEditForm);
	removeConfirmContainer.add(removeCancelButton);

	removeConfirmContainer.setVisible(false);
	imageEditForm.add(removeConfirmContainer);
	
	setProfileImageConfirmContainer = new WebMarkupContainer("gallerySetProfileImageConfirmContainer");
	setProfileImageConfirmContainer.setOutputMarkupId(true);
	setProfileImageConfirmContainer.setOutputMarkupPlaceholderTag(true);
	
	Label setProfileImageConfirmLabel = new Label("setProfileImageConfirmLabel",
			new ResourceModel("pictures.setprofileimage.confirm"));
	setProfileImageConfirmContainer.add(setProfileImageConfirmLabel);

	
	AjaxFallbackButton setProfileImageConfirmButton = createSetProfileImageConfirmButton(
			userId, image, (int) galleryPageIndex, formFeedback,
			imageEditForm);
	
	//setProfileImageConfirmButton.add(new FocusOnLoadBehaviour());
	setProfileImageConfirmContainer.add(setProfileImageConfirmButton);
	
	AjaxFallbackButton setProfileImageCancelButton = createSetProfileImageCancelButton(imageEditForm);
	setProfileImageConfirmContainer.add(setProfileImageCancelButton);

	setProfileImageConfirmContainer.setVisible(false);
	imageEditForm.add(setProfileImageConfirmContainer);
	
	add(new GalleryImageRenderer("galleryImageMainRenderer", image
			.getMainResource()));
}
 
Example 16
Source File: AdministratePage.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public AdministratePage(){
	disableLink(administrateLink);
	
	//Form Feedback (Saved/Error)
	final Label formFeedback = new Label("formFeedback");
	formFeedback.setOutputMarkupPlaceholderTag(true);
	final String formFeedbackId = formFeedback.getMarkupId();
	add(formFeedback);
	
	//Add Delegated Access to My Workspaces:
	final Label addDaMyworkspaceStatusLabel = new Label("lastRanInfo", new AbstractReadOnlyModel<String>() {
		@Override
		public String getObject() {
			String lastRanInfoStr = projectLogic.getAddDAMyworkspaceJobStatus();
			if(lastRanInfoStr == null){
				lastRanInfoStr = new ResourceModel("addDaMyworkspace.job.status.none").getObject();
			}else{
				try{
					long lastRanInfoInt = Long.parseLong(lastRanInfoStr);
					if(lastRanInfoInt == -1){
						return new ResourceModel("addDaMyworkspace.job.status.failed").getObject();
					}else if(lastRanInfoInt == 0){
						return new ResourceModel("addDaMyworkspace.job.status.scheduled").getObject();
					}else{
						Date successDate = new Date(lastRanInfoInt);
						return new ResourceModel("addDaMyworkspace.job.status.success").getObject() + " " + format.format(successDate);
					}
				}catch (Exception e) {
					return new ResourceModel("na").getObject();
				}
			}
			return lastRanInfoStr;
		}
	});
	addDaMyworkspaceStatusLabel.setOutputMarkupPlaceholderTag(true);
	final String addDaMyworkspaceStatusLabelId = addDaMyworkspaceStatusLabel.getMarkupId();
	
	add(addDaMyworkspaceStatusLabel);
	
	Form<?> addDaMyworkspaceForm = new Form("addDaMyworkspaceForm");
	
	AjaxButton addDaMyworkspaceButton = new AjaxButton("addDaMyworkspace", new StringResourceModel("addDaMyworkspaceTitle", null)){
		@Override
		protected void onSubmit(AjaxRequestTarget target, Form<?> arg1) {
			projectLogic.scheduleAddDAMyworkspaceJobStatus();
			
			//display a "saved" message
			formFeedback.setDefaultModel(new ResourceModel("success.addDaMyworkspace"));
			formFeedback.add(new AttributeModifier("class", true, new Model("success")));
			target.add(formFeedback);
			
			target.appendJavaScript("hideFeedbackTimer('" + formFeedbackId + "');");
			
			target.add(addDaMyworkspaceStatusLabel,addDaMyworkspaceStatusLabelId);
		}
	};
	addDaMyworkspaceForm.add(addDaMyworkspaceButton);
	
	add(addDaMyworkspaceForm);
}
 
Example 17
Source File: MyBusinessEdit.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public MyBusinessEdit(final String id, final UserProfile userProfile,
		List<CompanyProfile> companyProfilesToAdd,
		List<CompanyProfile> companyProfilesToRemove,
		TabDisplay tabDisplay) {

	super(id);

	log.debug("MyBusinessEdit()");

	this.companyProfilesToAdd = companyProfilesToAdd;
	this.companyProfilesToRemove = companyProfilesToRemove;

	// heading
	add(new Label("heading", new ResourceModel("heading.business.edit")));

	// setup form
	Form form = new Form("form", new Model(userProfile));
	form.setOutputMarkupId(true);

	// form submit feedback
	final Label formFeedback = new Label("formFeedback");
	formFeedback.setOutputMarkupPlaceholderTag(true);
	form.add(formFeedback);

	// add warning message if superUser and not editing own profile
	Label editWarning = new Label("editWarning");
	editWarning.setVisible(false);
	if (sakaiProxy.isSuperUserAndProxiedToUser(
			userProfile.getUserUuid())) {
		editWarning.setDefaultModel(new StringResourceModel(
				"text.edit.other.warning", null, new Object[] { userProfile
						.getDisplayName() }));
		editWarning.setEscapeModelStrings(false);
		editWarning.setVisible(true);
	}
	form.add(editWarning);

	// business biography
	WebMarkupContainer businessBiographyContainer = new WebMarkupContainer(
			"businessBiographyContainer");
	businessBiographyContainer.add(new Label("businessBiographyLabel",
			new ResourceModel("profile.business.bio")));
	TextArea businessBiography = new TextArea(
			"businessBiography", new PropertyModel<String>(userProfile,
					"businessBiography"));
	businessBiography.setMarkupId("businessbioinput");
	businessBiography.setOutputMarkupId(true);
	//businessBiography.setEditorConfig(CKEditorConfig.createCkConfig());
	businessBiographyContainer.add(businessBiography);
	form.add(businessBiographyContainer);

	// company profiles
	WebMarkupContainer companyProfileEditsContainer = createCompanyProfileEditsContainer(userProfile, tabDisplay);
	form.add(companyProfileEditsContainer);

	AjaxFallbackButton addCompanyProfileButton = createAddCompanyProfileButton(
			id, userProfile, form, formFeedback);
	form.add(addCompanyProfileButton);

	AjaxFallbackButton removeCompanyProfileButton = createRemoveCompanyProfileButton(
			id, userProfile, form);
	form.add(removeCompanyProfileButton);

	AjaxFallbackButton submitButton = createSaveChangesButton(id,
			userProfile, form, formFeedback);
	//submitButton.add(new CKEditorTextArea.CKEditorAjaxSubmitModifier());
	form.add(submitButton);

	AjaxFallbackButton cancelButton = createCancelChangesButton(id,
			userProfile, form);
	form.add(cancelButton);

	add(form);
}
 
Example 18
Source File: GalleryImageEdit.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public GalleryImageEdit(String id,
		final String userId, final GalleryImage image,
		final long galleryPageIndex) {

	super(id);

	log.debug("GalleryImageEdit()");

	// feedback label for user alert in event remove/set actions fail
	final Label formFeedback = new Label("formFeedback");
	formFeedback.setOutputMarkupPlaceholderTag(true);
	add(formFeedback);

	Form imageEditForm = new Form("galleryImageEditForm");

	imageEditForm.setOutputMarkupId(true);
	add(imageEditForm);

	imageOptionsContainer = new WebMarkupContainer("galleryImageOptionsContainer");
	imageOptionsContainer.setOutputMarkupId(true);
	imageOptionsContainer.setOutputMarkupPlaceholderTag(true);

	imageOptionsContainer.add(new Label("removePictureLabel",
			new ResourceModel("pictures.removepicture")));

	AjaxFallbackButton removePictureButton = createRemovePictureButton(imageEditForm);
	imageOptionsContainer.add(removePictureButton);

	Label setProfileImageLabel = new Label("setProfileImageLabel",
			new ResourceModel("pictures.setprofileimage"));
	imageOptionsContainer.add(setProfileImageLabel);

	AjaxFallbackButton setProfileImageButton = createSetProfileImageButton(imageEditForm);

	if ((true == sakaiProxy.isOfficialImageEnabledGlobally() && 
			false == sakaiProxy.isUsingOfficialImageButAlternateSelectionEnabled())
			|| preferencesLogic.getPreferencesRecordForUser(userId).isUseOfficialImage()) {
		
		setProfileImageLabel.setVisible(false);
		setProfileImageButton.setVisible(false);
	}
	
	imageOptionsContainer.add(setProfileImageButton);

	imageEditForm.add(imageOptionsContainer);

	removeConfirmContainer = new WebMarkupContainer("galleryRemoveImageConfirmContainer");
	removeConfirmContainer.setOutputMarkupId(true);
	removeConfirmContainer.setOutputMarkupPlaceholderTag(true);

	Label removeConfirmLabel = new Label("removePictureConfirmLabel",
			new ResourceModel("pictures.removepicture.confirm"));
	removeConfirmContainer.add(removeConfirmLabel);

	AjaxFallbackButton removeConfirmButton = createRemoveConfirmButton(
			userId, image, (int) galleryPageIndex, formFeedback,
			imageEditForm);
	//removeConfirmButton.add(new FocusOnLoadBehaviour());
	removeConfirmContainer.add(removeConfirmButton);

	AjaxFallbackButton removeCancelButton = createRemoveCancelButton(imageEditForm);
	removeConfirmContainer.add(removeCancelButton);

	removeConfirmContainer.setVisible(false);
	imageEditForm.add(removeConfirmContainer);
	
	setProfileImageConfirmContainer = new WebMarkupContainer("gallerySetProfileImageConfirmContainer");
	setProfileImageConfirmContainer.setOutputMarkupId(true);
	setProfileImageConfirmContainer.setOutputMarkupPlaceholderTag(true);
	
	Label setProfileImageConfirmLabel = new Label("setProfileImageConfirmLabel",
			new ResourceModel("pictures.setprofileimage.confirm"));
	setProfileImageConfirmContainer.add(setProfileImageConfirmLabel);

	
	AjaxFallbackButton setProfileImageConfirmButton = createSetProfileImageConfirmButton(
			userId, image, (int) galleryPageIndex, formFeedback,
			imageEditForm);
	
	//setProfileImageConfirmButton.add(new FocusOnLoadBehaviour());
	setProfileImageConfirmContainer.add(setProfileImageConfirmButton);
	
	AjaxFallbackButton setProfileImageCancelButton = createSetProfileImageCancelButton(imageEditForm);
	setProfileImageConfirmContainer.add(setProfileImageCancelButton);

	setProfileImageConfirmContainer.setVisible(false);
	imageEditForm.add(setProfileImageConfirmContainer);
	
	add(new GalleryImageRenderer("galleryImageMainRenderer", image
			.getMainResource()));
}