org.apache.wicket.MarkupContainer Java Examples
The following examples show how to use
org.apache.wicket.MarkupContainer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImageFeatureSupport.java From inception with Apache License 2.0 | 6 votes |
@Override public FeatureEditor createEditor(String aId, MarkupContainer aOwner, AnnotationActionHandler aHandler, IModel<AnnotatorState> aStateModel, IModel<FeatureState> aFeatureStateModel) { AnnotationFeature feature = aFeatureStateModel.getObject().feature; FeatureEditor editor; switch (feature.getMultiValueMode()) { case NONE: if (feature.getType().startsWith("img:")) { editor = new ImageFeatureEditor(aId, aOwner, aFeatureStateModel); } else { throw unsupportedMultiValueModeException(feature); } break; case ARRAY: // fall-through default: throw unsupportedMultiValueModeException(feature); } return editor; }
Example #2
Source File: SingleChoiceEditor.java From yes-cart with Apache License 2.0 | 6 votes |
/** * Construct drop down box to select single value. * * @param id editor id. * @param markupProvider markup object. * @param model model. * @param labelModel label model * @param attrValue {@link org.yes.cart.domain.entity.AttrValue} * @param choices list of strings {@link org.yes.cart.domain.misc.Pair}, that represent options to select one * @param readOnly if true this component is read only */ public SingleChoiceEditor(final String id, final MarkupContainer markupProvider, final IModel model, final IModel<String> labelModel, final IModel choices, final AttrValueWithAttribute attrValue, final boolean readOnly) { super(id, "singleChoiceEditor", markupProvider); final DropDownChoice<Pair<String, String>> dropDownChoice = new DropDownChoice<Pair<String, String>>(EDIT, model, choices); dropDownChoice.setLabel(labelModel); dropDownChoice.setEnabled(!readOnly); dropDownChoice.setRequired(attrValue.getAttribute().isMandatory()); dropDownChoice.setChoiceRenderer(new PairChoiceRenderer()); add(dropDownChoice); }
Example #3
Source File: MultipleChoicesEditor.java From yes-cart with Apache License 2.0 | 6 votes |
/** * Construct multiple choice editor * * @param id editor id. * @param markupProvider markup object. * @param model model. * @param labelModel label model * @param attrValue {@link org.yes.cart.domain.entity.AttrValue} * @param choices list of strings {@link org.yes.cart.domain.misc.Pair}, that represent options to select one * @param readOnly if true this component is read only */ public MultipleChoicesEditor(final String id, final MarkupContainer markupProvider, final IModel model, final IModel<String> labelModel, final IModel choices, final AttrValueWithAttribute attrValue, final boolean readOnly) { super(id, "multipleChoicesEditor", markupProvider); final CheckBoxMultipleChoice<Pair<String, String>> checkBoxMultipleChoice = new CheckBoxMultipleChoice<Pair<String, String>>(EDIT, model, choices); checkBoxMultipleChoice.setLabel(labelModel); checkBoxMultipleChoice.setRequired(attrValue.getAttribute().isMandatory()); checkBoxMultipleChoice.setChoiceRenderer(new PairChoiceRenderer()); add(checkBoxMultipleChoice); }
Example #4
Source File: PropertyEditableColumnAdvancedOptions.java From sakai with Educational Community License v2.0 | 6 votes |
/** * @see IColumn#newCell(MarkupContainer, String, TreeNode, int) */ public Component newCell(MarkupContainer parent, String id, TreeNode node, int level) { if(!((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).isNodeEditable()){ return new EditablePanelEmpty(id); } if(DelegatedAccessConstants.TYPE_ACCESS_SHOPPING_PERIOD_USER == userType){ if(!((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).getNodeShoppingPeriodAdmin()){ return new EditablePanelEmpty(id); } } if(((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).isDirectAccess()){ return new EditablePanelAdvancedOptions(id, new PropertyModel(node, getPropertyExpression()), (NodeModel) ((DefaultMutableTreeNode) node).getUserObject(), node, userType); }else{ return new EditablePanelAdvancedOptionsText(id, new PropertyModel(node, getPropertyExpression()), (NodeModel) ((DefaultMutableTreeNode) node).getUserObject(), node, userType); } }
Example #5
Source File: PaymentPage.java From yes-cart with Apache License 2.0 | 6 votes |
/** * Get the negative result fragment, which responsible * to show item allocation error. * * @param sku the {@link ProductSku} which quantity can not be allocated. * * @return negative result fragment */ private MarkupContainer createNegativeItemAllocationResultFragment(final String sku) { final ProductSku productSku = productServiceFacade.getProductSkuBySkuCode(sku); final Map<String, Object> param = new HashMap<>(); param.put("product", getI18NSupport().getFailoverModel(productSku.getDisplayName(), productSku.getName()).getValue(getLocale().getLanguage())); param.put("sku", sku); final String errorMessage = WicketUtil.createStringResourceModel(this, ALLOCATION_DETAIL, param).getString(); error(errorMessage); return new Fragment(RESULT_CONTAINER, NEGATIVE_ALLOCATION_RESULT_FRAGMENT, this) .add( new Label( ALLOCATION_DETAIL, errorMessage ) ) ; }
Example #6
Source File: AbstractUITCase.java From syncope with Apache License 2.0 | 6 votes |
protected static <V extends Serializable> Component findComponentByProp( final String property, final String path, final V key) { Component component = TESTER.getComponentFromLastRenderedPage(path); return (component instanceof MarkupContainer ? MarkupContainer.class.cast(component) : component.getPage()). visitChildren(ListItem.class, (ListItem<?> object, IVisit<Component> visit) -> { try { Method getter = PropertyResolver.getPropertyGetter(property, object.getModelObject()); if (getter != null && getter.invoke(object.getModelObject()).equals(key)) { visit.stop(object); } } catch (Exception e) { LOG.debug("Error finding component by property ({},{}) on path {}", property, key, path, e); } }); }
Example #7
Source File: AbstractUITCase.java From syncope with Apache License 2.0 | 6 votes |
protected static <V extends Serializable> Component findComponentByPropNotNull( final String property, final String path) { Component component = TESTER.getComponentFromLastRenderedPage(path); return (component instanceof MarkupContainer ? MarkupContainer.class.cast(component) : component.getPage()). visitChildren(ListItem.class, (ListItem<?> object, IVisit<Component> visit) -> { try { Method getter = PropertyResolver.getPropertyGetter(property, object.getModelObject()); if (getter != null && getter.invoke(object.getModelObject()) != null) { visit.stop(object); } } catch (Exception e) { LOG.debug("Error finding component by property {} not null on path {}", property, path, e); } }); }
Example #8
Source File: PropertyEditableColumnList.java From sakai with Educational Community License v2.0 | 6 votes |
/** * @see IColumn#newCell(MarkupContainer, String, TreeNode, int) */ public Component newCell(MarkupContainer parent, String id, TreeNode node, int level) { if(!((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).isNodeEditable()){ return new EditablePanelEmpty(id); } if(DelegatedAccessConstants.TYPE_ACCESS_SHOPPING_PERIOD_USER == userType){ if(!((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).getNodeShoppingPeriodAdmin()){ return new EditablePanelEmpty(id); } } if(((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).isDirectAccess()){ return new EditablePanelList(id, new PropertyModel(node, getPropertyExpression()), (NodeModel) ((DefaultMutableTreeNode) node).getUserObject(), node, userType, fieldType); }else{ return new EditablePanelListInherited(id, new PropertyModel(node, getPropertyExpression()), (NodeModel) ((DefaultMutableTreeNode) node).getUserObject(), node, userType, fieldType); } }
Example #9
Source File: ArtifactPortfolioPanel.java From artifact-listener with Apache License 2.0 | 6 votes |
@Override protected MarkupContainer getEditLink(String id, IModel<? extends Artifact> itemModel) { IModel<Artifact> artifactModel = Model.of(itemModel); Link<Artifact> syncLink = new Link<Artifact>(id, artifactModel) { private static final long serialVersionUID = 1L; @Override public void onClick() { try { mavenSynchronizationService.synchronizeArtifactsAndNotifyUsers(Lists.newArrayList(getModelObject().getId())); getSession().success(getString("administration.artifact.sync.success")); } catch (Exception e) { LOGGER.warn("An error occurred while synchronizing artifact", e); getSession().error(getString("administration.artifact.sync.error")); } } }; return syncLink; }
Example #10
Source File: PropertyEditableColumnDropdown.java From sakai with Educational Community License v2.0 | 6 votes |
/** * @see IColumn#newCell(MarkupContainer, String, TreeNode, int) */ public Component newCell(MarkupContainer parent, String id, TreeNode node, int level) { if(!((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).isNodeEditable()){ return new EditablePanelEmpty(id); } if(DelegatedAccessConstants.TYPE_ACCESS_SHOPPING_PERIOD_USER == type){ if(!((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).getNodeShoppingPeriodAdmin()){ return new EditablePanelEmpty(id); } } if(((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).isDirectAccess()){ return new EditablePanelDropdown(id, new PropertyModel(node, getPropertyExpression()), (NodeModel) ((DefaultMutableTreeNode) node).getUserObject(), node, roleMap, type, subAdminRoles); }else{ return new EditablePanelDropdownText(id, new PropertyModel(node, getPropertyExpression()), (NodeModel) ((DefaultMutableTreeNode) node).getUserObject(), node, roleMap, type); } }
Example #11
Source File: PropertyEditableColumnDate.java From sakai with Educational Community License v2.0 | 6 votes |
/** * @see IColumn#newCell(MarkupContainer, String, TreeNode, int) */ public Component newCell(MarkupContainer parent, String id, TreeNode node, int level) { if(!((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).isNodeEditable()){ return new EditablePanelEmpty(id); } if(!((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).getNodeShoppingPeriodAdmin()){ return new EditablePanelEmpty(id); } if(((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).isDirectAccess()){ return new EditablePanelDate(id, new PropertyModel(node, getPropertyExpression()), (NodeModel) ((DefaultMutableTreeNode) node).getUserObject(), node, startDate); }else{ return new EditablePanelDateText(id, new PropertyModel(node, getPropertyExpression()), (NodeModel) ((DefaultMutableTreeNode) node).getUserObject(), node, startDate); } }
Example #12
Source File: PropertyEditableColumnList.java From sakai with Educational Community License v2.0 | 6 votes |
/** * @see IColumn#newCell(MarkupContainer, String, TreeNode, int) */ public Component newCell(MarkupContainer parent, String id, TreeNode node, int level) { if(!((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).isNodeEditable()){ return new EditablePanelEmpty(id); } if(DelegatedAccessConstants.TYPE_ACCESS_SHOPPING_PERIOD_USER == userType){ if(!((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).getNodeShoppingPeriodAdmin()){ return new EditablePanelEmpty(id); } } if(((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).isDirectAccess()){ return new EditablePanelList(id, new PropertyModel(node, getPropertyExpression()), (NodeModel) ((DefaultMutableTreeNode) node).getUserObject(), node, userType, fieldType); }else{ return new EditablePanelListInherited(id, new PropertyModel(node, getPropertyExpression()), (NodeModel) ((DefaultMutableTreeNode) node).getUserObject(), node, userType, fieldType); } }
Example #13
Source File: KendoAutoCompleteTextFeatureEditor.java From webanno with Apache License 2.0 | 6 votes |
public KendoAutoCompleteTextFeatureEditor(String aId, MarkupContainer aItem, IModel<FeatureState> aModel, int aMaxResults, AnnotationActionHandler aHandler) { super(aId, aItem, aModel); AnnotationFeature feat = getModelObject().feature; StringFeatureTraits traits = readFeatureTraits(feat); maxResults = aMaxResults; add(new KeyBindingsPanel("keyBindings", () -> traits.getKeyBindings(), aModel, aHandler) // The key bindings are only visible when the label is also enabled, i.e. when the // editor is used in a "normal" context and not e.g. in the keybindings // configuration panel .add(visibleWhen(() -> getLabelComponent().isVisible()))); }
Example #14
Source File: BooleanFeatureEditor.java From webanno with Apache License 2.0 | 6 votes |
public BooleanFeatureEditor(String aId, MarkupContainer aItem, IModel<FeatureState> aModel) { super(aId, aItem, new CompoundPropertyModel<>(aModel)); BootstrapCheckBoxPickerConfig config = new BootstrapCheckBoxPickerConfig(); config.withReverse(true); field = new BootstrapCheckBoxPicker("value", config) { private static final long serialVersionUID = -3413189824637877732L; @Override protected void onComponentTag(ComponentTag aTag) { super.onComponentTag(aTag); aTag.put("data-group-cls", "btn-group-justified"); } }; add(field); }
Example #15
Source File: AnnotatedListIdentifiers.java From inception with Apache License 2.0 | 6 votes |
public SearchResultGroup(String aId, String aMarkupId, MarkupContainer aMarkupProvider, List<String> aResultList) { super(aId, aMarkupId, aMarkupProvider); ListView<String> statementList = new ListView<String>("results") { private static final long serialVersionUID = 5811425707843441458L; @Override protected void populateItem(ListItem<String> aItem) { aItem.add( new Label("sentence", aItem.getModelObject()) .setEscapeModelStrings(false)); } }; statementList.setList(aResultList); add(statementList); }
Example #16
Source File: ConceptFeatureSupport.java From inception with Apache License 2.0 | 6 votes |
@Override public FeatureEditor createEditor(String aId, MarkupContainer aOwner, AnnotationActionHandler aHandler, IModel<AnnotatorState> aStateModel, IModel<FeatureState> aFeatureStateModel) { AnnotationFeature feature = aFeatureStateModel.getObject().feature; FeatureEditor editor; switch (feature.getMultiValueMode()) { case NONE: if (feature.getType().startsWith("kb:")) { editor = new ConceptFeatureEditor(aId, aOwner, aFeatureStateModel, aStateModel, aHandler); } else { throw unsupportedMultiValueModeException(feature); } break; case ARRAY: // fall-through default: throw unsupportedMultiValueModeException(feature); } return editor; }
Example #17
Source File: PropertyEditableColumnDropdown.java From sakai with Educational Community License v2.0 | 6 votes |
/** * @see IColumn#newCell(MarkupContainer, String, TreeNode, int) */ public Component newCell(MarkupContainer parent, String id, TreeNode node, int level) { if(!((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).isNodeEditable()){ return new EditablePanelEmpty(id); } if(DelegatedAccessConstants.TYPE_ACCESS_SHOPPING_PERIOD_USER == type){ if(!((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).getNodeShoppingPeriodAdmin()){ return new EditablePanelEmpty(id); } } if(((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).isDirectAccess()){ return new EditablePanelDropdown(id, new PropertyModel(node, getPropertyExpression()), (NodeModel) ((DefaultMutableTreeNode) node).getUserObject(), node, roleMap, type, subAdminRoles); }else{ return new EditablePanelDropdownText(id, new PropertyModel(node, getPropertyExpression()), (NodeModel) ((DefaultMutableTreeNode) node).getUserObject(), node, roleMap, type); } }
Example #18
Source File: PropertyFeatureSupport.java From inception with Apache License 2.0 | 6 votes |
@Override public FeatureEditor createEditor(String aId, MarkupContainer aOwner, AnnotationActionHandler aHandler, IModel<AnnotatorState> aStateModel, IModel<FeatureState> aFeatureStateModel) { FeatureState featureState = aFeatureStateModel.getObject(); final FeatureEditor editor; switch (featureState.feature.getMultiValueMode()) { case NONE: if (featureState.feature.getType().startsWith(PREFIX)) { editor = new PropertyFeatureEditor(aId, aOwner, aHandler, aStateModel, aFeatureStateModel); } else { throw unsupportedMultiValueModeException(featureState.feature); } break; case ARRAY: // fall-through default: throw unsupportedMultiValueModeException(featureState.feature); } return editor; }
Example #19
Source File: OrienteerPagingNavigator.java From Orienteer with Apache License 2.0 | 6 votes |
@Override public MarkupContainer add(Component... childs) { for(Component child : childs) { String id = child.getId(); if("first".equals(id) || "prev".equals(id) || "next".equals(id) || "last".equals(id)) { super.add(new AutoDisableParent(id+"Li").add(child)); } else { super.add(child); } } return this; }
Example #20
Source File: BooleanEditor.java From yes-cart with Apache License 2.0 | 6 votes |
/** * Construct simple check box editor. * * @param id editor id. * @param markupProvider markup object. * @param model model. * @param labelModel label model * @param attrValue {@link org.yes.cart.domain.entity.AttrValue} * @param readOnly if true this component is read only */ public BooleanEditor(final String id, final MarkupContainer markupProvider, final IModel<String> model, final IModel<String> labelModel, final AttrValueWithAttribute attrValue, final boolean readOnly) { super(id, "booleanEditor", markupProvider); inner = model; final CheckBox checkboxField = new CheckBox(EDIT, new PropertyModel<>(this, "innerValue")); checkboxField.setLabel(labelModel); checkboxField.setRequired(attrValue.getAttribute().isMandatory()); checkboxField.setEnabled(!readOnly); add(checkboxField); }
Example #21
Source File: ArtifactDeprecationFormPopupPanel.java From artifact-listener with Apache License 2.0 | 5 votes |
@Override protected Component createBody(String wicketId) { DelegatedMarkupPanel body = new DelegatedMarkupPanel(wicketId, ArtifactDeprecationFormPopupPanel.class); form = new Form<Artifact>("form", getModel()); body.add(form); final MarkupContainer relatedArtifactContainer = new WebMarkupContainer("relatedArtifactContainer"); relatedArtifactContainer.setOutputMarkupId(true); form.add(relatedArtifactContainer); final ArtifactDropDownChoice relatedArtifactField = new ArtifactDropDownChoice("relatedArtifact", BindingModel.of(form.getModel(), Binding.artifact().relatedArtifact()), new ArtifactSelect2AjaxAdapter(ArtifactDropDownChoice.CHOICE_RENDERER) { private static final long serialVersionUID = 1L; @Override public List<Artifact> getChoices(int start, int count, String term) { List<Artifact> choices = super.getChoices(start, count, term); choices.remove(getModelObject()); return choices; } }); relatedArtifactField.setLabel(new ResourceModel("artifact.deprecation.field.relatedArtifact")); relatedArtifactContainer.add(relatedArtifactField); ArtifactDeprecationStatusDropDownChoice deprecatedField = new ArtifactDeprecationStatusDropDownChoice("deprecationStatus", BindingModel.of(form.getModel(), Binding.artifact().deprecationStatus())); deprecatedField.setWidth(DropDownChoiceWidth.SMALL); deprecatedField.setLabel(new ResourceModel("artifact.deprecation.field.deprecationStatus")); relatedArtifactField.add(new AjaxInputPrerequisiteEnabledBehavior<ArtifactDeprecationStatus>(deprecatedField) .setObjectValidPredicate(PREDICATE) .setRefreshParent(true)); form.add(deprecatedField); return body; }
Example #22
Source File: AjaxWizardMgtButtonBar.java From syncope with Apache License 2.0 | 5 votes |
@Override public MarkupContainer add(final Component... childs) { for (Component component : childs) { if (component instanceof WizardButton) { ajaxify((WizardButton) component); } } return super.add(childs); }
Example #23
Source File: PropertyEditableColumnCheckbox.java From sakai with Educational Community License v2.0 | 5 votes |
/** * @see IColumn#newCell(MarkupContainer, String, TreeNode, int) */ public Component newCell(MarkupContainer parent, String id, TreeNode node, int level) { if(!((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).isNodeEditable()){ return new EditablePanelEmpty(id); } if(DelegatedAccessConstants.TYPE_ACCESS_SHOPPING_PERIOD_USER == type){ if(!((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).getNodeShoppingPeriodAdmin()){ return new EditablePanelEmpty(id); } } return new EditablePanelCheckbox(id, new PropertyModel(node, getPropertyExpression()), (NodeModel) ((DefaultMutableTreeNode) node).getUserObject(), node, type); }
Example #24
Source File: DivPanel.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
/** * @see org.apache.wicket.MarkupContainer#remove(org.apache.wicket.Component) */ @Override public MarkupContainer remove(final Component component) { repeater.remove(component); return this; }
Example #25
Source File: SpanPanel.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
/** * @see org.apache.wicket.MarkupContainer#add(org.apache.wicket.Component[]) */ @Override public MarkupContainer add(final Component... childs) { if (repeater == null) { if (childAdded == true) { throw new IllegalArgumentException("You can't add multiple children, please call newChildId instead for using a RepeatingView."); } childAdded = true; return span.add(childs); } else { return repeater.add(childs); } }
Example #26
Source File: PropertyEditableColumnAdvancedUserOptions.java From sakai with Educational Community License v2.0 | 5 votes |
/** * @see IColumn#newCell(MarkupContainer, String, TreeNode, int) */ public Component newCell(MarkupContainer parent, String id, TreeNode node, int level) { if(!((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).isNodeEditable()){ return new EditablePanelEmpty(id); } if(((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).isDirectAccess()){ return new EditablePanelAdvancedUserOptions(id, new PropertyModel(node, getPropertyExpression()), (NodeModel) ((DefaultMutableTreeNode) node).getUserObject(), node, settings); }else{ return new EditablePanelAdvancedUserOptionsText(id, new PropertyModel(node, getPropertyExpression()), (NodeModel) ((DefaultMutableTreeNode) node).getUserObject(), node, settings); } }
Example #27
Source File: PropertyEditableColumnAdvancedUserOptions.java From sakai with Educational Community License v2.0 | 5 votes |
/** * @see IColumn#newCell(MarkupContainer, String, TreeNode, int) */ public Component newCell(MarkupContainer parent, String id, TreeNode node, int level) { if(!((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).isNodeEditable()){ return new EditablePanelEmpty(id); } if(((NodeModel) ((DefaultMutableTreeNode) node).getUserObject()).isDirectAccess()){ return new EditablePanelAdvancedUserOptions(id, new PropertyModel(node, getPropertyExpression()), (NodeModel) ((DefaultMutableTreeNode) node).getUserObject(), node, settings); }else{ return new EditablePanelAdvancedUserOptionsText(id, new PropertyModel(node, getPropertyExpression()), (NodeModel) ((DefaultMutableTreeNode) node).getUserObject(), node, settings); } }
Example #28
Source File: WicketUtils.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
public static boolean isParent(final Component parent, final Component descendant) { final MarkupContainer p = descendant.getParent(); if (p == null) { return false; } else if (p == parent) { return true; } else { return isParent(parent, p); } }
Example #29
Source File: KendoComboboxTextFeatureEditor.java From webanno with Apache License 2.0 | 5 votes |
public KendoComboboxTextFeatureEditor(String aId, MarkupContainer aItem, IModel<FeatureState> aModel, AnnotationActionHandler aHandler) { super(aId, aItem, aModel); AnnotationFeature feat = getModelObject().feature; StringFeatureTraits traits = readFeatureTraits(feat); add(new KeyBindingsPanel("keyBindings", () -> traits.getKeyBindings(), aModel, aHandler) // The key bindings are only visible when the label is also enabled, i.e. when the // editor is used in a "normal" context and not e.g. in the keybindings // configuration panel .add(visibleWhen(() -> getLabelComponent().isVisible()))); }
Example #30
Source File: ConceptFeatureEditor.java From inception with Apache License 2.0 | 5 votes |
public ConceptFeatureEditor(String aId, MarkupContainer aItem, IModel<FeatureState> aModel, IModel<AnnotatorState> aStateModel, AnnotationActionHandler aHandler) { super(aId, aItem, new CompoundPropertyModel<>(aModel)); IModel<String> iriModel = LoadableDetachableModel.of(this::iriTooltipValue); iriBadge = new IriInfoBadge("iriInfoBadge", iriModel); iriBadge.add(visibleWhen(() -> isNotBlank(iriBadge.getModelObject()))); add(iriBadge); openIriLink = new ExternalLink("openIri", iriModel); openIriLink.add(visibleWhen(() -> isNotBlank(iriBadge.getModelObject()))); add(openIriLink); add(new DisabledKBWarning("disabledKBWarning", Model.of(getModelObject().feature))); add(focusComponent = new AutoCompleteField(MID_VALUE, _query -> getCandidates(aStateModel, aHandler, _query))); AnnotationFeature feat = getModelObject().feature; ConceptFeatureTraits traits = readFeatureTraits(feat); add(new KeyBindingsPanel("keyBindings", () -> traits.getKeyBindings(), aModel, aHandler) // The key bindings are only visible when the label is also enabled, i.e. when the // editor is used in a "normal" context and not e.g. in the keybindings // configuration panel .add(visibleWhen(() -> getLabelComponent().isVisible()))); description = new Label("description", LoadableDetachableModel.of(this::descriptionValue)); description.setOutputMarkupPlaceholderTag(true); description.add(visibleWhen( () -> getLabelComponent().isVisible() && getModelObject().getValue() != null)); add(description); }