Skip to content
Snippets Groups Projects
Commit 45af907e authored by buczekp's avatar buczekp
Browse files

[LMS-1504] hide edit buttons

SVN: 15740
parent 262607d4
No related branches found
No related tags found
No related merge requests found
Showing
with 55 additions and 88 deletions
......@@ -78,6 +78,10 @@ public final class ProjectViewer extends AbstractViewer<IEntityInformationHolder
private void extendToolBar()
{
if (viewContext.isSimpleMode())
{
return;
}
addToolBarButton(createDeleteButton(new IDelegatedAction()
{
public void execute()
......
......@@ -65,8 +65,6 @@ public abstract class AbstractViewer<D extends IEntityInformationHolder> extends
private final IViewContext<?> viewContext;
protected Button editButton;
private LabelToolItem titleLabel;
private D originalData;
......@@ -89,8 +87,10 @@ public abstract class AbstractViewer<D extends IEntityInformationHolder> extends
titleLabel = new LabelToolItem(title);
toolBar.add(titleLabel);
toolBar.add(new FillToolItem());
editButton = createEditButton();
addToolBarButton(editButton);
if (viewContext.isSimpleMode() == false)
{
addToolBarButton(createEditButton());
}
}
}
......
......@@ -182,30 +182,34 @@ public class AttachmentBrowser extends AbstractSimpleBrowserGrid<AttachmentVersi
createSelectedItemButton(showAllVersionsTitle, asShowEntityInvoker(false));
addButton(showAllVersionsButton);
addButton(createSelectedItemButton(viewContext.getMessage(Dict.BUTTON_EDIT),
new ISelectedEntityInvoker<BaseEntityModel<AttachmentVersions>>()
{
public void invoke(BaseEntityModel<AttachmentVersions> selectedItem,
boolean keyPressed)
if (viewContext.isSimpleMode() == false)
{
addButton(createSelectedItemButton(viewContext.getMessage(Dict.BUTTON_EDIT),
new ISelectedEntityInvoker<BaseEntityModel<AttachmentVersions>>()
{
AttachmentVersions versions = selectedItem.getBaseObject();
createEditAttachmentDialog(versions).show();
}
}));
addButton(createSelectedItemsButton(viewContext.getMessage(Dict.BUTTON_DELETE),
new AbstractCreateDialogListener()
{
@Override
protected Dialog createDialog(List<AttachmentVersions> attachmentVersions,
IBrowserGridActionInvoker invoker)
public void invoke(BaseEntityModel<AttachmentVersions> selectedItem,
boolean keyPressed)
{
AttachmentVersions versions = selectedItem.getBaseObject();
createEditAttachmentDialog(versions).show();
}
}));
addButton(createSelectedItemsButton(viewContext.getMessage(Dict.BUTTON_DELETE),
new AbstractCreateDialogListener()
{
return new AttachmentListDeletionConfirmationDialog(viewContext,
attachmentVersions, createDeletionCallback(invoker),
attachmentHolder);
}
}));
@Override
protected Dialog createDialog(
List<AttachmentVersions> attachmentVersions,
IBrowserGridActionInvoker invoker)
{
return new AttachmentListDeletionConfirmationDialog(viewContext,
attachmentVersions, createDeletionCallback(invoker),
attachmentHolder);
}
}));
}
allowMultipleSelection(); // we allow deletion of multiple attachments
addEntityOperationsSeparator();
......
......@@ -160,6 +160,11 @@ public class ExperimentBrowserGrid extends
private void extendBottomToolbar()
{
if (viewContext.isSimpleMode())
{
return;
}
addEntityOperationsLabel();
final Button addButton =
......
......@@ -160,7 +160,7 @@ public class MaterialBrowserGrid extends
private void extendBottomToolbar(boolean detailsAvailable)
{
if (detailsAvailable)
if (detailsAvailable && viewContext.isSimpleMode() == false)
{
addEntityOperationsLabel();
addEntityOperationButtons();
......
......@@ -352,6 +352,10 @@ public class SampleBrowserGrid extends
// adds show, show-details and invalidate buttons
protected void extendBottomToolbar()
{
if (viewContext.isSimpleMode())
{
return;
}
addEntityOperationsLabel();
addEntityOperationButtons();
addEntityOperationsSeparator();
......
......@@ -35,12 +35,6 @@ public class DataSetUtils
private static final String MODE = "mode";
public static void showDataSet(ExternalData dataSet, GenericViewModel model)
{
String url = createDataViewUrl(dataSet, model, null, false);
WindowUtils.openWindow(url);
}
public static String createDataViewUrl(ExternalData dataSet, GenericViewModel model,
String modeOrNull, boolean autoResolve)
{
......
......@@ -22,8 +22,6 @@ import java.util.List;
import java.util.Set;
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.Component;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.MessageBox;
......@@ -45,8 +43,6 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.menu.IActi
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.AbstractViewer;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.data.DataSetListDeletionConfirmationDialog;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.SectionsPanel;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.DataSetUtils;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.GWTUtils;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedAction;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMessageProvider;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.DisplayedOrSelectedDatasetCriteria;
......@@ -73,8 +69,6 @@ abstract public class GenericDataSetViewer extends AbstractViewer<ExternalData>
public static final String VIEW_BUTTON_ID_SUFFIX = "_view-button";
private final BrowseButtonHolder browseButtonHolder;
private final ProcessButtonHolder processButtonHolder;
protected final TechId datasetId;
......@@ -105,7 +99,6 @@ abstract public class GenericDataSetViewer extends AbstractViewer<ExternalData>
setLayout(new BorderLayout());
this.viewContext = viewContext;
this.datasetId = TechId.create(identifiable);
this.browseButtonHolder = new BrowseButtonHolder();
this.processButtonHolder = new ProcessButtonHolder();
extendToolBar();
}
......@@ -124,8 +117,10 @@ abstract public class GenericDataSetViewer extends AbstractViewer<ExternalData>
private void extendToolBar()
{
addToolBarButton(browseButtonHolder.getButton());
if (viewContext.isSimpleMode())
{
return;
}
addToolBarButton(createDeleteButton(new IDelegatedAction()
{
public void execute()
......@@ -149,11 +144,6 @@ abstract public class GenericDataSetViewer extends AbstractViewer<ExternalData>
return ID_PREFIX + datasetId;
}
private final String createChildId(String childIdSuffix)
{
return getId() + childIdSuffix;
}
/**
* Load the dataset information.
*/
......@@ -274,7 +264,6 @@ abstract public class GenericDataSetViewer extends AbstractViewer<ExternalData>
protected void updateOriginalData(final ExternalData result)
{
super.updateOriginalData(result);
browseButtonHolder.setupData(result);
processButtonHolder.setupData(result);
}
......@@ -294,47 +283,6 @@ abstract public class GenericDataSetViewer extends AbstractViewer<ExternalData>
reloadAllData(); // reloads everything
}
/**
* Holder of a {@link Button} that goes to external data browsing on selection. The button is
* disabled until data is successfully loaded by the viewer.
*/
private class BrowseButtonHolder
{
private final Button button;
public BrowseButtonHolder()
{
this.button = createBrowseButton();
}
private Button createBrowseButton()
{
Button result = new Button(viewContext.getMessage(Dict.BUTTON_VIEW));
GWTUtils.setToolTip(result, viewContext.getMessage(Dict.TOOLTIP_VIEW_DATASET));
result.setId(createChildId(VIEW_BUTTON_ID_SUFFIX));
result.disable();
return result;
}
public Button getButton()
{
return this.button;
}
/** @param data external data that will be browsed after selection */
public void setupData(final ExternalData data)
{
button.addSelectionListener(new SelectionListener<ButtonEvent>()
{
@Override
public void componentSelected(ButtonEvent ce)
{
DataSetUtils.showDataSet(data, viewContext.getModel());
}
});
}
}
/**
* Holder of a {@link Button} that has a menu with items that schedule dataset plugin
* processing. The button is hidden at the beginning. When data set is successfully loaded by
......
......@@ -103,6 +103,10 @@ public class GenericExperimentViewer extends AbstractViewer<Experiment> implemen
private void extendToolBar()
{
if (viewContext.isSimpleMode())
{
return;
}
addToolBarButton(createDeleteButton(new IDelegatedAction()
{
public void execute()
......
......@@ -146,6 +146,10 @@ abstract public class GenericSampleViewer extends AbstractViewer<Sample> impleme
private void extendToolBar()
{
if (viewContext.isSimpleMode())
{
return;
}
addToolBarButton(createDeleteButton(new IDelegatedAction()
{
public void execute()
......
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