http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/welcome/WelcomePanel.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/welcome/WelcomePanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/welcome/WelcomePanel.java deleted file mode 100644 index 9b741cd..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/welcome/WelcomePanel.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.viewer.wicket.ui.components.welcome; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.isis.viewer.wicket.model.models.WelcomeModel; -import org.apache.isis.viewer.wicket.ui.pages.home.HomePage; -import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract; - -/** - * {@link PanelAbstract Panel} displaying welcome message (as used on - * {@link HomePage}). - */ -public class WelcomePanel extends PanelAbstract<WelcomeModel> { - - private static final long serialVersionUID = 1L; - - private static final String ID_MESSAGE = "message"; - - @Inject - @Named("welcomeMessage") - private String welcomeMessage; - - public WelcomePanel(final String id, final WelcomeModel model) { - super(id, model); - model.setObject(welcomeMessage); - final Label label = new Label(ID_MESSAGE, welcomeMessage); - // safe to not escape, welcome message is read from file (part of deployed WAR) - label.setEscapeModelStrings(false); - add(label); - } -}
http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/welcome/WelcomePanelFactory.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/welcome/WelcomePanelFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/welcome/WelcomePanelFactory.java deleted file mode 100644 index 14a4099..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/welcome/WelcomePanelFactory.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.viewer.wicket.ui.components.welcome; - -import org.apache.wicket.Component; -import org.apache.wicket.model.IModel; - -import org.apache.isis.viewer.wicket.model.models.WelcomeModel; -import org.apache.isis.viewer.wicket.ui.ComponentFactory; -import org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract; -import org.apache.isis.viewer.wicket.ui.ComponentType; - -/** - * {@link ComponentFactory} for {@link WelcomePanel}. - */ -public class WelcomePanelFactory extends ComponentFactoryAbstract { - - private static final long serialVersionUID = 1L; - - // TODO update this message once Bootstrap is used for UI - private static final String DEFAULT_MESSAGE = "Apache Isis' Wicket Viewer combines the power of Apache Wicket " + "for web UIs with Apache Isis for domain modelling. " + "Out-of-the box you get a fully-functional webapp just from " + "your domain objects; you can then customize the UI by " - + "writing custom Wicket components, replacing the page layouts or " + "simply by altering the CSS"; - - - public WelcomePanelFactory() { - super(ComponentType.WELCOME, WelcomePanel.class); - } - - @Override - public ApplicationAdvice appliesTo(final IModel<?> model) { - return ApplicationAdvice.APPLIES; - } - - @Override - public Component createComponent(final String id, final IModel<?> model) { - return new WelcomePanel(id, new WelcomeModel(DEFAULT_MESSAGE)); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/ObjectAdapterMementoProviderAbstract.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/ObjectAdapterMementoProviderAbstract.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/ObjectAdapterMementoProviderAbstract.java deleted file mode 100644 index 66a781d..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/ObjectAdapterMementoProviderAbstract.java +++ /dev/null @@ -1,136 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.isis.viewer.wicket.ui.components.widgets; - -import java.util.Collection; -import java.util.List; -import java.util.Locale; -import com.google.common.base.Function; -import com.google.common.collect.Collections2; -import com.google.common.collect.Lists; -import com.vaynberg.wicket.select2.TextChoiceProvider; -import org.apache.wicket.Session; -import org.apache.wicket.util.convert.IConverter; -import org.apache.wicket.util.string.Strings; -import org.apache.isis.core.metamodel.adapter.ObjectAdapter; -import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager.ConcurrencyChecking; -import org.apache.isis.core.metamodel.adapter.oid.RootOid; -import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault; -import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings; -import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento; -import org.apache.isis.viewer.wicket.model.models.ScalarModel; -import org.apache.isis.viewer.wicket.ui.components.scalars.IsisConverterLocator; - -public abstract class ObjectAdapterMementoProviderAbstract extends TextChoiceProvider<ObjectAdapterMemento> { - - private static final long serialVersionUID = 1L; - - protected static final String NULL_PLACEHOLDER = "$$_isis_null_$$"; - private static final String NULL_DISPLAY_TEXT = ""; - - private final ScalarModel scalarModel; - private final WicketViewerSettings wicketViewerSettings; - - public ObjectAdapterMementoProviderAbstract(final ScalarModel scalarModel, final WicketViewerSettings wicketViewerSettings) { - this.scalarModel = scalarModel; - this.wicketViewerSettings = wicketViewerSettings; - } - - @Override - protected String getDisplayText(final ObjectAdapterMemento choice) { - if (choice == null) { - return NULL_DISPLAY_TEXT; - } - - final ObjectAdapter objectAdapter = choice.getObjectAdapter(ConcurrencyChecking.NO_CHECK); - final IConverter<Object> converter = findConverter(objectAdapter); - return converter != null - ? converter.convertToString(objectAdapter.getObject(), getLocale()) - : objectAdapter.titleString(null); - } - - protected Locale getLocale() { - return Session.exists() ? Session.get().getLocale() : Locale.ENGLISH; - } - - protected IConverter<Object> findConverter(final ObjectAdapter objectAdapter) { - return IsisConverterLocator.findConverter(objectAdapter, wicketViewerSettings); - } - - @Override - protected Object getId(final ObjectAdapterMemento choice) { - return choice != null? choice.asString(): NULL_PLACEHOLDER; - } - - @Override - public void query(final String term, final int page, final com.vaynberg.wicket.select2.Response<ObjectAdapterMemento> response) { - - final List<ObjectAdapterMemento> mementos = Lists.newArrayList(obtainMementos(term)); - // if not mandatory, and the list doesn't contain null already, then add it in. - if(!scalarModel.isRequired() && !mementos.contains(null)) { - mementos.add(0, null); - } - response.addAll(mementos); - } - - protected abstract List<ObjectAdapterMemento> obtainMementos(String term); - - /** - * Filters all choices against a term by using their - * {@link org.apache.isis.core.metamodel.adapter.ObjectAdapter#titleString(org.apache.isis.core.metamodel.adapter.ObjectAdapter) title string} - * - * @param term The term entered by the user - * @param choicesMementos The collections of choices to filter - * @return A list of all matching choices - */ - protected List<ObjectAdapterMemento> obtainMementos(String term, Collection<ObjectAdapterMemento> choicesMementos) { - List<ObjectAdapterMemento> matches = Lists.newArrayList(); - if (Strings.isEmpty(term)) { - matches.addAll(choicesMementos); - } else { - for (ObjectAdapterMemento candidate : choicesMementos) { - ObjectAdapter objectAdapter = candidate.getObjectAdapter(ConcurrencyChecking.NO_CHECK); - String title = objectAdapter.titleString(objectAdapter); - if (title.toLowerCase().contains(term.toLowerCase())) { - matches.add(candidate); - } - } - } - - return matches; - } - - @Override - public Collection<ObjectAdapterMemento> toChoices(final Collection<String> ids) { - final Function<String, ObjectAdapterMemento> function = new Function<String, ObjectAdapterMemento>() { - - @Override - public ObjectAdapterMemento apply(final String input) { - if(NULL_PLACEHOLDER.equals(input)) { - return null; - } - final RootOid oid = RootOidDefault.deString(input, ObjectAdapterMemento.getOidMarshaller()); - return ObjectAdapterMemento.createPersistent(oid); - } - }; - return Collections2.transform(ids, function); - } - - protected ScalarModel getScalarModel() { - return scalarModel; - } -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/bootstrap/FormGroup.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/bootstrap/FormGroup.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/bootstrap/FormGroup.java deleted file mode 100644 index bd6c038..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/bootstrap/FormGroup.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.apache.isis.viewer.wicket.ui.components.widgets.bootstrap; - -import de.agilecoders.wicket.core.util.Attributes; - -import org.apache.wicket.feedback.FeedbackMessage; -import org.apache.wicket.feedback.FeedbackMessages; -import org.apache.wicket.markup.ComponentTag; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.form.FormComponent; -import org.apache.wicket.util.lang.Args; - -/** - * A container around Bootstrap form component that sets - * <a href="http://getbootstrap.com/css/#forms-control-validation">validation state</a> - */ -public class FormGroup extends WebMarkupContainer { - - private final FormComponent<?> formComponent; - - /** - * Constructor - * - * @param id The component id - * @param formComponent The form component that controls the validation state of the form group - */ - public FormGroup(String id, FormComponent<?> formComponent) { - super(id); - - this.formComponent = Args.notNull(formComponent, "formComponent"); - } - - @Override - protected void onComponentTag(ComponentTag tag) { - super.onComponentTag(tag); - - FeedbackMessages feedbackMessages = formComponent.getFeedbackMessages(); - - if (feedbackMessages.hasMessage(FeedbackMessage.ERROR)) { - Attributes.addClass(tag, "has-error"); - } else if (feedbackMessages.hasMessage(FeedbackMessage.WARNING)) { - Attributes.addClass(tag, "has-warning"); - } else if (feedbackMessages.hasMessage(FeedbackMessage.SUCCESS)) { - Attributes.addClass(tag, "has-success"); - } - } -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/bootstrap/ModalDialog.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/bootstrap/ModalDialog.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/bootstrap/ModalDialog.java deleted file mode 100644 index 1fe06f6..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/bootstrap/ModalDialog.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.isis.viewer.wicket.ui.components.widgets.bootstrap; - -import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal; -import de.agilecoders.wicket.extensions.markup.html.bootstrap.behavior.Draggable; -import de.agilecoders.wicket.extensions.markup.html.bootstrap.behavior.DraggableConfig; - -import org.apache.wicket.Component; -import org.apache.wicket.MarkupContainer; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.behavior.AttributeAppender; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.model.IModel; -import org.apache.isis.viewer.wicket.model.models.ActionPrompt; - -/** - * A base class for all modal dialogs - */ -public class ModalDialog<T> extends Modal<T> implements ActionPrompt { - - public ModalDialog(String markupId) { - this(markupId, null); - } - - public ModalDialog(String id, IModel<T> model) { - super(id, model); - - setFadeIn(false); - setUseKeyboard(true); - setDisableEnforceFocus(true); - setOutputMarkupPlaceholderTag(true); - WebMarkupContainer emptyComponent = new WebMarkupContainer(getContentId()); - add(emptyComponent); - } - - @Override - public void setTitle(Component component, AjaxRequestTarget target) { - ((MarkupContainer)get("dialog:header")).addOrReplace(component); - } - - @Override - public void setPanel(Component component, AjaxRequestTarget target) { - addOrReplace(component); - } - - @Override - public void showPrompt(AjaxRequestTarget target) { - setVisible(true); - target.add(this); - show(target); - } - - @Override - public String getTitleId() { - return "header-label"; - } - - @Override - public String getContentId() { - return "content"; - } - - @Override - public void closePrompt(AjaxRequestTarget target) { - if (target != null) { - close(target); - } - setVisible(false); - } - - @Override - protected WebMarkupContainer createDialog(String id) { - WebMarkupContainer dialog = super.createDialog(id); - dialog.add(AttributeAppender.append("class", "modal-dialog-center")); - dialog.add(new Draggable(new DraggableConfig().withHandle(".modal-header").withCursor("move"))); - return dialog; - } -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/breadcrumbs/BreadcrumbModel.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/breadcrumbs/BreadcrumbModel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/breadcrumbs/BreadcrumbModel.java deleted file mode 100644 index 02b1ce3..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/breadcrumbs/BreadcrumbModel.java +++ /dev/null @@ -1,126 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.isis.viewer.wicket.ui.components.widgets.breadcrumbs; - -import java.io.Serializable; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; - -import org.apache.wicket.request.mapper.parameter.PageParameters; - -import org.apache.isis.viewer.wicket.model.mementos.PageParameterNames; -import org.apache.isis.viewer.wicket.model.models.EntityModel; - -public class BreadcrumbModel implements Serializable { - - private static final long serialVersionUID = 1L; - - private static final int MAX_SIZE = 5; - - private final Map<String, EntityModel> entityModelByOidStr = Maps.newHashMap(); - private final Map<EntityModel, String> titleByEntityModel = Maps.newHashMap(); - private final Map<EntityModel, String> oidStrByEntityModel = Maps.newHashMap(); - private final List<EntityModel> list = Lists.newArrayList(); - - public List<EntityModel> getList() { - return Collections.unmodifiableList(list); - } - - public void visited(final EntityModel entityModel) { - - // ignore view models - if(entityModel.getTypeOfSpecification().isViewModel()) { - return; - } - - final String oidStr = oidStrFor(entityModel); - - removeExisting(oidStr); - addToStart(oidStr, entityModel); - - trimTo(MAX_SIZE); - } - - private String oidStrFor(final EntityModel entityModel) { - final PageParameters pageParameters = entityModel.getPageParametersWithoutUiHints(); - return PageParameterNames.OBJECT_OID.getStringFrom(pageParameters); - } - - private void addToStart(final String oidStr, final EntityModel entityModel) { - entityModelByOidStr.put(oidStr, entityModel); - titleByEntityModel.put(entityModel, entityModel.getTitle()); - oidStrByEntityModel.put(entityModel, oidStr); - list.add(0, entityModel); - } - - private void removeExisting(final String oidStr) { - final EntityModel existingModel = entityModelByOidStr.get(oidStr); - if(existingModel != null) { - remove(oidStr, existingModel); - } - } - - private void trimTo(final int size) { - if(list.size() <= size) { - return; - } - final List<EntityModel> modelsToRemove = list.subList(size, list.size()); - for (final EntityModel model : modelsToRemove) { - final String oidStr = oidStrByEntityModel.get(model); - remove(oidStr, model); - } - } - - private void remove(final String oidStr, final EntityModel model) { - entityModelByOidStr.remove(oidStr); - titleByEntityModel.remove(model); - oidStrByEntityModel.remove(model); - list.remove(model); - } - - public void remove(String oidStr) { - EntityModel removedModel = entityModelByOidStr.remove(oidStr); - if(removedModel != null) { - remove(removedModel); - } - } - - public void remove(EntityModel entityModel) { - String oidStr = oidStrByEntityModel.get(entityModel); - if(oidStr != null) { - remove(oidStr, entityModel); - } - } - - public String titleFor(final EntityModel model) { - return titleByEntityModel.get(model); - } - - public EntityModel lookup(String oidStr) { - if(oidStr == null) { - return null; - } - return entityModelByOidStr.get(oidStr); - } - - - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/breadcrumbs/BreadcrumbModelProvider.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/breadcrumbs/BreadcrumbModelProvider.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/breadcrumbs/BreadcrumbModelProvider.java deleted file mode 100644 index 1f41ce2..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/breadcrumbs/BreadcrumbModelProvider.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.isis.viewer.wicket.ui.components.widgets.breadcrumbs; - - -public interface BreadcrumbModelProvider { - - BreadcrumbModel getBreadcrumbModel(); -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/breadcrumbs/BreadcrumbPanel.html ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/breadcrumbs/BreadcrumbPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/breadcrumbs/BreadcrumbPanel.html deleted file mode 100644 index 13d7bdd..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/breadcrumbs/BreadcrumbPanel.html +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<html xmlns:wicket="http://wicket.apache.org"> - <body> - <wicket:panel> - <span class="breadcrumbPanel"> - <input wicket:id="breadcrumbs" type="hidden" class="autoComplete form-control select2-remote" style="width: 100%" /> - </span> - </wicket:panel> - </body> -</html> - http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/breadcrumbs/BreadcrumbPanel.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/breadcrumbs/BreadcrumbPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/breadcrumbs/BreadcrumbPanel.java deleted file mode 100644 index 76badf0..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/breadcrumbs/BreadcrumbPanel.java +++ /dev/null @@ -1,115 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.isis.viewer.wicket.ui.components.widgets.breadcrumbs; - -import java.util.Collection; -import com.vaynberg.wicket.select2.Response; -import com.vaynberg.wicket.select2.Select2Choice; -import com.vaynberg.wicket.select2.Settings; -import com.vaynberg.wicket.select2.TextChoiceProvider; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; -import org.apache.wicket.model.IModel; -import org.apache.wicket.model.Model; -import org.apache.isis.core.commons.authentication.MessageBroker; -import org.apache.isis.core.runtime.system.context.IsisContext; -import org.apache.isis.viewer.wicket.model.mementos.PageParameterNames; -import org.apache.isis.viewer.wicket.model.models.EntityModel; -import org.apache.isis.viewer.wicket.ui.errors.JGrowlUtil; -import org.apache.isis.viewer.wicket.ui.pages.entity.EntityPage; -import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract; - -public class BreadcrumbPanel extends PanelAbstract<IModel<Void>> { - - private static final long serialVersionUID = 1L; - - private static final String ID_BREADCRUMBS = "breadcrumbs"; - - public BreadcrumbPanel(String id) { - super(id); - } - - @Override - protected void onInitialize() { - super.onInitialize(); - - final BreadcrumbModelProvider session = (BreadcrumbModelProvider) getSession(); - final BreadcrumbModel breadcrumbModel = session.getBreadcrumbModel(); - - final IModel<EntityModel> entityModel = new Model<EntityModel>(); - final Select2Choice<EntityModel> breadcrumbChoice = new Select2Choice<EntityModel>(ID_BREADCRUMBS, entityModel); - - breadcrumbChoice.add( - new AjaxFormComponentUpdatingBehavior("change"){ - - private static final long serialVersionUID = 1L; - - @Override - protected void onUpdate(AjaxRequestTarget target) { - final String oidStr = breadcrumbChoice.getInput(); - final EntityModel selectedModel = breadcrumbModel.lookup(oidStr); - if(selectedModel == null) { - final MessageBroker messageBroker = IsisContext.getAuthenticationSession().getMessageBroker(); - messageBroker.addWarning("Cannot find object"); - String feedbackMsg = JGrowlUtil.asJGrowlCalls(messageBroker); - target.appendJavaScript(feedbackMsg); - breadcrumbModel.remove(oidStr); - return; - } - setResponsePage(EntityPage.class, selectedModel.getPageParameters()); - } - }); - - final Settings settings = breadcrumbChoice.getSettings(); - settings.setMinimumInputLength(0); - settings.setWidth("100%"); - - breadcrumbChoice.setProvider(new TextChoiceProvider<EntityModel>() { - - private static final long serialVersionUID = 1L; - - @Override - protected String getDisplayText(EntityModel choice) { - return breadcrumbModel.titleFor(choice); - } - - @Override - protected Object getId(EntityModel choice) { - try { - return PageParameterNames.OBJECT_OID.getStringFrom(choice.getPageParameters()); - } catch(Exception ex) { - breadcrumbModel.remove(choice); - return null; - } - } - - @Override - public void query(String term, int page, Response<EntityModel> response) { - response.addAll(breadcrumbModel.getList()); - } - - @Override - public Collection<EntityModel> toChoices(Collection<String> ids) { - return breadcrumbModel.getList(); - } - - }); - addOrReplace(breadcrumbChoice); - } - - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/buttons/ContainedButtonPanel.html ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/buttons/ContainedButtonPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/buttons/ContainedButtonPanel.html deleted file mode 100644 index 2eb63ca..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/buttons/ContainedButtonPanel.html +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<html> - <body> - <wicket:panel> - <span wicket:id="container" class="containedButtonPanel"> - <form wicket:id="form"> - <input type="submit" wicket:id="button" /> - </form> - </span> - </wicket:panel> - </body> -</html> http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/buttons/ContainedButtonPanel.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/buttons/ContainedButtonPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/buttons/ContainedButtonPanel.java deleted file mode 100644 index 5319a87..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/buttons/ContainedButtonPanel.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.viewer.wicket.ui.components.widgets.buttons; - -import java.util.List; -import com.google.common.collect.Lists; -import org.apache.wicket.Component; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.markup.html.form.AjaxButton; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.form.Button; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.model.Model; -import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract; - -/** - * A button contained within its own form. - */ -public class ContainedButtonPanel extends PanelAbstract<Model<String>> { - - private static final long serialVersionUID = 1L; - - private static final String ID_CONTAINER = "container"; - private static final String ID_FORM = "form"; - private static final String ID_BUTTON = "button"; - - private final Button button; - private final List<Component> componentsToRerender = Lists.newArrayList(); - - public ContainedButtonPanel(final String id, final String caption) { - super(id, Model.of(caption)); - - final WebMarkupContainer markupContainer = new WebMarkupContainer(ID_CONTAINER); - add(markupContainer); - final Form<Object> form = new Form<Object>(ID_FORM); - markupContainer.add(form); - button = new AjaxButton(ID_BUTTON, getModel()) { - private static final long serialVersionUID = 1L; - - @Override - protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) { - setDefaultFormProcessing(false); - ContainedButtonPanel.this.onSubmit(); - if (target != null) { - for (final Component component : componentsToRerender) { - //target.addComponent(component); - target.add(component); - } - } - } - }; - form.add(button); - } - - public void addComponentToRerender(final Component component) { - component.setOutputMarkupPlaceholderTag(true); - componentsToRerender.add(component); - } - - public void setCaption(final String string) { - button.setModelValue(new String[] { string }); - } - - public void setLabel(final Model<String> labelModel) { - button.setLabel(labelModel); - } - - /** - * Hook method for (typically anonymous) subclasses to override. - */ - public void onSubmit() { - } - - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/buttons/ToggleButtonsPanel.html ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/buttons/ToggleButtonsPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/buttons/ToggleButtonsPanel.html deleted file mode 100644 index 1bb1346..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/buttons/ToggleButtonsPanel.html +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<html> - <body> - <wicket:panel> - <span class="toggleButtonsPanel"> - <span wicket:id="button1"/> - <span wicket:id="button2"/> - </span> - </wicket:panel> - </body> -</html> http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/buttons/ToggleButtonsPanel.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/buttons/ToggleButtonsPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/buttons/ToggleButtonsPanel.java deleted file mode 100644 index 8faff9a..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/buttons/ToggleButtonsPanel.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.viewer.wicket.ui.components.widgets.buttons; - -import java.io.Serializable; -import org.apache.wicket.Component; -import org.apache.isis.viewer.wicket.model.models.EntityModel; -import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract; - -/** - * Abstraction of show/hide, ie two buttons only one of which is visible. - */ -public class ToggleButtonsPanel extends PanelAbstract<EntityModel> { - - private static final long serialVersionUID = 1L; - - private static final String ID_BUTTON_1 = "button1"; - private static final String ID_BUTTON_2 = "button2"; - - private boolean flag; - private Toggler toggler; - - private ContainedButtonPanel button1; - - private ContainedButtonPanel button2; - - public ToggleButtonsPanel(final String id, final String button1Caption, final String button2Caption) { - super(id, null); - this.flag = false; - buildGui(button1Caption, button2Caption); - onInit(); - } - - private void buildGui(final String button1Caption, final String button2Caption) { - button1 = new ContainedButtonPanel(ID_BUTTON_1, button1Caption) { - private static final long serialVersionUID = 1L; - - @Override - public void onSubmit() { - toggler.toggle(); - } - }; - addOrReplace(button1); - - button2 = new ContainedButtonPanel(ID_BUTTON_2, button2Caption) { - private static final long serialVersionUID = 1L; - - @Override - public void onSubmit() { - toggler.toggle(); - } - }; - toggler = new Toggler(button1, button2); - addOrReplace(button2); - } - - public void addComponentToRerender(final Component... components) { - for (final Component component : components) { - button1.addComponentToRerender(component); - button2.addComponentToRerender(component); - } - } - - /** - * Hook method to override. - */ - protected void onInit() { - } - - /** - * Hook method to override. - */ - protected void onButton1() { - } - - /** - * Hook method to override. - */ - protected void onButton2() { - } - - /** - * For subclasses to use. - */ - protected final void hideButton1() { - flag = true; - toggler.syncButtonVisibility(); - } - - /** - * For subclasses to use. - */ - protected final void hideButton2() { - flag = false; - toggler.syncButtonVisibility(); - } - - private class Toggler implements Serializable { - private static final long serialVersionUID = 1L; - - private final Component component1; - private final Component component2; - - public Toggler(final Component component1, final Component component2) { - this.component1 = component1; - this.component2 = component2; - syncButtonVisibility(); - } - - public void toggle() { - fireHooks(); - syncButtonVisibility(); - } - - private void fireHooks() { - flag = !flag; - if (flag) { - onButton1(); - } else { - onButton2(); - } - } - - private void syncButtonVisibility() { - component1.setVisible(!flag); - component2.setVisible(flag); - } - } - - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/checkbox/ContainedToggleboxPanel.html ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/checkbox/ContainedToggleboxPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/checkbox/ContainedToggleboxPanel.html deleted file mode 100644 index 3491ab6..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/checkbox/ContainedToggleboxPanel.html +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<html> - <body> - <wicket:panel> - <span wicket:id="container" class="containedToggleboxPanel"> - <form wicket:id="form" class="containedToggleboxPanelForm"> - <input type="checkbox" wicket:id="togglebox" /> - </form> - </span> - </wicket:panel> - </body> -</html> http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/checkbox/ContainedToggleboxPanel.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/checkbox/ContainedToggleboxPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/checkbox/ContainedToggleboxPanel.java deleted file mode 100644 index af2ea6c..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/checkbox/ContainedToggleboxPanel.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.viewer.wicket.ui.components.widgets.checkbox; - -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.markup.html.form.AjaxCheckBox; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.model.Model; -import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract; - -/** - * A button contained within its own form. - */ -public class ContainedToggleboxPanel extends PanelAbstract<Model<Boolean>> { - - private static final long serialVersionUID = 1L; - - private static final String ID_CONTAINER = "container"; - private static final String ID_FORM = "form"; - private static final String ID_TOGGLEBOX = "togglebox"; - - private final AjaxCheckBox checkbox; -// private final List<Component> componentsToRerender = Lists.newArrayList(); - - public ContainedToggleboxPanel(final String id) { - super(id); - - final WebMarkupContainer markupContainer = new WebMarkupContainer(ID_CONTAINER); - add(markupContainer); - final Form<Object> form = new Form<Object>(ID_FORM); - markupContainer.add(form); - - checkbox = new AjaxCheckBox(ID_TOGGLEBOX, Model.of(false)) { - private static final long serialVersionUID = 1L; - - @Override - protected void onUpdate(AjaxRequestTarget target) { - ContainedToggleboxPanel.this.onSubmit(target); - } - }; - form.add(checkbox); - } - - -// public void addComponentToRerender(final Component component) { -// component.setOutputMarkupPlaceholderTag(true); -// componentsToRerender.add(component); -// } - - /** - * Hook method for (typically anonymous) subclasses to override. - */ - public void onSubmit(AjaxRequestTarget target) { - } - - /** - * Programmatic toggling. - * @param target - */ - public void toggle(AjaxRequestTarget target) { - checkbox.setModelObject(!checkbox.getModelObject()); - onSubmit(target); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/containers/UiHintPathSignificantWebMarkupContainer.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/containers/UiHintPathSignificantWebMarkupContainer.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/containers/UiHintPathSignificantWebMarkupContainer.java deleted file mode 100644 index d43033f..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/containers/UiHintPathSignificantWebMarkupContainer.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.isis.viewer.wicket.ui.components.widgets.containers; - -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.model.IModel; - -import org.apache.isis.viewer.wicket.model.hints.UiHintPathSignificant; - -public class UiHintPathSignificantWebMarkupContainer extends WebMarkupContainer implements UiHintPathSignificant { - private static final long serialVersionUID = 1L; - - public UiHintPathSignificantWebMarkupContainer(String id, IModel<?> model) { - super(id, model); - } - - public UiHintPathSignificantWebMarkupContainer(String id) { - super(id); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.css ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.css deleted file mode 100644 index ca08a38..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.css +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -div.entitySimpleLinkPanel { - display: inline -} - -div.entitySimpleLinkPanel > div { - margin-left: 2px; -} - -.entitySimpleLinkPanel .entityImage { - width: 16px; - height: 16px; -} - - http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.html ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.html deleted file mode 100644 index 047b75d..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.html +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" - xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" - xml:lang="en" - lang="en"> - <wicket:head> - <wicket:link> - <link href="EntityLinkSimplePanel.css" rel="stylesheet" type="text/css"/> - </wicket:link> - </wicket:head> - <body> - <wicket:panel> - <div class="entityLinkSimplePanel entityLinkComponentType"> - <div> - <div wicket:id="entityIconAndTitle">[icon and title]</div> - <span wicket:id="entityTitleNull">(none)</span> - <div class="clearfix"></div> - </div> - </div> - </wicket:panel> - </body> -</html> http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.java deleted file mode 100644 index cf04df6..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.viewer.wicket.ui.components.widgets.entitysimplelink; - -import org.apache.wicket.Component; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.html.form.FormComponentPanel; - -import org.apache.isis.core.metamodel.adapter.ObjectAdapter; -import org.apache.isis.viewer.wicket.model.models.EntityModel; -import org.apache.isis.viewer.wicket.ui.ComponentFactory; -import org.apache.isis.viewer.wicket.ui.ComponentType; -import org.apache.isis.viewer.wicket.ui.components.widgets.formcomponent.CancelHintRequired; -import org.apache.isis.viewer.wicket.ui.components.widgets.formcomponent.FormComponentPanelAbstract; - -/** - * {@link FormComponentPanel} representing a reference to an entity: a link and - * (optionally) an autocomplete field. - */ -public class EntityLinkSimplePanel extends FormComponentPanelAbstract<ObjectAdapter> implements CancelHintRequired { - - private static final long serialVersionUID = 1L; - - private static final String ID_ENTITY_ICON_AND_TITLE = "entityIconAndTitle"; - private static final String ID_ENTITY_TITLE_NULL = "entityTitleNull"; - - public EntityLinkSimplePanel(final String id, final EntityModel entityModel) { - super(id, entityModel); - setType(ObjectAdapter.class); - buildGui(); - } - - public EntityModel getEntityModel() { - return (EntityModel) getModel(); - } - - private void buildGui() { - syncWithInput(); - } - - @Override - protected void onBeforeRender() { - syncWithInput(); - super.onBeforeRender(); - } - - private void syncWithInput() { - final ObjectAdapter adapter = getPendingElseCurrentAdapter(); - - if (adapter != null) { - final EntityModel entityModelForLink = new EntityModel(adapter); - entityModelForLink.setContextAdapterIfAny(getEntityModel().getContextAdapterIfAny()); - entityModelForLink.setRenderingHint(getEntityModel().getRenderingHint()); - - final ComponentFactory componentFactory = getComponentFactoryRegistry().findComponentFactory(ComponentType.ENTITY_ICON_AND_TITLE, entityModelForLink); - final Component component = componentFactory.createComponent(entityModelForLink); - addOrReplace(component); - - permanentlyHide(ID_ENTITY_TITLE_NULL); - } else { - // represent no object by a simple label displaying '(none)' - addOrReplace(new Label(ID_ENTITY_TITLE_NULL, "(none)")); - permanentlyHide(ID_ENTITY_ICON_AND_TITLE); - } - } - - @Override - public void onCancel() { - } - - @Override - public void validate() { - // no-op since immutable - } - - private ObjectAdapter getPendingElseCurrentAdapter() { - return getEntityModel().getPendingElseCurrentAdapter(); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanelFactory.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanelFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanelFactory.java deleted file mode 100644 index f7c731d..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanelFactory.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.viewer.wicket.ui.components.widgets.entitysimplelink; - -import org.apache.wicket.Component; -import org.apache.wicket.model.IModel; - -import org.apache.isis.core.metamodel.facets.object.value.ValueFacet; -import org.apache.isis.core.metamodel.spec.ObjectSpecification; -import org.apache.isis.viewer.wicket.model.models.EntityModel; -import org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract; -import org.apache.isis.viewer.wicket.ui.ComponentType; - -public class EntityLinkSimplePanelFactory extends ComponentFactoryAbstract { - - private static final long serialVersionUID = 1L; - - public EntityLinkSimplePanelFactory() { - super(ComponentType.ENTITY_LINK, EntityLinkSimplePanel.class); - } - - @Override - public ApplicationAdvice appliesTo(final IModel<?> model) { - if (!(model instanceof EntityModel)) { - return ApplicationAdvice.DOES_NOT_APPLY; - } - final EntityModel entityModel = (EntityModel) model; - final ObjectSpecification specification = entityModel.getTypeOfSpecification(); - return appliesIf(specification != null && !specification.containsFacet(ValueFacet.class)); - } - - @Override - public Component createComponent(final String id, final IModel<?> model) { - final EntityModel scalarModel = (EntityModel) model; - return new EntityLinkSimplePanel(id, scalarModel); - } -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/CancelHintRequired.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/CancelHintRequired.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/CancelHintRequired.java deleted file mode 100644 index 5d060b2..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/CancelHintRequired.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.viewer.wicket.ui.components.widgets.formcomponent; - -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.markup.html.form.FormComponent; - -/** - * {@link FormComponent}s that require explicit notification that their owning - * {@link Form} has been cancelled should implement this interface. - */ -public interface CancelHintRequired { - - void onCancel(); -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/FormComponentPanelAbstract.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/FormComponentPanelAbstract.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/FormComponentPanelAbstract.java deleted file mode 100644 index 59f152e..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/FormComponentPanelAbstract.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.viewer.wicket.ui.components.widgets.formcomponent; - -import java.util.List; -import org.apache.wicket.Component; -import org.apache.wicket.MarkupContainer; -import org.apache.wicket.Session; -import org.apache.wicket.markup.html.form.FormComponent; -import org.apache.wicket.markup.html.form.FormComponentPanel; -import org.apache.wicket.model.IModel; -import org.apache.isis.core.commons.authentication.AuthenticationSession; -import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider; -import org.apache.isis.core.commons.authentication.AuthenticationSessionProviderAware; -import org.apache.isis.core.metamodel.adapter.ObjectAdapter; -import org.apache.isis.core.runtime.system.context.IsisContext; -import org.apache.isis.core.runtime.system.persistence.PersistenceSession; -import org.apache.isis.viewer.wicket.model.hints.UiHintContainer; -import org.apache.isis.viewer.wicket.model.isis.PersistenceSessionProvider; -import org.apache.isis.viewer.wicket.ui.ComponentType; -import org.apache.isis.viewer.wicket.ui.app.registry.ComponentFactoryRegistry; -import org.apache.isis.viewer.wicket.ui.app.registry.ComponentFactoryRegistryAccessor; -import org.apache.isis.viewer.wicket.ui.util.Components; - -/** - * Convenience adapter for {@link FormComponent}s that are implemented using the - * Wicket {@link FormComponentPanel}, providing the ability to build up the - * panel using other {@link ComponentType}s. - */ -public abstract class FormComponentPanelAbstract<T> extends FormComponentPanel<T> implements PersistenceSessionProvider, AuthenticationSessionProvider { - - private static final long serialVersionUID = 1L; - - private ComponentType componentType; - - public FormComponentPanelAbstract(final String id, final IModel<T> model) { - super(id, model); - this.componentType = ComponentType.lookup(id); - } - - public ComponentType getComponentType() { - return componentType; - } - - /** - * For subclasses - * - * @return - */ - protected Component addOrReplace(final ComponentType componentType, final IModel<?> model) { - return getComponentFactoryRegistry().addOrReplaceComponent(this, componentType, model); - } - - /** - * For subclasses - */ - protected void permanentlyHide(final ComponentType... componentIds) { - permanentlyHide(this, componentIds); - } - - /** - * For subclasses - */ - public void permanentlyHide(final String... ids) { - permanentlyHide(this, ids); - } - - /** - * For subclasses - */ - protected void permanentlyHide(final MarkupContainer container, final ComponentType... componentIds) { - Components.permanentlyHide(container, componentIds); - } - - /** - * For subclasses - */ - public void permanentlyHide(final MarkupContainer container, final String... ids) { - Components.permanentlyHide(container, ids); - } - - - // /////////////////////////////////////////////////////////////////// - // Hint support - // /////////////////////////////////////////////////////////////////// - - public UiHintContainer getHintContainer() { - return hintContainerOf(this); - } - - private UiHintContainer hintContainerOf(Component component) { - if(component == null) { - return null; - } - IModel<?> model = component.getDefaultModel(); - if(model instanceof UiHintContainer) { - return (UiHintContainer) model; - } - // otherwise, go up the UI component hierarchy - return hintContainerOf(getParent()); - } - - // /////////////////////////////////////////////////////////////////// - // Convenience - // /////////////////////////////////////////////////////////////////// - - protected ComponentFactoryRegistry getComponentFactoryRegistry() { - final ComponentFactoryRegistryAccessor cfra = (ComponentFactoryRegistryAccessor) getApplication(); - return cfra.getComponentFactoryRegistry(); - } - - /** - * The underlying {@link AuthenticationSession Isis session} wrapped in the - * {@link #getWebSession() Wicket session}. - * - * @return - */ - @Override - public AuthenticationSession getAuthenticationSession() { - return ((AuthenticationSessionProvider) Session.get()).getAuthenticationSession(); - } - - // /////////////////////////////////////////////////////////////////// - // Dependencies (from IsisContext) - // /////////////////////////////////////////////////////////////////// - - @Override - public PersistenceSession getPersistenceSession() { - return IsisContext.getPersistenceSession(); - } - - protected List<ObjectAdapter> getServices() { - return getPersistenceSession().getServices(); - } - - - // ///////////////////////////////////////////////// - // *Provider impl. - // ///////////////////////////////////////////////// - - @Override - public void injectInto(final Object candidate) { - if (AuthenticationSessionProviderAware.class.isAssignableFrom(candidate.getClass())) { - final AuthenticationSessionProviderAware cast = AuthenticationSessionProviderAware.class.cast(candidate); - cast.setAuthenticationSessionProvider(this); - } - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/FormFeedbackPanel.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/FormFeedbackPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/FormFeedbackPanel.java deleted file mode 100644 index d3ff54a..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/FormFeedbackPanel.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.viewer.wicket.ui.components.widgets.formcomponent; - -import de.agilecoders.wicket.core.markup.html.bootstrap.common.NotificationPanel; - -import org.apache.wicket.feedback.FeedbackMessage; -import org.apache.wicket.feedback.IFeedbackMessageFilter; -import org.apache.wicket.markup.html.form.FormComponent; - -/** - * {@link NotificationPanel} designed for forms; filters out any - * {@link FeedbackMessage}s from {@link FormComponent}s (the idea being that - * they will have their own {@link NotificationPanel}s. - */ -public class FormFeedbackPanel extends NotificationPanel { - private static final long serialVersionUID = 1L; - - public FormFeedbackPanel(final String id) { - super(id); - setFilter(new IFeedbackMessageFilter() { - - private static final long serialVersionUID = 1L; - - @Override - public boolean accept(final FeedbackMessage message) { - return !(message.getReporter() instanceof FormComponent<?>); - } - }); - } -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/linkandlabel/ActionLinkFactory.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/linkandlabel/ActionLinkFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/linkandlabel/ActionLinkFactory.java deleted file mode 100644 index 6c07221..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/linkandlabel/ActionLinkFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.viewer.wicket.ui.components.widgets.linkandlabel; - -import java.io.Serializable; -import org.apache.isis.core.metamodel.spec.feature.ObjectAction; -import org.apache.isis.viewer.wicket.model.links.LinkAndLabel; -import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento; - -public interface ActionLinkFactory extends Serializable { - - LinkAndLabel newLink( - final ObjectAdapterMemento adapter, - final ObjectAction noAction, - final String linkId); -}
