Java Code Examples for org.apache.wicket.markup.html.form.Form

The following examples show how to use org.apache.wicket.markup.html.form.Form. These examples are extracted from open source projects. 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 Project: ontopia   Source File: FunctionBoxesPanel.java    License: Apache License 2.0 6 votes vote down vote up
public FunctionBoxesPanel(String id) {
  super(id);
  
  Form<Object> form = new Form<Object>("functionBoxesForm");
  add(form);
  
  List<Component> list = getFunctionBoxesList("functionBox"); 
  ListView<Component> functionBoxes = new ListView<Component>("functionBoxesList", list) {
    @Override
    protected void populateItem(ListItem<Component> item) {
      item.add(item.getModelObject());
    }
  };
  functionBoxes.setVisible(!list.isEmpty());
  form.add(functionBoxes);
}
 
Example 2
Source Project: nextreports-server   Source File: AnalysisPanel.java    License: Apache License 2.0 6 votes vote down vote up
public AnalysisPanel(String id) {
super(id, new SelectedAnalysisModel());				
setOutputMarkupId(true);    
addToolbar();            

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

dataProvider = new AnalysisDataProvider(getModel());
xlsResource = new XlsResource(dataProvider);
xlsxResource = new XlsxResource(dataProvider);
csvResource = new CsvResource(dataProvider);
submitForm.add(createTablePanel(dataProvider));   
      
      addLinks(submitForm);
  }
 
Example 3
/**
 * @see org.projectforge.web.dialog.ModalDialog#init()
 */
@SuppressWarnings("serial")
@Override
public void init()
{
  init(new Form<String>(getFormId()));
  calendarPageSupport = new CalendarPageSupport((ISelectCallerPage) getPage());
  timesheetsCalendar.setTitle(getString("plugins.teamcal.timeSheetCalendar"));
  timesheetsCalendar.setId(TIMESHEET_CALENDAR_ID);
  // confirm
  setCloseButtonTooltip(null, new ResourceModel("plugins.teamcal.calendar.filterDialog.closeButton.tooltip"));
  insertNewAjaxActionButton(new AjaxCallback() {
    @Override
    public void callback(final AjaxRequestTarget target)
    {
      filter.remove(filter.getActiveTemplateEntry());
      close(target);
      onClose(target);
    }
  }, 1, getString("delete"), SingleButtonPanel.DELETE);
}
 
Example 4
Source Project: nextreports-server   Source File: NextFeedbackPanel.java    License: Apache License 2.0 6 votes vote down vote up
public NextFeedbackPanel(String s, final Form<?> form) {
    super(s);
    
    if (form != null) {
        setFilter(new IFeedbackMessageFilter() {
        	
private static final long serialVersionUID = 1L;

public boolean accept(FeedbackMessage message) {
                final List<FormComponent<?>> components = getFormComponents(form);
                return !components.contains(message.getReporter());
            }

        });
    }
}
 
Example 5
Source Project: inception   Source File: ActiveLearningSidebar.java    License: Apache License 2.0 6 votes vote down vote up
private void actionStartSession(AjaxRequestTarget target, Form<?> form)
{
    ActiveLearningUserState alState = alStateModel.getObject();
    AnnotatorState state = getModelObject();
    
    // Start new session
    alState.setSessionActive(true);

    refreshSuggestions();

    moveToNextRecommendation(target, false);

    String userName = state.getUser().getUsername();
    Project project = state.getProject();
    recommendationService.setPredictForAllDocuments(userName, project, true);
    applicationEventPublisherHolder.get().publishEvent(new ActiveLearningSessionStartedEvent(
            this, project, userName));
}
 
Example 6
Source Project: Orienteer   Source File: DefaultRestorePasswordPanel.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onInitialize() {
    super.onInitialize();
    Form<?> form = new Form<>("form");

    TextField<String> passwordField = new PasswordTextField("password", passwordModel);
    TextField<String> confirmPasswordField = new PasswordTextField("confirmPassword", Model.of(""));

    form.add(passwordField);
    form.add(confirmPasswordField);
    form.add(new EqualPasswordInputValidator(passwordField, confirmPasswordField));
    form.add(createRestoreButton("restoreButton"));

    add(createFeedbackPanel("feedback"));
    add(form);

    setOutputMarkupPlaceholderTag(true);
}
 
Example 7
Source Project: nextreports-server   Source File: CheckTablePanel.java    License: Apache License 2.0 6 votes vote down vote up
public CheckTablePanel(String id, List<IColumn<T, String>> columns, ISortableDataProvider<T, String> provider, int rows) {
    super(id);

    group = new CheckGroup<T>("group", marked);

    this.dataTable = new BaseTable<T>("table", createTableColumns(columns), provider, rows) {

        @Override
        protected Item<T> newRowItem(String s, int i, IModel<T> entityIModel) {
            Item<T> item = super.newRowItem(s, i, entityIModel);
            return newRowTableItem(entityIModel, item);
        }

    };
    
    Form<T> form = new Form<T>("form");
    group.add(dataTable);
    form.add(group);
    add(form);
}
 
Example 8
Source Project: syncope   Source File: LogsITCase.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void updateCoreLogs() {
    TESTER.clickLink("body:content:tabbedPanel:tabs-container:tabs:0:link");
    TESTER.assertComponent(CONTAINER_PATH, WebMarkupContainer.class);

    Component result = searchLog(KEY, CONTAINER_PATH, "io.swagger");
    assertNotNull(result);

    TESTER.getRequest().setMethod(Form.METHOD_GET);
    TESTER.getRequest().addParameter(
            result.getPageRelativePath() + ":fields:1:field:dropDownChoiceField", "6");
    TESTER.assertComponent(
            result.getPageRelativePath() + ":fields:1:field:dropDownChoiceField", DropDownChoice.class);
    TESTER.executeAjaxEvent(
            result.getPageRelativePath() + ":fields:1:field:dropDownChoiceField", Constants.ON_CHANGE);

    assertSuccessMessage();
}
 
Example 9
/**
 * @see org.apache.wicket.Component#onInitialize()
 */
@Override
protected void onInitialize()
{
  super.onInitialize();
  final Form<Void> colorForm = new Form<Void>("colorForm");
  add(colorForm);
  final TextField<String> colorField = new TextField<String>("color", new PropertyModel<String>(this, "selectedColor"));
  colorField.add(new AjaxFormComponentUpdatingBehavior("onChange") {
    private static final long serialVersionUID = 1L;

    /**
     * @see org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior#onUpdate(org.apache.wicket.ajax.AjaxRequestTarget)
     */
    @Override
    protected void onUpdate(final AjaxRequestTarget target)
    {
      onColorUpdate(selectedColor);
    }
  });
  colorForm.add(colorField);
  // colorpicker js
  final JavaScriptTemplate jsTemplate = new JavaScriptTemplate(new PackageTextTemplate(ColorPickerPanel.class, "ColorPicker.js.template"));
  final String javaScript = jsTemplate.asString(new MicroMap<String, String>("markupId", colorField.getMarkupId()));
  add(new Label("template", javaScript).setEscapeModelStrings(false));
}
 
Example 10
Source Project: webanno   Source File: ColoringRulesConfigurationPanel.java    License: Apache License 2.0 6 votes vote down vote up
public ColoringRulesConfigurationPanel(String aId, IModel<AnnotationLayer> aModel,
        IModel<List<ColoringRule>> aColoringRules)
{
    super(aId, aModel);
    
    coloringRules = aColoringRules;
    
    Form<ColoringRule> coloringRulesForm = new Form<>("coloringRulesForm",
            CompoundPropertyModel.of(new ColoringRule()));
    add(coloringRulesForm);

    coloringRulesContainer = new WebMarkupContainer("coloringRulesContainer");
    coloringRulesContainer.setOutputMarkupPlaceholderTag(true);
    coloringRulesForm.add(coloringRulesContainer);

    coloringRulesContainer.add(new TextField<String>("pattern"));
    // We cannot make the color field a required one here because then we'd get a message
    // about color not being set when saving the entire feature details form!
    coloringRulesContainer.add(new ColorPickerTextField("color")
            .add(new PatternValidator("#[0-9a-fA-F]{6}")));
    coloringRulesContainer
            .add(new LambdaAjaxSubmitLink<>("addColoringRule", this::addColoringRule));
            
    coloringRulesContainer.add(createKeyBindingsList("coloringRules", coloringRules));
}
 
Example 11
Source Project: inception   Source File: StatementsPanel.java    License: Apache License 2.0 6 votes vote down vote up
private void setUpDetailPreference(StatementDetailPreference aDetailPreference)
{
    StatementDetailPreference defaultPreference = StatementDetailPreference.BASIC;
    
    boolean isDetailPreferenceUserDefinable = aDetailPreference == null;
    detailPreference = Model.of(isDetailPreferenceUserDefinable
            ? defaultPreference : aDetailPreference);        
    
    // the form for setting the detail preference (and its radio group) is only shown if the
    // detail preference is user-definable
    Form<StatementDetailPreference> form = new Form<StatementDetailPreference>(
            "detailPreferenceForm");
    form.add(LambdaBehavior
            .onConfigure(_this -> _this.setVisible(isDetailPreferenceUserDefinable)));
    add(form);
    
    // radio choice for statement detail preference
    BootstrapRadioGroup<StatementDetailPreference> choice = new BootstrapRadioGroup<>(
            "detailPreferenceChoice", Arrays.asList(StatementDetailPreference.values()));
    choice.setModel(detailPreference);
    choice.setChoiceRenderer(new EnumRadioChoiceRenderer<>(Buttons.Type.Default, this));
    choice.add(new LambdaAjaxFormSubmittingBehavior("change",
            this::actionStatementDetailPreferencesChanged));
    form.add(choice);
}
 
Example 12
Source Project: inception   Source File: StatementEditor.java    License: Apache License 2.0 6 votes vote down vote up
private void actionSave(AjaxRequestTarget aTarget, Form<KBStatement> aForm) {
    KBStatement modifiedStatement = aForm.getModelObject();
    try {
        String language = aForm.getModelObject().getLanguage() != null
            ? aForm.getModelObject().getLanguage()
            : kbModel.getObject().getDefaultLanguage();
        modifiedStatement.setLanguage(language);

        // persist the modified statement and replace the original, unchanged model
        kbService.upsertStatement(kbModel.getObject(), modifiedStatement);
        statement.setObject(modifiedStatement);
        // switch back to ViewMode and send notification to listeners
        actionCancelExistingStatement(aTarget);
        send(getPage(), Broadcast.BREADTH,
                new AjaxStatementChangedEvent(aTarget, statement.getObject()));
    }
    catch (RepositoryException e) {
        error("Unable to update statement: " + e.getLocalizedMessage());
        LOG.error("Unable to update statement.", e);
        aTarget.addChildren(getPage(), IFeedback.class);
    }
}
 
Example 13
Source Project: nextreports-server   Source File: DaysValidator.java    License: Apache License 2.0 6 votes vote down vote up
public void validate(Form form) {
	// we have a choice to validate the type converted values or the raw
	// input values, we validate the raw input
	final FormComponent formComponent1 = components[0];
	final FormComponent formComponent2 = components[1];

       String s1 = formComponent1.getInput();
       String s2 = formComponent2.getInput();

       // disabled components
       if ( (s1 == null) && (s2 == null)) {
          return; 
       }

       // must have one and only one selected
       if ("".equals(s1) && "".equals(s2)) {
           error(formComponent2, resourceKey() + "." + "bothnull");
       }  else if (!"".equals(s1) && !"".equals(s2)) {
           error(formComponent2, resourceKey() + "." + "bothnotnull");
       }
}
 
Example 14
Source Project: webanno   Source File: ConfirmationDialog.java    License: Apache License 2.0 6 votes vote down vote up
protected void onConfirmInternal(AjaxRequestTarget aTarget, Form<State> aForm)
{
    State state = aForm.getModelObject();
    
    boolean closeOk = true;
    
    // Invoke callback if one is defined
    if (confirmAction != null) {
        try {
            confirmAction.accept(aTarget);
        }
        catch (Exception e) {
            LoggerFactory.getLogger(getPage().getClass()).error("Error: " + e.getMessage(), e);
            state.feedback = "Error: " + e.getMessage();
            aTarget.add(aForm);
            closeOk = false;
        }
    }
    
    if (closeOk) {
        close(aTarget);
    }
}
 
Example 15
@Override
protected Component createBody(String wicketId) {
	DelegatedMarkupPanel body = new DelegatedMarkupPanel(wicketId, ProjectVersionFormPopupPanel.class);
	
	form = new Form<ProjectVersion>("form", getModel());
	body.add(form);
	
	TextField<String> versionField = new TextField<String>("version", BindingModel.of(getModel(), Binding.projectVersion().version())) {
		private static final long serialVersionUID = 1L;

		@Override
		protected void onConfigure() {
			super.onConfigure();
			setVisible(ProjectVersionFormPopupPanel.this.isAddMode());
		}
	};
	versionField.setLabel(new ResourceModel("project.version.field.version"));
	versionField.setRequired(isAddMode());
	versionField.add(new ProjectVersionPatternValidator());
	form.add(versionField);
	
	form.add(new VersionAdditionalInformationFormComponentPanel("additionalInformationPanel",
			BindingModel.of(getModel(), Binding.projectVersion().additionalInformation())));
	
	return body;
}
 
Example 16
Source Project: Orienteer   Source File: AbstractFormWidget.java    License: Apache License 2.0 6 votes vote down vote up
public AbstractFormWidget(String id, IModel<ODocument> model, IModel<ODocument> widgetDocumentModel) {
	super(id, model, widgetDocumentModel);
	formKey = obtainFormKey();
	String formKeyStr = formKey.toString();
	add(new Label("formKey", formKeyStr));
	setVisible(formKey.isValid());
	formDocumentModel = new ODocumentModel(resolveODocument(formKey));
	
	Form<ODocument> form = new Form<ODocument>("form", getModel());
	IModel<List<OProperty>> propertiesModel = new LoadableDetachableModel<List<OProperty>>() {
		@Override
		protected List<OProperty> load() {
			return oClassIntrospector.listProperties(formDocumentModel.getObject().getSchemaClass(), IOClassIntrospector.DEFAULT_TAB, false);
		}
	};
	propertiesStructureTable = new OrienteerStructureTable<ODocument, OProperty>("properties", formDocumentModel, propertiesModel){

				@Override
				protected Component getValueComponent(String id,
						IModel<OProperty> rowModel) {
					return new ODocumentMetaPanel<Object>(id, getModeModel(), formDocumentModel, rowModel);
				}
	};
	form.add(propertiesStructureTable);
	add(form);
}
 
Example 17
Source Project: inception   Source File: CurationSidebar.java    License: Apache License 2.0 6 votes vote down vote up
private void merge(AjaxRequestTarget aTarget, Form<Void> aForm)
{
    AnnotatorState state = getModelObject();
    User currentUser = userRepository.getCurrentUser();
    updateCurator(state, currentUser);
    // update selected users
    updateUsers(state);
    long projectId = state.getProject().getId();
    Collection<User> users = selectedUsers.getModelObject();
    curationService.updateMergeStrategy(currentUser.getUsername(), projectId,
            autoMergeStrat);
    mergeConfirm.setConfirmAction((target, form) -> {
        boolean mergeIncomplete = form.getModelObject().isMergeIncompleteAnnotations();
        doMerge(state, state.getUser().getUsername(), users, mergeIncomplete);
        target.add(annoPage);
    });
    mergeConfirm.show(aTarget);
}
 
Example 18
Source Project: Orienteer   Source File: OPropertyConfigurationWidget.java    License: Apache License 2.0 6 votes vote down vote up
public OPropertyConfigurationWidget(String id, IModel<OProperty> model,
		IModel<ODocument> widgetDocumentModel) {
	super(id, model, widgetDocumentModel);
	
	Form<OProperty> form = new Form<OProperty>("form");
	structureTable  = new OrienteerStructureTable<OProperty, String>("attributes", getModel(), OPropertyMetaPanel.OPROPERTY_ATTRS) {

		@Override
		protected Component getValueComponent(String id, final IModel<String> rowModel) {
			return new OPropertyMetaPanel<Object>(id, getModeModel(), OPropertyConfigurationWidget.this.getModel(), rowModel);
		}
	};

	form.add(structureTable);
	
	add(form);
}
 
Example 19
Source Project: Orienteer   Source File: OClassSearchPanel.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onInitialize() {
    super.onInitialize();
    setOutputMarkupPlaceholderTag(true);
    if ((selectedClassModel == null || selectedClassModel.getObject() == null) && !classesGetter.get().isEmpty())
        selectedClassModel = new OClassModel(classesGetter.get().get(0));

    Form<String> form = new Form<>("form", getModel());
    TextField<String> field = new TextField<>("query", getModel());
    field.setOutputMarkupId(true);
    field.add(AttributeModifier.replace("placeholder", new ResourceModel("page.search.placeholder").getObject()));
    form.add(field);
    form.add(createSearchButton("search"));
    form.add(createTabsPanel("tabs"));
    form.add(resultsContainer = createResultsContainer("resultsContainer"));
    add(form);
    resultsContainer.add(createEmptyLabel("resultsLabel"));
    prepareResults();
}
 
Example 20
private boolean save(Form form) {
	
	// get the backing model
	UserProfile userProfile = (UserProfile) form.getModelObject();
	
	// save social networking information
	SocialNetworkingInfo socialNetworkingInfo = new SocialNetworkingInfo(userProfile.getUserUuid());
	
	String tFacebook = ProfileUtils.truncate(userProfile.getSocialInfo().getFacebookUrl(), 255, false);
	String tLinkedin = ProfileUtils.truncate(userProfile.getSocialInfo().getLinkedinUrl(), 255, false);
	String tMyspace = ProfileUtils.truncate(userProfile.getSocialInfo().getMyspaceUrl(), 255, false);
	String tSkype = ProfileUtils.truncate(userProfile.getSocialInfo().getSkypeUsername(), 255, false);
	String tTwitter = ProfileUtils.truncate(userProfile.getSocialInfo().getTwitterUrl(), 255, false);

	socialNetworkingInfo.setFacebookUrl(tFacebook);
	socialNetworkingInfo.setLinkedinUrl(tLinkedin);
	socialNetworkingInfo.setMyspaceUrl(tMyspace);
	socialNetworkingInfo.setSkypeUsername(tSkype);
	socialNetworkingInfo.setTwitterUrl(tTwitter);
	
	return profileLogic.saveSocialNetworkingInfo(socialNetworkingInfo);
	
}
 
Example 21
public void validate(Form form) {
	// we have a choice to validate the type converted values or the raw
	// input values, we validate the raw input
	final FormComponent formComponent1 = components[0];
	final FormComponent formComponent2 = components[1];

       String s1 = formComponent1.getInput();
       String s2 = formComponent2.getInput();

       // disabled components
       if ( (s1 == null) || s1.trim().equals("") || (s2 == null) || s2.trim().equals("")) {
       	error(formComponent2, resourceKey() + "." + "notnull"); 
       }  else  {
       	Integer i1 = Integer.parseInt(s1);
       	Integer i2 = Integer.parseInt(s2);
       	if (i1.intValue() > i2.intValue()) {
       		error(formComponent2, resourceKey() + "." + "invalid");
       	}           
       }
}
 
Example 22
Source Project: sakai   Source File: GalleryImageEdit.java    License: 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 23
Source Project: Orienteer   Source File: OClassConfigurationWidget.java    License: Apache License 2.0 5 votes vote down vote up
public OClassConfigurationWidget(String id, IModel<OClass> model,
		IModel<ODocument> widgetDocumentModel) {
	super(id, model, widgetDocumentModel);
	Form<OClass> form = new TransactionlessForm<OClass>("form");
	structureTable  = new OrienteerStructureTable<OClass, String>("attributes", getModel(), OClassMetaPanel.OCLASS_ATTRS) {

		@Override
		protected Component getValueComponent(String id, final IModel<String> rowModel) {
			return new OClassMetaPanel<Object>(id, getModeModel(), OClassConfigurationWidget.this.getModel(), rowModel);
		}
		
	};
	structureTable.addCommand(new EditSchemaCommand<OClass>(structureTable, getModeModel()));
	structureTable.addCommand(new SaveSchemaCommand<OClass>(structureTable, getModeModel(), getModel()));
	
	form.add(structureTable);
	add(form);
	
	addCommand(new BookmarkablePageLinkCommand<OClass>(newCommandId(), "class.browse", BrowseOClassPage.class) {
		@Override
		public PageParameters getPageParameters() {
			return BrowseOClassPage.preparePageParameters(OClassConfigurationWidget.this.getModelObject(), DisplayMode.VIEW);
		}
		
		@Override
		protected void onConfigure() {
			super.onConfigure();
			setVisible(OSchemaUtils.isNotNullOrPrototype(OClassConfigurationWidget.this.getModelObject()));
		}
	});
}
 
Example 24
Source Project: sakai   Source File: ViewPicture.java    License: Educational Community License v2.0 5 votes vote down vote up
public ViewPicture(GalleryImage galleryImage) {
	configureFeedback();

	Label galleryImageHeading = new Label("galleryImageHeading",
			new Model<String>(galleryImage.getDisplayName()));
	add(galleryImageHeading);

	Form galleryImageForm = new Form("galleryImageForm");
	galleryImageForm.setOutputMarkupId(true);
	add(galleryImageForm);

	GalleryImageRenderer galleryImageRenderer = new GalleryImageRenderer(
			"galleryImageRenderer", galleryImage.getMainResource());
	galleryImageForm.add(galleryImageRenderer);
}
 
Example 25
Source Project: openmeetings   Source File: LabelsForm.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onNewSubmit(AjaxRequestTarget target, Form<?> f) {
	key = null;
	value = null;
	setModelObject(new StringLabel(key, value));
	target.add(this);
}
 
Example 26
Source Project: webanno   Source File: KeyBindingsConfigurationPanel.java    License: Apache License 2.0 5 votes vote down vote up
public KeyBindingsConfigurationPanel(String aId, IModel<AnnotationFeature> aModel,
        IModel<List<KeyBinding>> aKeyBindings)
{
    super(aId, aModel);
    
    keyBindings = aKeyBindings;
    
    Form<KeyBinding> keyBindingForm = new Form<>("keyBindingForm",
            CompoundPropertyModel.of(new KeyBinding()));
    add(keyBindingForm);

    keyBindingsContainer = new WebMarkupContainer("keyBindingsContainer");
    keyBindingsContainer.setOutputMarkupPlaceholderTag(true);
    keyBindingForm.add(keyBindingsContainer);

    // We cannot make the key-combo field a required one here because then we'd get a message
    // about keyCombo not being set when saving the entire feature details form!
    keyBindingsContainer.add(new TextField<String>("keyCombo")
            .add(new KeyComboValidator()));
    keyBindingsContainer.add(new LambdaAjaxSubmitLink<>("addKeyBinding", this::addKeyBinding));
    
    AnnotationFeature feature = aModel.getObject();
    FeatureSupport<?> fs = featureSupportRegistry.getFeatureSupport(feature);
    featureState = Model.of(new FeatureState(VID.NONE_ID, feature, null));
    if (feature.getTagset() != null) {
        featureState.getObject().tagset = schemaService.listTags(feature.getTagset());
    }
    // We are adding only the focus component here because we do not want to display the label
    // which usually goes along with the feature editor. This assumes that there is a sensible
    // focus component... might not be the case for some multi-component editors.
    editor = fs.createEditor("value", this, null, null, featureState);
    editor.addFeatureUpdateBehavior();
    editor.getLabelComponent().setVisible(false);
    keyBindingsContainer.add(editor);
    
    keyBindingsContainer.add(createKeyBindingsList("keyBindings", keyBindings));
}
 
