Skip to content
Snippets Groups Projects
Commit aa824290 authored by pkupczyk's avatar pkupczyk
Browse files

SSDM-772 : Link to navigate to a specific sub-tab in the generic web UI - make...

SSDM-772 : Link to navigate to a specific sub-tab in the generic web UI - make it work without "force reopen" flag (once a tab is open it will be just activated)

SVN: 32428
parent 31d7560e
No related branches found
No related tags found
No related merge requests found
Showing
with 111 additions and 45 deletions
......@@ -47,8 +47,8 @@ public class DefaultTabItem implements ITabItem
private final boolean isCloseConfirmationNeeded;
/**
* Creates a tab with the specified {@link Component}. The tab is unaware of database
* modifications and will not be automatically refreshed if changes occur.
* Creates a tab with the specified {@link Component}. The tab is unaware of database modifications and will not be automatically refreshed if
* changes occur.
*/
public static ITabItem createUnaware(final String title, final Component component,
boolean isCloseConfirmationNeeded, IViewContext<?> viewContext)
......@@ -58,9 +58,8 @@ public class DefaultTabItem implements ITabItem
}
/**
* Creates a tab with the specified {@link Component} and updater action. The updater action
* will be invoked when this tab is selected. Note, that this tab is unaware of database
* modifications and will not be automatically refreshed if changes occur.
* Creates a tab with the specified {@link Component} and updater action. The updater action will be invoked when this tab is selected. Note, that
* this tab is unaware of database modifications and will not be automatically refreshed if changes occur.
*/
public static ITabItem createWithUpdater(final String title, final Component component,
IDelegatedAction updater, IViewContext<?> viewContext)
......@@ -69,8 +68,8 @@ public class DefaultTabItem implements ITabItem
}
/**
* Creates a tab with the specified {@link ContentPanel}. The tab is unaware of database
* modifications and will not be automatically refreshed if changes occur.
* Creates a tab with the specified {@link ContentPanel}. The tab is unaware of database modifications and will not be automatically refreshed if
* changes occur.
*/
public static ITabItem createUnaware(final ContentPanel component,
boolean isCloseConfirmationNeeded, IViewContext<?> viewContext)
......@@ -87,8 +86,8 @@ public class DefaultTabItem implements ITabItem
}
/**
* Creates a tab with the specified component. The tab is aware of database modifications and
* will be automatically refreshed if relevant changes take place.
* Creates a tab with the specified component. The tab is aware of database modifications and will be automatically refreshed if relevant changes
* take place.
*/
public static ITabItem create(final String title,
final DatabaseModificationAwareComponent component, IViewContext<?> viewContext,
......@@ -194,6 +193,11 @@ public class DefaultTabItem implements ITabItem
{
lastModificationStateUpdaterOrNull.update();
}
if (component instanceof IComponentWithActivation)
{
((IComponentWithActivation) component).activate();
}
GWTUtils.updatePageTitle(getTabTitleUpdater().getCurrentTitle());
}
......
/*
* Copyright 2012 ETH Zuerich, CISD
*
* Licensed 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 ch.systemsx.cisd.openbis.generic.client.web.client.application.framework;
/**
* @author pkupczyk
*/
public interface IComponentWithActivation
{
public void activate();
}
......@@ -39,7 +39,7 @@ public final class OpenEntityDetailsTabAction implements IDelegatedAction
private final IViewContext<?> viewContext;
private final boolean keyPressed;
private final String subtab;
public OpenEntityDetailsTabAction(IEntityInformationHolderWithPermId entity,
......@@ -62,8 +62,7 @@ public final class OpenEntityDetailsTabAction implements IDelegatedAction
this.keyPressed = keyPressed;
this.subtab = subtab;
}
@Override
public void execute()
{
......@@ -77,8 +76,9 @@ public final class OpenEntityDetailsTabAction implements IDelegatedAction
final AbstractTabItemFactory tabView = createClientPlugin.createEntityViewer(entity);
String tabGroupDisplayId = null;
switch (entityKind) {
switch (entityKind)
{
case DATA_SET:
tabGroupDisplayId = DisplayTypeIDGenerator.GENERIC_DATASET_VIEWER.createID(entityType.getCode());
break;
......@@ -94,14 +94,14 @@ public final class OpenEntityDetailsTabAction implements IDelegatedAction
default:
break;
}
if (subtab != null && subtab.length() > 0 && tabGroupDisplayId != null) {
if (subtab != null && subtab.length() > 0 && tabGroupDisplayId != null)
{
viewContext.getDisplaySettingsManager().storeActiveTabSettings(
tabGroupDisplayId,
subtab, null);
tabView.setForceReopen(true);
}
tabView.setInBackground(keyPressed);
DispatcherHelper.dispatchNaviEvent(tabView);
......
......@@ -59,7 +59,7 @@ public class SectionsPanel extends LayoutContainer
tryApplyDisplaySettings();
}
protected void tryApplyDisplaySettings()
public void tryApplyDisplaySettings()
{
if (getDisplayID() != null)
{
......
......@@ -41,6 +41,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewConte
import ch.systemsx.cisd.openbis.generic.client.web.client.application.TabContent;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.DatabaseModificationAwareComponent;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.DisplayTypeIDGenerator;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.IComponentWithActivation;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.IDatabaseModificationObserver;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.menu.ActionMenu;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.menu.IActionMenuItem;
......@@ -75,7 +76,7 @@ import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.IGenericClientS
* @author Piotr Buczek
*/
abstract public class GenericDataSetViewer extends AbstractViewerWithVerticalSplit<AbstractExternalData>
implements IDatabaseModificationObserver
implements IDatabaseModificationObserver, IComponentWithActivation
{
public static final String PREFIX = "generic-dataset-viewer_";
......@@ -87,6 +88,8 @@ abstract public class GenericDataSetViewer extends AbstractViewerWithVerticalSpl
private boolean toolbarInitialized;
private SectionsPanel rightPanel;
public static DatabaseModificationAwareComponent create(
final IViewContext<IGenericClientServiceAsync> localViewContext,
final IIdAndCodeHolder identifiable)
......@@ -248,7 +251,7 @@ abstract public class GenericDataSetViewer extends AbstractViewerWithVerticalSpl
return new DataSetPropertiesPanel(dataset, getViewContext());
}
private final Component createRightPanel(final AbstractExternalData dataset)
private final SectionsPanel createRightPanel(final AbstractExternalData dataset)
{
final IViewContext<?> context = getViewContext();
final SectionsPanel container =
......@@ -299,7 +302,7 @@ abstract public class GenericDataSetViewer extends AbstractViewerWithVerticalSpl
return container;
}
private static final class DataSetInfoCallback extends AbstractAsyncCallback<AbstractExternalData>
private final class DataSetInfoCallback extends AbstractAsyncCallback<AbstractExternalData>
{
private final GenericDataSetViewer genericDataSetViewer;
......@@ -336,7 +339,7 @@ abstract public class GenericDataSetViewer extends AbstractViewerWithVerticalSpl
genericDataSetViewer.add(leftPanel, genericDataSetViewer.createLeftBorderLayoutData());
genericDataSetViewer.configureLeftPanel(leftPanel);
// Right panel
final Component rightPanel = genericDataSetViewer.createRightPanel(result);
rightPanel = genericDataSetViewer.createRightPanel(result);
genericDataSetViewer.add(rightPanel, createRightBorderLayoutData());
genericDataSetViewer.layout();
......@@ -544,4 +547,13 @@ abstract public class GenericDataSetViewer extends AbstractViewerWithVerticalSpl
{
return viewContext.getMessage(Dict.BUTTON_DELETE_DATA_SET);
}
@Override
public void activate()
{
if (rightPanel != null)
{
rightPanel.tryApplyDisplaySettings();
}
}
}
......@@ -37,6 +37,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.
import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.CompositeDatabaseModificationObserverWithMainObserver;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.DatabaseModificationAwareComponent;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.DisplayTypeIDGenerator;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.IComponentWithActivation;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.IDatabaseModificationObserver;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.AbstractViewerWithVerticalSplit;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.deletion.RevertDeletionConfirmationDialog;
......@@ -65,7 +66,7 @@ import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.Abs
* @author Izabela Adamczyk
*/
public class GenericExperimentViewer extends AbstractViewerWithVerticalSplit<Experiment> implements
IDatabaseModificationObserver
IDatabaseModificationObserver, IComponentWithActivation
{
private static final String GENERIC_EXPERIMENT_VIEWER = "generic-experiment-viewer";
......@@ -85,6 +86,8 @@ public class GenericExperimentViewer extends AbstractViewerWithVerticalSplit<Exp
private List<DisposableTabContent> rightPanelSectionsOrNull;
private SectionsPanel rightPanel;
public static DatabaseModificationAwareComponent create(
final IViewContext<IGenericClientServiceAsync> viewContext,
final BasicEntityType experimentType, final IIdAndCodeHolder identifiable)
......@@ -200,7 +203,7 @@ public class GenericExperimentViewer extends AbstractViewerWithVerticalSplit<Exp
{
remove(loadingLabel);
GenericExperimentViewer.this.rightPanelSectionsOrNull = createRightPanel();
SectionsPanel rightPanel = layoutSections(rightPanelSectionsOrNull);
rightPanel = layoutSections(rightPanelSectionsOrNull);
attachManagedPropertiesSections(rightPanel, experiment);
attachModuleSpecificSections(rightPanel, experiment);
attachWebAppsSections(rightPanel, experiment,
......@@ -372,4 +375,13 @@ public class GenericExperimentViewer extends AbstractViewerWithVerticalSplit<Exp
return localViewContext.getMessage(Dict.BUTTON_DELETE_EXPERIMENT);
}
@Override
public void activate()
{
if (rightPanel != null)
{
rightPanel.tryApplyDisplaySettings();
}
}
}
......@@ -42,6 +42,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.
import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.CompositeDatabaseModificationObserverWithMainObserver;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.DatabaseModificationAwareComponent;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.DisplayTypeIDGenerator;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.IComponentWithActivation;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.IDatabaseModificationObserver;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.AbstractViewerWithVerticalSplit;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.PropertyValueRenderers;
......@@ -80,7 +81,7 @@ import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.Pro
* @author Christian Ribeaud
*/
abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSplit<Sample> implements
IDatabaseModificationObserver
IDatabaseModificationObserver, IComponentWithActivation
{
private static final String GENERIC_SAMPLE_VIEWER = "generic-sample-viewer";
......@@ -105,6 +106,8 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
private PropertyGrid propertyGrid;
private SectionsPanel rightPanel;
public static DatabaseModificationAwareComponent create(
final IViewContext<IGenericClientServiceAsync> creationViewContext,
final IIdAndCodeHolder identifiable)
......@@ -165,7 +168,7 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
{
@Override
@SuppressWarnings(
{ "unchecked", "rawtypes" })
{ "unchecked", "rawtypes" })
public void execute()
{
final AsyncCallback<Void> callback =
......@@ -203,7 +206,7 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
return ID_PREFIX + sampleId;
}
private final Component createRightPanel(SampleParentWithDerived sampleGeneration)
private final SectionsPanel createRightPanel(SampleParentWithDerived sampleGeneration)
{
final Sample generator = sampleGeneration.getParent();
......@@ -248,8 +251,7 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
}
/**
* To be subclassed. Creates additional panels of the viewer in the right side section besides
* components, datasets and attachments
* To be subclassed. Creates additional panels of the viewer in the right side section besides components, datasets and attachments
*/
protected List<TabContent> createAdditionalSectionPanels()
{
......@@ -403,7 +405,7 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
// Helper classes
//
private static final class SampleGenerationInfoCallback extends
private final class SampleGenerationInfoCallback extends
AbstractAsyncCallback<SampleParentWithDerived>
{
private final GenericSampleViewer genericSampleViewer;
......@@ -435,7 +437,7 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
genericSampleViewer.add(leftPanel, genericSampleViewer.createLeftBorderLayoutData());
genericSampleViewer.configureLeftPanel(leftPanel);
// Right panel
final Component rightPanel = genericSampleViewer.createRightPanel(result);
rightPanel = genericSampleViewer.createRightPanel(result);
genericSampleViewer.add(rightPanel, createRightBorderLayoutData());
genericSampleViewer.layout();
......@@ -491,19 +493,19 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
public DatabaseModificationKind[] getRelevantModifications()
{
return new DatabaseModificationKind[]
{
DatabaseModificationKind.createOrDelete(ObjectKind.SAMPLE),
DatabaseModificationKind.createOrDelete(ObjectKind.SAMPLE_TYPE),
DatabaseModificationKind.edit(ObjectKind.SAMPLE),
DatabaseModificationKind.edit(ObjectKind.SAMPLE_TYPE),
DatabaseModificationKind.createOrDelete(ObjectKind.EXPERIMENT),
DatabaseModificationKind.edit(ObjectKind.EXPERIMENT),
DatabaseModificationKind
.createOrDelete(ObjectKind.PROPERTY_TYPE_ASSIGNMENT),
DatabaseModificationKind.edit(ObjectKind.PROPERTY_TYPE_ASSIGNMENT),
DatabaseModificationKind.edit(ObjectKind.VOCABULARY_TERM),
DatabaseModificationKind.createOrDelete(ObjectKind.METAPROJECT),
DatabaseModificationKind.edit(ObjectKind.METAPROJECT) };
{
DatabaseModificationKind.createOrDelete(ObjectKind.SAMPLE),
DatabaseModificationKind.createOrDelete(ObjectKind.SAMPLE_TYPE),
DatabaseModificationKind.edit(ObjectKind.SAMPLE),
DatabaseModificationKind.edit(ObjectKind.SAMPLE_TYPE),
DatabaseModificationKind.createOrDelete(ObjectKind.EXPERIMENT),
DatabaseModificationKind.edit(ObjectKind.EXPERIMENT),
DatabaseModificationKind
.createOrDelete(ObjectKind.PROPERTY_TYPE_ASSIGNMENT),
DatabaseModificationKind.edit(ObjectKind.PROPERTY_TYPE_ASSIGNMENT),
DatabaseModificationKind.edit(ObjectKind.VOCABULARY_TERM),
DatabaseModificationKind.createOrDelete(ObjectKind.METAPROJECT),
DatabaseModificationKind.edit(ObjectKind.METAPROJECT) };
}
@Override
......@@ -551,4 +553,13 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
{
return viewContext.getMessage(Dict.BUTTON_DELETE_SAMPLE);
}
@Override
public void activate()
{
if (rightPanel != null)
{
rightPanel.tryApplyDisplaySettings();
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment