Java Code Examples for org.apache.wicket.AttributeModifier

The following are top voted examples for showing how to use org.apache.wicket.AttributeModifier. 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: sakai   File: CSSFeedbackPanel.java   View source code 7 votes vote down vote up
public CSSFeedbackPanel(String id) {
	super(id);
	WebMarkupContainer feedbackul = (WebMarkupContainer) get("feedbackul");
	if(feedbackul != null){
		feedbackul.add(new AttributeModifier("class", true, new Model() {
			private static final long	serialVersionUID	= 1L;
			public Serializable getObject() {
				if(anyErrorMessage()){
					return "alertMessage";
				}else if(anyMessage()){
					return "success";
				}else{
					return "";
				}
			}
		}));
		feedbackul.add(new AttributeModifier("style", true, new Model("list-style-type:none")));
	}
}
 
Example 2
Project: karate   File: VarsRefreshingView.java   View source code 6 votes vote down vote up
@Override
protected void populateItem(Item<Var> item) {
    String name = item.getModel().getObject().getName();
    item.add(new AjaxLink("show") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            selectedName = name;
            Component headerPanel = getPage().get(BasePage.STICKY_HEADER_ID);
            VarModel varModel = new VarModel(model.getSessionId(), name);
            VarPanel varPanel = new VarPanel(BasePage.STICKY_HEADER_ID, varModel, VarsRefreshingView.this);                
            headerPanel = headerPanel.replaceWith(varPanel);
            target.add(headerPanel);
            Component varsPanel = getPage().get(BasePage.LEFT_NAV_ID);
            target.add(varsPanel);
        }
    }.add(new Label("name", name)));
    String type = item.getModel().getObject().getValue().getTypeAsShortString();
    item.add(new Label("type", type));
    if (name.equals(selectedName)) {
        item.add(new AttributeModifier("class", "success"));
    }
}
 
Example 3
Project: MasterStats   File: BasePage.java   View source code 6 votes vote down vote up
/**
 * generates the navbar and mark the active page
 *
 * @param activePage page to be marked active (null for no active page)
 */
private void loadNavbar(final PageType activePage) {
    // add an entry for each page type
    add(new ListView<PageType>("navbar_left_elements", Arrays.asList(PageType.values())) {
        @Override
        protected void populateItem(final ListItem<PageType> item) {
            final PageType type = item.getModelObject();
            // create a link for the page type
            BookmarkablePageLink<String> link = new BookmarkablePageLink<>("navbar_left_element_link", type.getPageClass());
            link.add(new Label("navbar_left_element_text", type.getLinkText()));
            // if the type is same as active page, mark it as active
            if (type.equals(activePage)) link.add(new AttributeAppender("class", "active", " "));
            item.add(link);
        }
    });

    // create the summoner search region drop down menu
    // get all valid entries
    List<String> endpoints = Arrays.asList(RiotEndpoint.PLAYABLE_ENDPOINTS)
            .stream().map(RiotEndpoint::name).collect(Collectors.toList());
    // add the options to the drop down menu
    DropDownChoice<String> dropDownChoice = new DropDownChoice<>("navbar_form_regions_select",
            new PropertyModel<>(this, "selectedRegion"), endpoints, new StringChoiceRenderer());
    dropDownChoice.add(new AttributeModifier("name", "region"));
    add(dropDownChoice);
}
 
Example 4
Project: engerek   File: TooltipBehavior.java   View source code 6 votes vote down vote up
@Override
public void onConfigure(final Component component) {
    component.setOutputMarkupId(true);

    component.add(AttributeModifier.replace("data-toggle", "tooltip"));
    component.add(new AttributeModifier("data-placement", getDataPlacement()) {

        @Override
        protected String newValue(String currentValue, String replacementValue) {
            if (StringUtils.isEmpty(currentValue)) {
                return replacementValue;
            }
            return currentValue;
        }
    });
}
 
Example 5
Project: engerek   File: AssignmentTablePanel.java   View source code 6 votes vote down vote up
protected AttributeModifier getClassModifier(ListItem<AssignmentEditorDto> item){
	return AttributeModifier.append("class", new AbstractReadOnlyModel<String>() {
		private static final long serialVersionUID = 1L;

		@Override
		public String getObject() {
			AssignmentEditorDto dto = item.getModel().getObject();
			ObjectReferenceType targetRef = dto.getTargetRef();
			if (targetRef != null && targetRef.getType() != null) {
				return WebComponentUtil.getBoxThinCssClasses(targetRef.getType());
			} else {
				return GuiStyleConstants.CLASS_OBJECT_RESOURCE_BOX_THIN_CSS_CLASSES;
			}
		}
	});
}
 
Example 6
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 7
Project: engerek   File: LinkIconPanel.java   View source code 6 votes vote down vote up
private void initLayout(IModel<String> model, IModel<String> titleModel) {
    AjaxLink link = new AjaxLink(ID_LINK) {

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

    Label image = new Label(ID_IMAGE);
    image.add(AttributeModifier.replace("class", model));
    if (titleModel != null) {
        image.add(AttributeModifier.replace("title", titleModel));
    }
    link.add(image);
    link.setOutputMarkupId(true);
    add(link);
}
 
Example 8
Project: engerek   File: PrismContainerPanel.java   View source code 6 votes vote down vote up
private void addOrReplaceProperties(IModel<ContainerWrapper> model, final Form form, boolean isToBeReplaced){
     ListView<ItemWrapper> properties = new ListView<ItemWrapper>("properties",
             new PropertyModel(model, "properties")) {
private static final long serialVersionUID = 1L;

@Override
         protected void populateItem(final ListItem<ItemWrapper> item) {
             item.add(new PrismPropertyPanel("property", item.getModel(), form, pageBase));
             item.add(new VisibleEnableBehaviour() {
             	private static final long serialVersionUID = 1L;
             	
             	@Override
             	public boolean isVisible() {
             		return item.getModel().getObject().isVisible();
             	}
             });
             item.add(AttributeModifier.append("class", createStyleClassModel(item.getModel())));
         }
     };
     properties.setReuseItems(true);
     if (isToBeReplaced) {
         replace(properties);
     } else {
         add(properties);
     }
 }
 
Example 9
Project: engerek   File: TextPopupPanel.java   View source code 6 votes vote down vote up
private void initLayout() {
    final TextField input = initTextField();

    input.add(new AjaxFormComponentUpdatingBehavior("blur") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            //nothing to do, just update model data
        }
    });
    input.add(new Behavior() {

        @Override
        public void bind(Component component) {
            super.bind(component);

            component.add(AttributeModifier.replace("onkeydown",
                    Model.of("if(event.keyCode == 13) {event.preventDefault();}")));
        }
    });
    input.setOutputMarkupId(true);
    add(input);
}
 
Example 10
Project: engerek   File: TextDetailsPanel.java   View source code 6 votes vote down vote up
public TextDetailsPanel(String id, IModel<T> model, Class clazz){
    super(id);

    final TextField<T> text = new TextField<>(ID_INPUT, model);
    text.setType(clazz);
    add(text);

    Label details = new Label(ID_DETAILS);
    details.add(AttributeModifier.replace("title", new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return createAssociationTooltip();
        }
    }));
    details.add(new InfoTooltipBehavior(){

        @Override
        public String getDataPlacement(){
            return "bottom";
        }
    });
    add(details);
}
 
Example 11
Project: engerek   File: AsyncDashboardPanel.java   View source code 6 votes vote down vote up
public AsyncDashboardPanel(String id, IModel<String> title, String icon, IModel<V> callableParameterModel,
                           Duration durationSecs, String boxCssClasses, boolean noPadding) {
    super(id, callableParameterModel, durationSecs);
    
    initLayout(noPadding);

    WebMarkupContainer dashboardTitle = (WebMarkupContainer) get(
            createComponentPath(ID_DASHBOARD_PARENT, ID_DASHBOARD_TITLE));

    Label label = (Label) dashboardTitle.get(ID_TITLE);
    label.setDefaultModel(title);

    if (boxCssClasses == null) {
    	boxCssClasses = GuiStyleConstants.CLASS_BOX_DEFAULT;
    }
    Component dashboardParent = get(ID_DASHBOARD_PARENT);
    dashboardParent.add(new AttributeAppender("class", " " + boxCssClasses));

    WebMarkupContainer iconI = new WebMarkupContainer(ID_ICON);
    iconI.add(AttributeModifier.replace("class", icon));
    dashboardTitle.add(iconI);
}
 
Example 12
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 13
Project: engerek   File: CapabilitiesPanel.java   View source code 6 votes vote down vote up
private void createCapabilityButton(String id) {
	AjaxLink<Boolean> button = new AjaxLink<Boolean>(id, new PropertyModel<Boolean>(getModel(), id)) {

		@Override
		public void onClick(AjaxRequestTarget target) {
			// TODO:
		}

	};

	button.add(new AttributeModifier("class",
			button.getModelObject() ? "btn btn-app btn-resource-capability bg-light-blue"
					: "btn btn-app btn-resource-capability bg-gray text-light-blue"));

	button.add(new Label("label", new ResourceModel("CapabilitiesType." + id)));

	add(button);
}
 
Example 14
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 15
Project: vlo-curation   File: AvailabilityFacetPanel.java   View source code 6 votes vote down vote up
@Override
protected void populateItem(Item<Count> item) {
    //model for actual value
    final PropertyModel<String> valueModel = new PropertyModel<>(item.getModel(), "name");

    //checkbox
    final Component selector = createValueCheckbox("selector", valueModel.getObject());
    item.add(selector);

    //label
    item.add(new WebMarkupContainer("label")
            //child label
            .add(new FieldValueLabel("name", valueModel, fieldNameModel))
            //count label
            .add(new Label("count", new PropertyModel<String>(item.getModel(), "count")))
            //reference to checkbox
            .add(new AttributeModifier("for", selector.getMarkupId()))
            .add(new AttributeAppender("class", valueModel, " "))
    );

    //description as tooltip (title)
    final IModel<FieldValueDescriptor> descriptorModel = new MapValueModel<>(descriptorsModel, valueModel);
    final IModel<String> descriptionModel = new PropertyModel<>(descriptorModel, "description");
    item.add(new AttributeModifier("title", descriptionModel));
}
 
Example 16
Project: vlo-curation   File: ContentSearchFormPanel.java   View source code 6 votes vote down vote up
public ContentSearchFormPanel(String id, final IModel<SolrDocument> documentModel, final IModel<String> endpointModel) {
    super(id);

    // Create a model that returns a JSON representation of the endpoint and document id
    final IModel<String> jsonModel = createJsonModel(documentModel, endpointModel);
    setModel(jsonModel);

    // Populate attributes in form elements...
    // Outer <form> element
    final WebMarkupContainer fcsForm = new WebMarkupContainer("fcsForm");
    // The action of the form should be the aggregator endpoint
    fcsForm.add(new AttributeModifier("action", vloConfig.getFederatedContentSearchUrl()));
    add(fcsForm);

    // Hidden form field for aggregation context
    final WebMarkupContainer aggregationContext = new WebMarkupContainer("aggregationContent");
    // The value should be the JSON object
    aggregationContext.add(new AttributeModifier("value", jsonModel));
    fcsForm.add(aggregationContext);
}
 
Example 17
Project: vlo-curation   File: BootstrapDropdown.java   View source code 6 votes vote down vote up
protected Component createMenu(String id) {
    final WebMarkupContainer menu = new WebMarkupContainer(id);
    menu.add(new ListView<DropdownMenuItem>("menuItem", getModel()) {
        @Override
        protected void populateItem(ListItem<DropdownMenuItem> item) {
            final DropdownMenuItem itemObject = item.getModelObject();
            //link that forms the menu item's action
            item.add(itemObject.getLink("link")
                    //link label defined by the menu item object
                    .add(new Label("label", itemObject.getLabel()))
                    //icon with icon class defined by the menu item object
                    .add(new WebMarkupContainer("icon")
                            .add(new AttributeModifier("class", itemObject.getIconClass())))
            );
        }
    });
    return menu;
}
 
Example 18
Project: superfly   File: LabelPasswordTextFieldRow.java   View source code 6 votes vote down vote up
public LabelPasswordTextFieldRow(String aId, IModel<String> aModel, String aResourceKey, boolean aRequired) {
    super(aId);

    // row
    WebMarkupContainer row = new WebMarkupContainer("row");
    row.add(new AttributeAppender("class", new Model<String>(aRequired ? "required" : ""), " "));
    add(row);

    // label
    Label label = new Label("label-id", new ResourceModel(aResourceKey));
    label.add(new AttributeModifier("for", new Model<String>(aId)));
    row.add(label);

    // field
    row.add(passwordTextField = new LabeledRequiredTextField("field-id", aModel, aId, aResourceKey, aRequired));
}
 
Example 19
Project: owsi-core-parent   File: CoreLabelColumn.java   View source code 6 votes vote down vote up
private CoreLabel decorate(CoreLabel label, IModel<T> rowModel) {
	if (multiline) {
		label.multiline();
	}
	if (showPlaceholder) {
		if (placeholderModel != null) {
			label.showPlaceholder(placeholderModel);
		} else {
			label.showPlaceholder();
		}
	}
	if (tooltipRenderer != null) {
		label.add(new AttributeModifier("title", tooltipRenderer.asModel(rowModel)));
	}
	return label;
}
 
Example 20
Project: sakai   File: SortGradeItemsByGradeItemPanel.java   View source code 6 votes vote down vote up
@Override
public void onInitialize() {
	super.onInitialize();

	final List<Assignment> assignments = this.businessService.getGradebookAssignments(SortType.SORT_BY_SORTING);

	add(new ListView<Assignment>("gradeItemList", assignments) {
		@Override
		protected void populateItem(final ListItem<Assignment> assignmentItem) {
			final Assignment assignment = assignmentItem.getModelObject();
			assignmentItem.add(new Label("name", assignment.getName()));
			assignmentItem.add(new HiddenField<Long>("id",
					Model.of(assignment.getId())).add(
							new AttributeModifier("name",
									String.format("id", assignment.getId()))));
			assignmentItem.add(new HiddenField<Integer>("order",
					Model.of(assignment.getSortOrder())).add(
							new AttributeModifier("name",
									String.format("item_%s[order]", assignment.getId()))));
			assignmentItem.add(new HiddenField<Integer>("current_order",
					Model.of(assignment.getSortOrder())).add(
							new AttributeModifier("name",
									String.format("item_%s[current_order]", assignment.getId()))));
		}
	});
}
 
Example 21
Project: owsi-core-parent   File: HideablePagingNavigator.java   View source code 6 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	
	// Get the navigation bar and add it to the hierarchy
	pagingNavigation = newNavigation("navigation", pageable, labelProvider);
	pagingNavigation.setViewSize(viewSize);
	add(pagingNavigation);
	
	// Add additional page links
	first = newPagingNavigationLink("first", pageable, 0);
	first.add(new AttributeModifier("title", new ResourceModel("PagingNavigator.first")));
	add(first);
	last = newPagingNavigationLink("last", pageable, -1);
	last.add(new AttributeModifier("title", new ResourceModel("PagingNavigator.last")));
	add(last);
}
 
Example 22
Project: owsi-core-parent   File: GenericSelect2DropDownMultipleChoice.java   View source code 6 votes vote down vote up
@Override
protected void onInitialize() {
	ensureChoicesModelIsWrapped();
	
	super.onInitialize();
	
	add(new AttributeModifier("style", new LoadableDetachableModel<String>() {
		private static final long serialVersionUID = 1L;
		
		@Override
		protected String load() {
			return "width: " + width.getWidth();
		}
	}) {
		private static final long serialVersionUID = 1L;

		@Override
		public boolean isEnabled(Component component) {
			return width != null;
		}
	});
}
 
Example 23
Project: owsi-core-parent   File: GenericSelect2DropDownSingleChoice.java   View source code 6 votes vote down vote up
@Override
protected void onInitialize() {
	ensureChoicesModelIsWrapped();
	
	super.onInitialize();
	
	add(new AttributeModifier("style", new LoadableDetachableModel<String>() {
		private static final long serialVersionUID = 1L;
		
		@Override
		protected String load() {
			return "width: " + width.getWidth();
		}
	}) {
		private static final long serialVersionUID = 1L;

		@Override
		public boolean isEnabled(Component component) {
			return width != null;
		}
	});
}
 
Example 24
Project: u-qasar.platform   File: UserListPage.java   View source code 6 votes vote down vote up
private Icon getRegistrationStatusIcon(final User user) {
	final RegistrationStatus status = user.getRegistrationStatus();
	String typeString;
	switch (status) {
		case CANCELLED:
			typeString = "ban-circle";
			break;
		case PENDING:
			typeString = "time";
			break;
		default:
			typeString = "check-sign";
	}
	IconType type = new IconType(typeString);
	Icon icon = new Icon("td.status", type);
	icon.add(new AttributeModifier("title", Model.of(user.getRegistrationStatus())));
	return icon;
}
 
Example 25
Project: sakai   File: AjaxLazyLoadImage.java   View source code 6 votes vote down vote up
public Image renderImage(AjaxRequestTarget target, boolean fullRender) {
	if(returnPage != null || returnClass != null) {
		link.add(new AttributeModifier("title", new ResourceModel("click_to_max")));
		link.setEnabled(true);
	}
	link.removeAll();
	Image img = null;
	if(!autoDetermineChartSizeByAjax) {
		img = createImage("content", getImageData());
	}else{
		img = createImage("content", getImageData(selectedWidth, selectedHeight));
	}
	img.add(AttributeModifier.replace("style", "display: none; margin: 0 auto;"));
	link.add(img);
	setState((byte) 1);
	if(fullRender) {
		if(target != null) {
			target.add(link);	
			target.appendJavaScript("jQuery('#"+img.getMarkupId()+"').fadeIn();");
		}		
		setState((byte) 2);
	}
	return img;
}
 
Example 26
Project: ManagedProperties   File: NumberFieldFragment.java   View source code 6 votes vote down vote up
@Override
protected Component getFormInput(String wicketID, IModel<Number> model) {
    NumberTextField field = new NumberTextField(wicketID, model);
    Class attributeInputType = getAttribute().getInputType();
    if (attributeInputType == Float.class || attributeInputType == Double.class) {
        formInput.add(AttributeModifier.replace("step", new LoadableDetachableModel<String>() {
            @Override
            protected String load() {
                return "0.0001";
            }

        }));
    }
    
    return field;
}
 
Example 27
Project: openmeetings   File: MessagesContactsPanel.java   View source code 6 votes vote down vote up
private void selectFolder(WebMarkupContainer folder, Long id, AjaxRequestTarget target) {
	selectedFolder = folder;
	selectedFolderModel.setObject(id);
	setDefaultFolderClass();
	selectFolder(folder);
	emptySelection(target);
	selectDropDown.setModelObject(SELECT_CHOOSE);
	moveDropDown.setModelObject(NOT_MOVE_FOLDER);
	deleteBtn.add(AttributeModifier.replace("value", Application.getString(TRASH_FOLDER_ID.equals(id) ? "1256" : "80")));
	readBtn.setEnabled(false);
	unreadBtn.setEnabled(false);
	if (target != null) {
		updateTable(target);
		target.add(folders, unread, selectDropDown, moveDropDown);
		target.add(dataContainer.getContainer(), dataContainer.getNavigator());
		target.add(dataContainer.getLinks());
	}
}
 
Example 28
Project: openmeetings   File: ClientIcon.java   View source code 6 votes vote down vote up
public final void update(IPartialPageRequestHandler handler) {
	cssClass.setLength(0);
	StringBuilder cls = new StringBuilder(ICON_CLASS);
	cls.append(getAlign()).append(mainCssClass);
	if (isClickable()) {
		//request/remove
		cls.append(CLS_CLICKABLE);
		add(addOnClick(getScript()));
	} else {
		add(addOnClick(""));
	}
	internalUpdate();
	add(AttributeModifier.replace(ATTR_TITLE, getTitle()));
	add(AttributeModifier.replace(ATTR_CLASS, cls.append(cssClass)));
	if (handler != null) {
		handler.add(this);
	}
}
 
Example 29
Project: openmeetings   File: RoomClientPanel.java   View source code 6 votes vote down vote up
public RoomClientPanel(String id, ListItem<Client> item, final RoomPanel room) {
	super(id, item.getModel());
	setRenderBodyOnly(true);
	Client c = item.getModelObject();
	final String uid = c.getUid();
	item.setMarkupId(String.format("user%s", c.getUid()));
	item.add(AttributeModifier.append("style", String.format("background-image: url(profile/%s);", c.getUserId())));
	item.add(AttributeModifier.append("data-userid", c.getUserId()));
	add(new RefreshIcon("refresh", uid, room));
	final String name = getName(c);
	add(new Label("name", name));
	add(new UserSpeaksIcon("user-speaks", uid, room));
	item.add(AttributeModifier.replace(ATTR_TITLE, name));
	WebMarkupContainer actions = new WebMarkupContainer("actions");
	actions.add(new KickIcon("kick", uid, room));
	actions.add(new WebMarkupContainer("privateChat").setVisible(!room.getRoom().isHidden(RoomElement.Chat) && !getUserId().equals(c.getUserId())));
	actions.setVisible(room.getClient().hasRight(Right.moderator));
	if (c.getUid().equals(room.getClient().getUid())) {
		actions.add(new SelfIconsPanel("icons", uid, room, false));
		item.add(AttributeModifier.append(ATTR_CLASS, "current"));
	} else {
		actions.add(new ClientIconsPanel("icons", uid, room));
	}
	add(actions);
}
 
Example 30
Project: sakai   File: FeedbackLabel.java   View source code 6 votes vote down vote up
/**
 * Set the content of this FeedbackLabel, depending on if the component has a FeedbackMessage.
 *
 * The HTML class attribute will be filled with the error level of the feedback message. That way, you can easily
 * style different messages differently. Examples:
 *
 * class = "feedbacklabel INFO"
 * class = "feedbacklabel ERROR"
 * class = "feedbacklabel DEBUG"
 * class = "feedbacklabel FATAL"
 *
 *
 * @see Component
 */
@Override
protected void onBeforeRender() {
    super.onBeforeRender();
    this.setDefaultModel(null);

    if(component.hasFeedbackMessage()){
        if(this.text!=null){
            this.setDefaultModel(text);
        } else {
            this.setDefaultModel(new Model(component.getFeedbackMessages().first()));
        }

        this.add(new AttributeModifier("class", true, new Model("feedbackLabel " + component.getFeedbackMessages().first().getLevelAsString())));
    } else {
        this.setDefaultModel(null);
    }
  
}
 
Example 31
Project: u-qasar.platform   File: LinkableUserBadge.java   View source code 6 votes vote down vote up
public LinkableUserBadge(String id, IModel<User> model) {
	super(id, model);
	Validate.notNull(model);
	Validate.notNull(model.getObject());
	user = model.getObject();

	BookmarkablePageLink<UserPage> container = new BookmarkablePageLink<>(
			"profile.link", UserPage.class, UserPage.forUser(user));
	container.add(userName = new Label("userName",
			new PropertyModel<String>(model, "userName")));

	WebMarkupContainer picture = new WebMarkupContainer("picture");
	picture.add(new UserProfilePictureBackgroundBehaviour(user, User.PictureDimensions.Badge));
	container.add(picture);
	container.add(new AttributeModifier("title", user.getFullName()));
	add(container);
}
 
Example 32
Project: invesdwin-nowicket   File: AWebPage.java   View source code 6 votes vote down vote up
protected Navbar newNavbar(final String id) {
    final Navbar navbar = new Navbar(id) {

        @Override
        protected TransparentWebMarkupContainer newContainer(final String componentId) {
            final TransparentWebMarkupContainer container = super.newCollapseContainer(componentId);
            container.add(AttributeModifier.replace("class", getContainerClass()));
            return container;
        }

        @Override
        protected Class<? extends Page> getHomePage() {
            return getNavbarHomePage();
        }

    };
    navbar.setBrandName(Model.of("invesdwin-NoWicket"));
    navbar.setBrandImage(DEFAULT_LOGO, Model.of("logo"));

    addSignInOrSignOutPageToNavbar(navbar);

    return navbar;
}
 
Example 33
Project: invesdwin-nowicket   File: GridColumnBorder.java   View source code 6 votes vote down vote up
public GridColumnBorder(final GridColumnHtmlElement element) {
    super(element.getWicketId());
    this.element = element;

    final AttributeModifier hasError = AttributeModifier.append("class", new AbstractReadOnlyModel<String>() {
        @Override
        public String getObject() {
            final Component component = element.getContext()
                    .getComponentRegistry()
                    .getComponent(element.getModelWicketId());
            final FormComponent<?> formComponent = Components.asFormComponent(component);
            if (formComponent != null) {
                if (!formComponent.isValid()) {
                    return "has-error";
                }
            }
            return null;
        }
    });
    add(hasError);
    this.help = new Label("help", Model.of()); //needs to escape markup or modals do not close
    help.setEscapeModelStrings(false);
    addToBorder(help);
}
 
Example 34
Project: invesdwin-nowicket   File: ModalContainer.java   View source code 6 votes vote down vote up
public ModalContainer(final String id) {
    super(id);
    modalContent = new WebMarkupContainer("modalContent");
    modalContent.setOutputMarkupId(true);
    add(modalContent);
    /*
     * initialially put empty panel, later keep the ones as invisible that have been replaced to be able to show
     * replaced stacked modals properly
     */
    modalContent.add(new WebMarkupContainer(PANEL_MARKUP_ID));
    titleLabel = new Label("title");
    titleLabel.setEscapeModelStrings(false);
    modalContent.add(titleLabel);
    setOutputMarkupId(true);
    add(new CssClassNameAppender("modal"));
    add(new CssClassNameAppender("fade"));
    add(new AttributeModifier("data-keyboard", "false"));
    add(new AttributeModifier("data-backdrop", "static"));
}
 
Example 35
Project: webanno   File: FinishImage.java   View source code 6 votes vote down vote up
public FinishImage(String id, final IModel<AnnotatorState> aModel)
{
    super(id, aModel);

    add(new AttributeModifier("src", LambdaModel.of(() -> {
        if (aModel.getObject().getProject() != null
                && aModel.getObject().getDocument() != null) {
            if (isFinished(aModel, aModel.getObject().getUser(), documentService)) {
                return "images/accept.png";
            }
            else {
                return "images/inprogress.png";
            }
        }
        else {
            return "images/inprogress.png";
        }
    })));
}
 
Example 36
Project: sakai   File: FileSelectorPanel.java   View source code 6 votes vote down vote up
public FileSelectorPanel(String id, String siteId, IModel model, boolean showDefaultBaseFoldersOnly) {
	super(id, model);
	this.siteId = siteId;
	this.showDefaultBaseFoldersOnly = showDefaultBaseFoldersOnly;
	
	// selected files
	HiddenField selectedFiles = new HiddenField("selectedFiles", new PropertyModel(this, "selectedFiles"));
	add(selectedFiles);
	
	// hover div (for disabling control)
	WebMarkupContainer containerHover = new WebMarkupContainer("containerHover");
	if(isEnabled()) {
		containerHover.add(new AttributeModifier("style", new Model("display: block")));
	}else{
		containerHover.add(new AttributeModifier("style", new Model("display: none")));
	}
	add(containerHover);
	
	add(ajaxResourcesLoader);
}
 
Example 37
Project: elpaaso-core   File: ApplicationVisibilityPanel.java   View source code 6 votes vote down vote up
private void initComponent() {
    WebMarkupContainer applicationPublicSpan = new WebMarkupContainer(APP_VISIBILITY_PUBLIC);
    WebMarkupContainer applicationPrivateSpan = new WebMarkupContainer(APP_VISIBILITY_PRIVATE);
    Joiner joiner = Joiner.on(", ");
    String members = joiner.join(getModelObject().listMembers());
    applicationPublicSpan.add(AttributeModifier.replace("title", new ResourceModel("portal.application.members.label").getObject() + " : " + members));
    applicationPrivateSpan.add(AttributeModifier.replace("title", new ResourceModel("portal.application.members.label").getObject() + " : " + members));
    add(applicationPublicSpan);
    applicationPublicSpan.add(new CacheActivatedImage("applicationVisibilityPanelPublicImage",new ResourceModel("visibility-public").getObject()));
    add(applicationPrivateSpan);
    applicationPrivateSpan.add(new CacheActivatedImage("applicationVisibilityPanelPrivateImage",new ResourceModel("visibility-private").getObject()));

    boolean applicationIsPublic = getModelObject().isPublic();
    applicationPublicSpan.setVisible(applicationIsPublic);
    applicationPrivateSpan.setVisible(!applicationIsPublic);
}
 
Example 38
Project: artifactory   File: BintrayInfoPanel.java   View source code 6 votes vote down vote up
private void addLatestVersionToPanel(final BintrayPackageInfo packageInfo) {
    String latestVersion = String.format("%s", packageInfo.getLatest_version());
    TitledPageLink latestVersionLink = new TitledPageLink("latestVersion", latestVersion, null) {
        @Override
        protected CharSequence getURL() {
            StringBuilder urlBuilder = new StringBuilder(
                    ConstantValues.bintrayUrl.getString() + "/version/show/general").
                    append("/").append(packageInfo.getOwner()).
                    append("/").append(packageInfo.getRepo()).
                    append("/").append(packageInfo.getName()).
                    append("/").append(packageInfo.getLatest_version());
            return urlBuilder.toString();
        }
    };
    latestVersionLink.add(new AttributeModifier("target", "_blank"));
    infoBorder.add(latestVersionLink);
}
 
Example 39
Project: elpaaso-core   File: DesignerArchitectureMatrixCellButtonPanel.java   View source code 6 votes vote down vote up
private void initMonitoringUtlBtn() {

        /* monitoring icon*/
        monitoringUrlSpan = new WebMarkupContainer("monitoringUrlImg");
        monitoringUrl = null;

        monitoringUrlBtn = new ExternalLink("cell-monitoringUrl", (monitoringUrl != null) ? monitoringUrl.toString() : "") {

            private static final long serialVersionUID = 5630633258734623659L;

            @Override
            public boolean isVisible() {
                // TODO : when monitoring will be integrated this condition will have to change
                return monitoringUrl != null;
            }
        };

        monitoringUrlSpan.add(new AttributeAppender("class", new Model<String>((monitoringUrl != null) ? "monitoringUrl-enable" : "monitoringUrl-disable"), " "));
        //monitoringUrlBtn.add(new AttributeAppender("target", new Model<String>("_blank"), " " ));
        monitoringUrlBtn.add(new AttributeModifier("id", new Model<String>("monitoringURL")));
        monitoringUrlBtn.add(monitoringUrlSpan);
        add(monitoringUrlBtn);

    }
 
Example 40
Project: artifactory   File: SelectAllCheckboxColumn.java   View source code 6 votes vote down vote up
@Override
public Component getHeader(String componentId) {
    CheckboxPanel panel = new CheckboxPanel(componentId);
    selectAllCheckbox = new StyledCheckbox(CHECKBOX_ID, getSelectAllModel());
    selectAllCheckbox.setTitle(getDisplayModel().getObject());
    selectAllCheckbox.add(new AttributeModifier("title", "Select All"));
    selectAllCheckbox.setOutputMarkupId(true);
    selectAllCheckbox.add(new AjaxFormComponentUpdatingBehavior("onclick") {
        @SuppressWarnings({"unchecked"})
        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            SortableTable<T> table = (SortableTable<T>) selectAllCheckbox.findParent(DataTable.class);
            selectAll(table, target);
            onSelectAllUpdate(target);
        }
    });
    panel.add(selectAllCheckbox);
    return panel;
}