Java Code Examples for org.apache.wicket.markup.html.WebMarkupContainer

The following are top voted examples for showing how to use org.apache.wicket.markup.html.WebMarkupContainer. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: gitplex-mit   File: AssistPanel.java   View source code 7 votes vote down vote up
private Component newSuggestionItem(String itemId, InputCompletion suggestion) {
	WebMarkupContainer item = new WebMarkupContainer(itemId);
	WebMarkupContainer link = new WebMarkupContainer("link");
	Range matchRange = suggestion.getMatchRange();
	String label = suggestion.getLabel();
	if (matchRange != null) {
		String prefix = StringEscapeUtils.escapeHtml4(label.substring(0, matchRange.getFrom()));
		String suffix = StringEscapeUtils.escapeHtml4(label.substring(matchRange.getTo()));
		String matched = StringEscapeUtils.escapeHtml4(label.substring(matchRange.getFrom(), matchRange.getTo()));
		link.add(new Label("label", prefix + "<b>" + matched + "</b>" + suffix).setEscapeModelStrings(false));
	} else {
		link.add(new Label("label", label));
	}
	item.add(link);
	if (suggestion.getDescription() != null)
		item.add(new Label("description", suggestion.getDescription()));
	else
		item.add(new Label("description").setVisible(false));
	item.add(AttributeAppender.append("data-content", suggestion.complete(inputStatus).getContent()));
	item.add(AttributeAppender.append("data-caret", suggestion.getCaret()));
	item.setOutputMarkupId(true);
	return item;
}
 
Example 2
Project: gitplex-mit   File: RequestOverviewPage.java   View source code 7 votes vote down vote up
private WebMarkupContainer newManageContainer() {
	WebMarkupContainer container = new WebMarkupContainer("manage");
	container.setVisible(SecurityUtils.canModify(getPullRequest()));
	container.add(new Link<Void>("synchronize") {

		@Override
		public void onClick() {
			GitPlex.getInstance(PullRequestManager.class).check(getPullRequest());
			Session.get().success("Pull request is synchronized");
		}
		
	});
	container.add(new Link<Void>("delete") {

		@Override
		public void onClick() {
			PullRequest request = getPullRequest();
			GitPlex.getInstance(PullRequestManager.class).delete(request);
			Session.get().success("Pull request #" + request.getNumber() + " is deleted");
			setResponsePage(RequestListPage.class, RequestListPage.paramsOf(getProject()));
		}
		
	}.add(new ConfirmOnClick("Do you really want to delete this pull request?")));
	return container;
}
 
Example 3
Project: gitplex-mit   File: ConcreteListPropertyEditor.java   View source code 6 votes vote down vote up
@SuppressWarnings("unchecked")
private List<PropertyEditor<Serializable>> getPropertyEditorsAtRow(int index) {
	WebMarkupContainer table = (WebMarkupContainer) get("listEditor");
	RepeatingView rows = (RepeatingView) table.get("elements");

	int currentIndex = 0;
	Iterator<Component> it = rows.iterator();
	Component row = it.next();
	while (currentIndex++ < index) {
		row = it.next();
	}
	
	List<PropertyEditor<Serializable>> propertyEditors = new ArrayList<>();
	RepeatingView columns = (RepeatingView) row.get("properties");
	for (Component column: columns) {
		propertyEditors.add((PropertyEditor<Serializable>) column.get("propertyEditor"));
	}
	
	return propertyEditors;
}
 
Example 4
Project: gitplex-mit   File: ContributorPanel.java   View source code 6 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	
	add(new UserLink("author", author));
	if (committer.getEmailAddress().equals(author.getEmailAddress())
			&& committer.getName().equals(author.getName())) {
		add(new WebMarkupContainer("committer").setVisible(false));
	} else {
		add(new UserLink("committer", committer));
	}
	if (withDate)
		add(new Label("date", DateUtils.formatAge(committer.getWhen())));
	else
		add(new WebMarkupContainer("date").setVisible(false));
}
 
Example 5
Project: gitplex-mit   File: AjaxActionTab.java   View source code 6 votes vote down vote up
@Override
public Component render(String componentId) {
	return new ActionTabLink(componentId, this) {

		@Override
		protected WebMarkupContainer newLink(String id, ActionTab tab) {
			return new AjaxLink<Void>("link") {

				@Override
				public void onClick(AjaxRequestTarget target) {
					selectTab(this);
				}
				
			};
		}
		
	};
}
 
Example 6
Project: gitplex-mit   File: CodeCommentPanel.java   View source code 6 votes vote down vote up
private WebMarkupContainer newAddReplyContainer() {
	WebMarkupContainer addReplyContainer = new Fragment("addReply", "addReplyFrag", this) {

		@Override
		protected void onConfigure() {
			super.onConfigure();
			setVisible(SecurityUtils.getUser() != null);
		}
		
	};
	addReplyContainer.setOutputMarkupId(true);
	addReplyContainer.add(new AjaxLink<Void>("reply") {

		@Override
		public void onClick(AjaxRequestTarget target) {
			onAddReply(target, false, null);
		}
		
	});
	return addReplyContainer;
}
 
Example 7
Project: gitplex-mit   File: RequestOverviewPage.java   View source code 6 votes vote down vote up
private Component newSinceChangesRow(String id, Date sinceDate) {
	WebMarkupContainer row = new WebMarkupContainer(id);
	row.setOutputMarkupId(true);
	row.add(AttributeAppender.append("class", " non-discussion"));
	
	WebMarkupContainer avatarColumn = new WebMarkupContainer("avatar");
	avatarColumn.add(new WebMarkupContainer("avatar"));
	row.add(avatarColumn);
	
	WebMarkupContainer contentColumn = new Fragment("content", "sinceChangesRowContentFrag", this);
	contentColumn.add(new SinceChangesLink("sinceChanges", requestModel, sinceDate));
	row.add(contentColumn);
	
	row.add(AttributeAppender.append("class", "since-changes"));
	
	return row;
}
 
Example 8
Project: gitplex-mit   File: SourceViewPanel.java   View source code 6 votes vote down vote up
@Override
protected WebMarkupContainer newOptions(String id) {
	sourceFormat = new SourceFormatPanel(id, null, new OptionChangeCallback() {
		
		@Override
		public void onOptioneChange(AjaxRequestTarget target) {
			String script = String.format("gitplex.server.sourceView.onTabSizeChange(%s);", sourceFormat.getTabSize());
			target.appendJavaScript(script);
		}
		
	}, new OptionChangeCallback() {

		@Override
		public void onOptioneChange(AjaxRequestTarget target) {
			String script = String.format("gitplex.server.sourceView.onLineWrapModeChange('%s');", sourceFormat.getLineWrapMode());
			target.appendJavaScript(script);
		}
		
	});
	return sourceFormat;
}
 
Example 9
Project: gitplex-mit   File: SourceViewPanel.java   View source code 6 votes vote down vote up
@Override
public WebMarkupContainer newAdditionalActions(String id) {
	WebMarkupContainer actions = new Fragment(id, "actionsFrag", this);
	if (!symbols.isEmpty()) {
		actions.add(new CheckBox("outline", Model.of(isOutlineVisibleInitially())).add(new OnChangeAjaxBehavior() {

			@Override
			protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
				super.updateAjaxAttributes(attributes);
				attributes.setMethod(Method.POST);
			}

			@Override
			protected void onUpdate(AjaxRequestTarget target) {
				toggleOutline(target);
			}
			
		}));
	} else {
		actions.add(new WebMarkupContainer("outline").setVisible(false));
	}
	return actions;
}
 
Example 10
Project: gitplex-mit   File: ServerLogPage.java   View source code 6 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();

	add(new ResourceLink<Void>("download", new ServerLogResourceReference()));
	
	List<String> lines = ServerLogResource.readServerLog();		
	String content;
	if (lines.size() > MAX_DISPLAY_LINES) {
		add(new Label("warning", "Too many log entries, displaying recent " + MAX_DISPLAY_LINES));
		content = Joiner.on("\n").join(lines.subList(lines.size()-MAX_DISPLAY_LINES, lines.size()));
	} else {
		add(new WebMarkupContainer("warning").setVisible(false));
		content = Joiner.on("\n").join(lines);
	}
	
	add(new Label("logContent", content));
}
 
