Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data Browser: Properties tab context menu entry to show/hide all items #3119

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ public class Messages
FormulaTabTT,
Grid,
GridLbl,
HideAll,
HideTraceWarning,
HideTraceWarningDetail,
ImportActionLabelFmt,
Expand Down Expand Up @@ -269,6 +270,7 @@ public class Messages
SelectTrace,
SeverityColumn,
SeverityStatusFmt,
ShowAll,
StartEndDialogBtn,
StartEndDialogTT,
StartTimeLbl,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*******************************************************************************
* Copyright (c) 2024 Oak Ridge National Laboratory.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
******************************************************************************/
package org.csstudio.trends.databrowser3.ui.properties;

import org.csstudio.trends.databrowser3.Activator;
import org.csstudio.trends.databrowser3.Messages;
import org.csstudio.trends.databrowser3.model.AxisConfig;
import org.csstudio.trends.databrowser3.model.Model;
import org.csstudio.trends.databrowser3.model.ModelItem;
import org.phoebus.ui.undo.UndoableAction;
import org.phoebus.ui.undo.UndoableActionManager;

import javafx.scene.control.MenuItem;

/** MenuItem to show or hide all items
* @author Kay Kasemir
*/
@SuppressWarnings("nls")
public class ShowHideAllAction extends MenuItem
{
private class ShowHideAll extends UndoableAction
{
final private Model model;
final private boolean show;

ShowHideAll(final UndoableActionManager operations_manager,
final Model model, final boolean show)
{
super(show ? Messages.ShowAll : Messages.HideAll);
this.model = model;
this.show = show;
operations_manager.execute(this);
}

@Override
public void run()
{
for (ModelItem item : model.getItems())
item.setVisible(show);
for (AxisConfig axis : model.getAxes())
axis.setVisible(model.hasAxisActiveItems(axis));
}

@Override
public void undo()
{
for (ModelItem item : model.getItems())
item.setVisible(!show);
for (AxisConfig axis : model.getAxes())
axis.setVisible(model.hasAxisActiveItems(axis));
}
}

/** @param model Model
* @param undo Undo manager
* @param show Show all, or hide all?
*/
public ShowHideAllAction(final Model model, final UndoableActionManager undo, final boolean show)
{
super(show ? Messages.ShowAll : Messages.HideAll,
Activator.getIcon(show ? "checkbox" : "checkbox_unchecked"));
setOnAction(event -> new ShowHideAll(undo, model, show));
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018-2020 Oak Ridge National Laboratory.
* Copyright (c) 2018-2024 Oak Ridge National Laboratory.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -733,6 +733,12 @@ private void createContextMenu()
items.add(new EditMultipleItemsAction(trace_table, model, undo, selection));

items.add(new SeparatorMenuItem());


items.add(new ShowHideAllAction(model, undo, true));
items.add(new ShowHideAllAction(model, undo, false));

items.add(new SeparatorMenuItem());

// Add PV-based entries
final List<ProcessVariable> pvs = selection.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ FormulaTabVariable=Variable
FormulaTabTT=Double-click input to add to formula, or edit variable name
Grid=Grid
GridLbl=Grid:
HideAll=Hide All
HideTraceWarning=Hide Trace?
HideTraceWarningDetail=Hiding a trace can be useful to...\na) temporarily reduce the number of traces on the plot\nb) hide formula input PVs where you are interested in the formula,\n but not the individual inputs\n\nNote however that the Databrowser will still sample data for the hidden trace and request archived data for it so that it's 'ready' when you want to show it again.\n\nIf you don't need this item at all, you should delete it instead of hiding it.\n\nHide trace?
ImportActionLabelFmt=Import {0}
Expand Down Expand Up @@ -249,6 +250,7 @@ SearchTT=Start the channel name search
SelectTrace=Select trace to see data sources
SeverityColumn=Severity
SeverityStatusFmt={0} / {1}
ShowAll=Show All
StartEndDialogBtn=...
StartEndDialogTT=Open start/end time dialog box
StartTimeLbl=Start Time:
Expand Down
Binary file added core/ui/src/main/resources/icons/checkbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading