-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Data Browser: Properties tab context menu entry to show/hide all
- Loading branch information
kasemir
committed
Aug 23, 2024
1 parent
1acf2c1
commit 96663d8
Showing
6 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
...owser/src/main/java/org/csstudio/trends/databrowser3/ui/properties/ShowHideAllAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.