Example 11
Project: gitplex-mit   File: ServerInitPage.java   View source code 6 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();

	add(new Label("title", initStage.getMessage()));
	
	if (!initStage.getManualConfigs().isEmpty()) {
		List<ManualConfigStep> configSteps = new ArrayList<ManualConfigStep>();
		for (ManualConfig each: initStage.getManualConfigs())
			configSteps.add(new ManualConfigStep(each));
		add(new Wizard("wizard", configSteps) {

			@Override
			protected void finished() {
				WebSession.get().logout();
				User root = GitPlex.getInstance(UserManager.class).getRoot();
				SecurityUtils.getSubject().runAs(root.getPrincipals());
				throw new RestartResponseException(DashboardPage.class);
			}
			
		});
	} else {
		add(new WebMarkupContainer("wizard").setVisible(false));
	}
}
 
Example 12
Project: openNaEF   File: LocationViewPage.java   View source code 6 votes vote down vote up
private void populateNode() throws ExternalServiceException, IOException, RemoteException {
    ListView<NodeDto> list = new ListView<NodeDto>("nodeList", this.model) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<NodeDto> item) {
            NodeDto node = item.getModelObject();
            BookmarkablePageLink<Void> link = NodePageUtil.createNodeLink("nodeLink", node);
            item.add(link);
        }
    };
    add(list);
    WebMarkupContainer container = new WebMarkupContainer("nodeBlock");
    add(container);
    container.setVisible(this.model.isVisible());
}
 
Example 13
Project: engerek   File: RichHyperlinkConfigDialog.java   View source code 6 votes vote down vote up
public RichHyperlinkConfigDialog(String id, final RichHyperlinkType link, boolean isMenuItem, String titleKey){
    super(id);

    this.isMenuItem = isMenuItem;
    model = new LoadableModel<RichHyperlinkType>(false) {

        @Override
        protected RichHyperlinkType load() {
            return loadModel(link);
        }
    };

    setOutputMarkupId(true);
    setTitle(createStringResource(titleKey));
    showUnloadConfirmation(false);
    setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    setCookieName(RichHyperlinkConfigDialog.class.getSimpleName() + ((int) (Math.random() * 100)));
    setInitialWidth(625);
    setInitialHeight(400);
    setWidthUnit("px");

    WebMarkupContainer content = new WebMarkupContainer(getContentId());
    content.setOutputMarkupId(true);
    setContent(content);
}
 
Example 14
Project: engerek   File: PageDebugList.java   View source code 6 votes vote down vote up
private void addOrReplaceTable(RepositoryObjectDataProvider provider) {
	Form mainForm = (Form) get(ID_MAIN_FORM);

	BoxedTablePanel table = new BoxedTablePanel(ID_TABLE, provider, initColumns(provider.getType()),
			UserProfileStorage.TableId.CONF_DEBUG_LIST_PANEL,
			(int) getItemsPerPage(UserProfileStorage.TableId.CONF_DEBUG_LIST_PANEL)) {

		@Override
		protected WebMarkupContainer createHeader(String headerId) {
			return new SearchFragment(headerId, ID_TABLE_HEADER, PageDebugList.this, searchModel,
					resourcesModel);
		}

	};
	table.setOutputMarkupId(true);

	ConfigurationStorage storage = getSessionStorage().getConfiguration();
	table.setCurrentPage(storage.getPaging());

	mainForm.addOrReplace(table);
}
 
Example 15
Project: engerek   File: HelpInfoPanel.java   View source code 6 votes vote down vote up
public void initLayout(final String messageKey){
    WebMarkupContainer content = new WebMarkupContainer(ID_CONTENT);
    add(content);

    Label helpLabel = new Label(ID_HELP, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return getString(messageKey);
        }
    });
    helpLabel.setEscapeModelStrings(false);
    content.add(helpLabel);

    AjaxLink ok = new AjaxLink(ID_BUTTON_OK) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            closePerformed(target);
        }
    };
    content.add(ok);
}
 
Example 16
Project: engerek   File: WizardHelpDialog.java   View source code 6 votes vote down vote up
public void initLayout(WebMarkupContainer content){
    Label helpLabel = new Label(ID_HELP, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return getString(determineHelpKey());
        }
    });
    helpLabel.setEscapeModelStrings(false);
    content.add(helpLabel);

    AjaxLink ok = new AjaxLink(ID_BUTTON_OK) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            closePerformed(target);
        }
    };
    content.add(ok);
}
 