Example 27
Source Project: webanno   Source File: ProjectDetailPanel.java    License: Apache License 2.0 5 votes vote down vote up
private void actionSave(AjaxRequestTarget aTarget, Form<Project> aForm)
{
    aTarget.add(getPage());
    // aTarget.add(((ApplicationPageBase) getPage()).getPageContent());
    // aTarget.addChildren(getPage(), IFeedback.class);
    
    Project project = aForm.getModelObject();
    if (isNull(project.getId())) {
        try {
            String username = SecurityContextHolder.getContext().getAuthentication().getName();
            projectService.createProject(project);

            projectService.createProjectPermission(
                    new ProjectPermission(project, username, PermissionLevel.MANAGER));
            projectService.createProjectPermission(
                    new ProjectPermission(project, username, PermissionLevel.CURATOR));
            projectService.createProjectPermission(
                    new ProjectPermission(project, username, PermissionLevel.ANNOTATOR));

            projectService.initializeProject(project);
        }
        catch (IOException e) {
            error("Project repository path not found " + ":"
                    + ExceptionUtils.getRootCauseMessage(e));
            LOG.error("Project repository path not found " + ":"
                    + ExceptionUtils.getRootCauseMessage(e));
        }
    }
    else {
        projectService.updateProject(project);
    }

    Session.get().setMetaData(CURRENT_PROJECT, project);
}
 
Example 28
Source Project: openmeetings   Source File: LdapForm.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onRefreshSubmit(AjaxRequestTarget target, Form<?> form) {
	LdapConfig ldapConfig = this.getModelObject();
	if (ldapConfig.getId() != null) {
		ldapConfig = ldapDao.get(ldapConfig.getId());
	} else {
		ldapConfig = new LdapConfig();
	}
	this.setModelObject(ldapConfig);
	target.add(this);
}
 
Example 29
Source Project: nextreports-server   Source File: AnalysisPanel.java    License: Apache License 2.0 5 votes vote down vote up
private void addLinks(Form<Void> submitForm) {
	submitForm.add(getCreateLink());    
	submitForm.add(getSelectLink());    	
	submitForm.add(getSortLink());
	submitForm.add(getFilterLink());
	submitForm.add(getGroupLink());
	submitForm.add(getPaginateLink());
	
	//submitForm.add(getCsvLink());
	//submitForm.add(getXlsLink());
	submitForm.add(getXlsxLink());
	submitForm.add(getSaveLink());
	submitForm.add(getFreezeLink());
}
 
Example 30
@Override
public void init()
{
  final Form<Void> form = new Form<Void>(getFormId());
  init(form);
  if (messageComponent == null) {
    setMessage("");
  }
  if (type != null) {
    messageComponent.add(AttributeModifier.append("class", type.getClassAttrValue() + " alert-danger"));
  }
  if (titleSet == false) {
    if (type == null) {
      setTitle(getString("dialog.title.message"));
    } else if (type == DivType.ALERT_ERROR) {
      setTitle(getString("dialog.title.error"));
    } else if (type == DivType.ALERT_WARNNING) {
      setTitle(getString("dialog.title.warning"));
    } else if (type == DivType.ALERT_INFO) {
      setTitle(getString("dialog.title.information"));
    } else if (type == DivType.ALERT_SUCCESS) {
      setTitle(getString("dialog.title.success"));
    } else {
      setTitle(getString("dialog.title.message"));
    }
  }
}