Example 17
Project: engerek   File: PageXmlDataReview.java   View source code 6 votes vote down vote up
private void initLayout(IModel<String> title, IModel<String> data){
    WebMarkupContainer container = new WebMarkupContainer(ID_ACE_EDITOR_CONTAINER);
    container.setOutputMarkupId(true);
    add(container);

    AceEditorPanel aceEditorPanel = new AceEditorPanel(ID_ACE_EDITOR_PANEL, title, data);
    aceEditorPanel.getEditor().setReadonly(true);
    aceEditorPanel.setOutputMarkupId(true);
    container.add(aceEditorPanel);

    AjaxButton back = new AjaxButton(ID_BUTTON_BACK, createStringResource("PageBase.button.back")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            redirectBack();
        }

    };
    add(back);
}
 
Example 18
Project: engerek   File: PageBase.java   View source code 6 votes vote down vote up
private void initDebugBarLayout() {
	DebugBar debugPanel = new DebugBar(ID_DEBUG_PANEL);
	add(debugPanel);

	WebMarkupContainer debugBar = new WebMarkupContainer(ID_DEBUG_BAR);
	debugBar.add(new VisibleEnableBehaviour() {
		private static final long serialVersionUID = 1L;

		@Override
		public boolean isVisible() {
			RuntimeConfigurationType runtime = getApplication().getConfigurationType();
			return RuntimeConfigurationType.DEVELOPMENT.equals(runtime);
		}
	});
	add(debugBar);

	AjaxButton clearCache = new AjaxButton(ID_CLEAR_CACHE, createStringResource("PageBase.clearCssCache")) {
		private static final long serialVersionUID = 1L;

		@Override
		public void onClick(AjaxRequestTarget target) {
			clearLessJsCache(target);
		}
	};
	debugBar.add(clearCache);
}
 
Example 19
Project: vlo-curation   File: FacetedSearchPage.java   View source code 6 votes vote down vote up
private WebMarkupContainer createNavigation(String id) {
    final WebMarkupContainer container = new WebMarkupContainer(id);
    container.setOutputMarkupId(true);
    container.add(new BreadCrumbPanel("breadcrumbs", getModel()));
    container.add(new TopLinksPanel("permalink", new PermaLinkModel(getPageClass(), getModel()), getTitleModel()) {

        @Override
        protected void onChange(AjaxRequestTarget target) {
            if (target != null) {
                target.add(container);
            }
        }

    });
    return container;
}
 
Example 20
Project: engerek   File: AssignmentEditorPanel.java   View source code 6 votes vote down vote up
protected void initLayout() {
	setOutputMarkupId(true);
	headerRow = new WebMarkupContainer(ID_HEADER_ROW);
	headerRow.add(AttributeModifier.append("class", createHeaderClassModel(getModel())));
	headerRow.setOutputMarkupId(true);
	add(headerRow);

	initHeaderRow();

	WebMarkupContainer body = new WebMarkupContainer(ID_BODY);
	body.setOutputMarkupId(true);
	body.add(new VisibleEnableBehaviour() {

		@Override
		public boolean isVisible() {
			AssignmentEditorDto editorDto = AssignmentEditorPanel.this.getModel().getObject();
			return !editorDto.isMinimized();
		}
	});
	add(body);

	initBodyLayout(body);
}
 
Example 21
Project: vlo-curation   File: BookmarkLinkPanel.java   View source code 6 votes vote down vote up
public BookmarkLinkPanel(String id, IModel<String> linkModel, IModel<String> pageTitleModel) {
    super(id);
    this.linkModel = linkModel;
    this.pageTitleModel = pageTitleModel;

    add(new ExternalLink("link", linkModel)
            .add(new Label("linkText", pageTitleModel)));
    add(new TextField("linkInput", linkModel));

    add(new WebMarkupContainer("bookmarkInstructions") {
        @Override
        protected void onConfigure() {
            setVisible(bookmarkMode);
        }

    });
    add(new WebMarkupContainer("copyInstructions") {
        @Override
        protected void onConfigure() {
            setVisible(copyMode);
        }

    });
}
 
Example 22
Project: vlo-curation   File: VloBasePage.java   View source code 6 votes vote down vote up
private void addComponents() {

        add(new BootstrapFeedbackPanel("feedback"));

        add(new WebMarkupContainer("header")
                // navbar in header
                .add(createHeaderMenu("menu"))
                // add 'class' attribute to header indicating version qualifier (e.g. 'beta')
                .add(new AttributeAppender("class", VloWicketApplication.get().getAppVersionQualifier(), " ")));

        add(new HideJavascriptFallbackControlsBehavior());

        // add Piwik tracker (if enabled)
        if (piwikConfig.isEnabled()) {
            add(new PiwikTracker("piwik", piwikConfig.getSiteId(), piwikConfig.getPiwikHost(), piwikConfig.getDomains()));
        } else {
            //empty placeholder
            add(new WebMarkupContainer("piwik"));
        }
    }
 
Example 23
Project: engerek   File: ConfigurationStep.java   View source code 6 votes vote down vote up
private void updateConfigurationTabs() {
	final com.evolveum.midpoint.web.component.form.Form form = getForm();
	TabbedPanel<ITab> tabbedPanel = getConfigurationTabbedPanel();
	List<ITab> tabs = tabbedPanel.getTabs().getObject();
	tabs.clear();

	List<ContainerWrapper> wrappers = configurationPropertiesModel.getObject();
	for (final ContainerWrapper wrapper : wrappers) {
		String tabName = getString(wrapper.getDisplayName(), null, wrapper.getDisplayName());
		tabs.add(new AbstractTab(new Model<>(tabName)) {
			@Override
			public WebMarkupContainer getPanel(String panelId) {
				return new PrismContainerPanel(panelId, new Model<>(wrapper), true, form, parentPage);
			}
		});
	}
	int i = tabbedPanel.getSelectedTab();
	if (i < 0 || i > tabs.size()) {
		i = 0;
	}
	tabbedPanel.setSelectedTab(i);
}
 
Example 24
Project: engerek   File: DashboardPanel.java   View source code 6 votes vote down vote up
private void initLayout(IModel<String> titleModel, String icon, String boxCssClasses) {
	if (boxCssClasses == null) {
    	boxCssClasses = GuiStyleConstants.CLASS_BOX_DEFAULT;
    }
	
    WebMarkupContainer dashboardParent = new WebMarkupContainer(ID_DASHBOARD_PARENT);
    dashboardParent.add(new AttributeAppender("class", " " + boxCssClasses));
    add(dashboardParent);

    WebMarkupContainer dashboardTitle = new WebMarkupContainer(ID_DASHBOARD_TITLE);
    dashboardParent.add(dashboardTitle);
    Label title = new Label(ID_TITLE);
    title.setRenderBodyOnly(true);
    title.setDefaultModel(titleModel);
    dashboardTitle.add(title);

    WebMarkupContainer dashboardContent = new WebMarkupContainer(ID_DASHBOARD_CONTENT);
    dashboardContent.add(getMainComponent(ID_CONTENT));
    dashboardParent.add(dashboardContent);
    
    WebMarkupContainer iconI = new WebMarkupContainer(ID_ICON);
    iconI.add(AttributeModifier.replace("class", icon));
    dashboardTitle.add(iconI);
}
 
Example 25
Project: engerek   File: CheckBoxHeaderColumn.java   View source code 6 votes vote down vote up
public static CheckBoxPanel findCheckBoxColumnHeader(DataTable table) {
    WebMarkupContainer topToolbars = table.getTopToolbars();
    ComponentHierarchyIterator iterator = topToolbars.visitChildren(TableHeadersToolbar.class);
    if (!iterator.hasNext()) {
        return null;
    }

    TableHeadersToolbar toolbar = (TableHeadersToolbar) iterator.next();
    // simple attempt to find checkbox which is header for our column
    // todo: this search will fail if there are more checkbox header columns (which is not supported now,
    // because Selectable.F_SELECTED is hardcoded all over the place...
    iterator = toolbar.visitChildren(CheckBoxPanel.class);
    while (iterator.hasNext()) {
        Component c = iterator.next();
        if (!c.getOutputMarkupId()) {
            continue;
        }

        return (CheckBoxPanel) c;
    }

    return null;
}
 
Example 26
Project: engerek   File: PageAccounts.java   View source code 6 votes vote down vote up
private void initTotals(Form form) {
    WebMarkupContainer totals = new WebMarkupContainer(ID_TOTALS);
    totals.setOutputMarkupId(true);

    totalModel = createTotalModel();
    deletedModel = createTotalsModel(SynchronizationSituationType.DELETED);
    unmatchedModel = createTotalsModel(SynchronizationSituationType.UNMATCHED);
    disputedModel = createTotalsModel(SynchronizationSituationType.DISPUTED);
    linkedModel = createTotalsModel(SynchronizationSituationType.LINKED);
    unlinkedModel = createTotalsModel(SynchronizationSituationType.UNLINKED);
    nothingModel = createTotalsModel(null);

    totals.add(new Label(ID_TOTAL, totalModel));
    totals.add(new Label(ID_DELETED, deletedModel));
    totals.add(new Label(ID_UNMATCHED, unmatchedModel));
    totals.add(new Label(ID_DISPUTED, disputedModel));
    totals.add(new Label(ID_LINKED, linkedModel));
    totals.add(new Label(ID_UNLINKED, unlinkedModel));
    totals.add(new Label(ID_NOTHING, nothingModel));

    form.add(totals);
}
 
Example 27
Project: engerek   File: PageSelfRegistration.java   View source code 6 votes vote down vote up
private void createPasswordPanel(WebMarkupContainer staticRegistrationForm) {
	// ProtectedStringType initialPassword = null;
	PasswordPanel password = new PasswordPanel(ID_PASSWORD,
			new PropertyModel<ProtectedStringType>(userModel, "credentials.password.value"), false, true);
	password.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
	password.getBaseFormComponent().setRequired(true);
	staticRegistrationForm.add(password);

	Label help = new Label(ID_TOOLTIP);
	final StringResourceModel tooltipText = createStringResource("PageSelfRegistration.password.policy");
	help.add(AttributeModifier.replace("title", tooltipText));
	help.add(new InfoTooltipBehavior());
	help.add(new VisibleEnableBehaviour() {
		private static final long serialVersionUID = 1L;

		@Override
		public boolean isVisible() {

			return StringUtils.isNotEmpty(tooltipText.getObject());
		}
	});
	staticRegistrationForm.add(help);
}
 
Example 28
Project: engerek   File: SynchronizationStep.java   View source code 6 votes vote down vote up
private void reactionEditPerformed(AjaxRequestTarget target, SynchronizationReactionType reaction){
WebMarkupContainer newContainer = new SynchronizationReactionEditor(ID_THIRD_ROW_CONTAINER, new Model<>(reaction), this, parentPage);
getThirdRowContainer().replaceWith(newContainer);

for (SynchronizationActionType action : reaction.getAction()) {
	if (action.getRef() != null) {
		warn(getString("SynchronizationStep.message.unsupportedActionFormat"));
		break;
	}
}

resetSelections(target);
syncDtoModel.getObject().setSelectedReaction(reaction);

      target.add(getThirdRowContainer(), get(ID_OBJECT_SYNC_EDITOR), getPageBase().getFeedbackPanel());
  }
 
Example 29
Project: engerek   File: DefaultHandlerPanel.java   View source code 6 votes vote down vote up
private void initLayout(final PageTaskEdit parentPage) {
	WebMarkupContainer objectRefContainer = new WebMarkupContainer(ID_OBJECT_REF_CONTAINER);
	objectRefContainer.add(new VisibleEnableBehaviour() {
		@Override
		public boolean isVisible() {
			return getModelObject().getTaskDto().getObjectRef() != null;
		}
	});

	final LinkPanel objectRef = new LinkPanel(ID_OBJECT_REF, new PropertyModel<String>(getModel(), HandlerDto.F_OBJECT_REF_NAME)) {
		@Override
		public void onClick(AjaxRequestTarget target) {
			ObjectReferenceType ref = getModelObject().getObjectRef();
			if (ref != null) {
				WebComponentUtil.dispatchToObjectDetailsPage(ref, parentPage, false);
			}
		}
		@Override
		public boolean isEnabled() {
			return WebComponentUtil.hasDetailsPage(getModelObject().getObjectRef());
		}
	};
	objectRefContainer.add(objectRef);
	add(objectRefContainer);
}
 
Example 30
Project: gitplex-mit   File: ReflectionPropertyEditor.java   View source code 5 votes vote down vote up
private Component newBeanEditor(Serializable propertyValue) {
	Component beanEditor;
	if (propertyValue != null) {
		beanEditor = BeanContext.editBean(BEAN_EDITOR_ID, propertyValue);
	} else {
		beanEditor = new WebMarkupContainer(BEAN_EDITOR_ID).setVisible(false);
	}
	beanEditor.setOutputMarkupId(true);
	beanEditor.setOutputMarkupPlaceholderTag(true);
	return beanEditor;
}
 
Example 31
Project: gitplex-mit   File: PolymorphicListPropertyEditor.java   View source code 5 votes vote down vote up
private Component newElementEditor(Serializable element) {
	Component elementEditor;
	if (element != null) {
		elementEditor = BeanContext.editBean("elementEditor", element);
	} else {
		elementEditor = new WebMarkupContainer("elementEditor").setVisible(false);
	}
	elementEditor.setOutputMarkupId(true);
	elementEditor.setOutputMarkupPlaceholderTag(true);
	return elementEditor;
}
 
Example 32
Project: gitplex-mit   File: ConcreteListPropertyViewer.java   View source code 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	
	add(new ListView<PropertyContext<Serializable>>("headers", elementPropertyContexts) {

		@Override
		protected void populateItem(ListItem<PropertyContext<Serializable>> item) {
			item.add(new Label("header", EditableUtils.getName(item.getModelObject().getPropertyGetter())));
		}
		
	});
	add(new ListView<Serializable>("rows", elements) {

		@Override
		protected void populateItem(final ListItem<Serializable> rowItem) {
			rowItem.add(new ListView<PropertyContext<Serializable>>("columns", elementPropertyContexts) {

				@Override
				protected void populateItem(ListItem<PropertyContext<Serializable>> columnItem) {
					PropertyContext<Serializable> propertyContext = columnItem.getModelObject(); 
					Serializable elementPropertyValue = (Serializable) propertyContext.getPropertyValue(rowItem.getModelObject());
					columnItem.add(propertyContext.renderForView("cell", Model.of(elementPropertyValue)));
				}
				
			});
		}
		
	});
	WebMarkupContainer noElements = new WebMarkupContainer("noElements");
	noElements.setVisible(elements.isEmpty());
	noElements.add(AttributeModifier.append("colspan", elementPropertyContexts.size()));
	add(noElements);
}
 
Example 33
Project: gitplex-mit   File: ConcreteListPropertyEditor.java   View source code 5 votes vote down vote up
private WebMarkupContainer addRow(final RepeatingView rows, Serializable element) {
	final WebMarkupContainer row = new WebMarkupContainer(rows.newChildId());
	row.setOutputMarkupId(true);
	rows.add(row);
	
	RepeatingView columns = new RepeatingView("properties");
	row.add(columns);
	
	for (PropertyContext<Serializable> propertyContext: propertyContexts) {
		WebMarkupContainer column = new WebMarkupContainer(columns.newChildId());
		column.add(AttributeAppender.append("class", " " + propertyContext.getPropertyName()));
		columns.add(column);
		
		Serializable propertyValue = (Serializable) propertyContext.getPropertyValue(element);
		PropertyEditor<?> propertyEditor = propertyContext.renderForEdit("propertyEditor", Model.of(propertyValue));
		column.add(propertyEditor);
		column.add(new FencedFeedbackPanel("feedback", propertyEditor));
	}
	
	row.add(new AjaxButton("deleteElement") {

		@Override
		protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
			super.onSubmit(target, form);
			
			target.appendJavaScript($(row).chain("remove").get());
			rows.remove(row);

			if (rows.size() == 0) {
				WebMarkupContainer table = (WebMarkupContainer) ConcreteListPropertyEditor.this.get("listEditor");
				target.add(table.get("noElementsRow"));
			}
			send(ConcreteListPropertyEditor.this, Broadcast.BUBBLE, new EditorChanged(target));								
		}

	}.setDefaultFormProcessing(false));
	
	return row;
}
 
Example 34
Project: gitplex-mit   File: WicketUtils.java   View source code 5 votes vote down vote up
public static void markLastVisibleChild(WebMarkupContainer container) {
	Component lastVisible = null;
	for (Component child: container) {
		for (Behavior behavior: child.getBehaviors()) {
			if (behavior instanceof LastVisibleAppender) {
				child.remove(behavior);
			}
		}
		child.configure();
		if (child.isVisible())
			lastVisible = child;
	}
	if (lastVisible != null)
		lastVisible.add(new LastVisibleAppender("class", "last-visible").setSeparator(" "));
}
 
Example 35
Project: gitplex-mit   File: ActionTabLink.java   View source code 5 votes vote down vote up
public ActionTabLink(String id, ActionTab tab) {
	super(id);
	
	WebMarkupContainer link = newLink("link", tab);
	add(link);
	link.add(new Label("label", tab.getTitleModel()));
}
 
Example 36
Project: gitplex-mit   File: ActionTabLink.java   View source code 5 votes vote down vote up
protected WebMarkupContainer newLink(String id, final ActionTab tab) {
	return new Link<Void>("link") {

		@Override
		public void onClick() {
			tab.selectTab(this);
		}
		
	};
}
 
Example 37
Project: gitplex-mit   File: ModalPanel.java   View source code 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	
	WebMarkupContainer dialog = new WebMarkupContainer("dialog");
	add(dialog);
	
	dialog.add(newContent(CONTENT_ID));
	
	if (size == Size.LARGE)
		dialog.add(AttributeAppender.append("class", "modal-lg"));
	else if (size == Size.SMALL)
		dialog.add(AttributeAppender.append("class", "modal-sm"));
	
	add(new AbstractPostAjaxBehavior() {
		
		@Override
		protected void respond(AjaxRequestTarget target) {
			ModalPanel.this.remove();
			onClosed();
		}
		
		@Override
		public void renderHead(Component component, IHeaderResponse response) {
			super.renderHead(component, response);

			response.render(JavaScriptHeaderItem.forReference(new ModalResourceReference()));
			
			String script = String.format("gitplex.server.modal.onDomReady('%s', %s);", 
					getMarkupId(true), getCallbackFunction());
			response.render(OnDomReadyHeaderItem.forScript(script));
		}

	});
	
	setOutputMarkupId(true);
}
 
Example 38
Project: gitplex-mit   File: CodeCommentPanel.java   View source code 5 votes vote down vote up
private void onStatusChanged(AjaxRequestTarget target, Fragment fragment, CodeCommentStatusChange statusChange) {
	WebMarkupContainer activityContainer = newActivityContainer(activitiesView.newChildId(), statusChange);
	activitiesView.add(activityContainer);

	String script = String.format("$('#%s .add-reply').before('<div id=\"%s\"></div>');", 
			CodeCommentPanel.this.getMarkupId(), activityContainer.getMarkupId());
	target.prependJavaScript(script);
	target.add(activityContainer);

	WebMarkupContainer addReplyContainer = newAddReplyContainer();
	fragment.replaceWith(addReplyContainer);
	target.add(addReplyContainer);
}
 
Example 39
Project: gitplex-mit   File: CodeCommentPanel.java   View source code 5 votes vote down vote up
private void onReplyAdded(AjaxRequestTarget target, Fragment fragment, @Nullable CodeCommentReply reply) {
	if (reply != null) {
		WebMarkupContainer activityContainer = newActivityContainer(activitiesView.newChildId(), reply);
		activitiesView.add(activityContainer);

		String script = String.format("$('#%s .add-reply').before('<div id=\"%s\"></div>');", 
				CodeCommentPanel.this.getMarkupId(), activityContainer.getMarkupId());
		target.prependJavaScript(script);
		target.add(activityContainer);
	}
	
	WebMarkupContainer addReplyContainer = newAddReplyContainer();
	fragment.replaceWith(addReplyContainer);
	target.add(addReplyContainer);
}
 
Example 40
Project: gitplex-mit   File: BlobDiffPanel.java   View source code 5 votes vote down vote up
private Fragment newFragment(String message, boolean warning) {
	Fragment fragment = new Fragment(CONTENT_ID, "noDiffFrag", this);
	fragment.add(new BlobDiffTitle("title", change));
	if (warning)
		fragment.add(new WebMarkupContainer("icon").add(AttributeAppender.append("class", "fa fa-warning")));
	else
		fragment.add(new WebMarkupContainer("icon").add(AttributeAppender.append("class", "fa fa-info-circle")));
	fragment.add(new Label("message", message));
	return fragment;
}