use of com.revolsys.swing.action.enablecheck.EnableCheck in project com.revolsys.open by revolsys.
the class Menus method newAction.
static <V> MenuSourceAction newAction(final CharSequence name, final Icon icon, final Predicate<V> enabledFilter, final Consumer<V> consumer, final boolean runInBackground) {
final EnableCheck enableCheck = enableCheck(enabledFilter);
final MenuSourceAction action = new MenuSourceAction(name, null, icon, consumer, runInBackground);
action.setEnableCheck(enableCheck);
return action;
}
use of com.revolsys.swing.action.enablecheck.EnableCheck in project com.revolsys.open by revolsys.
the class Menus method addCheckboxMenuItem.
static <V> MenuSourceAction addCheckboxMenuItem(final MenuFactory menu, final String groupName, final CharSequence name, final String iconName, final Predicate<V> enableCheck, final Consumer<V> consumer, final Predicate<V> itemChecked, final boolean runInBackground) {
final MenuSourceAction action = Menus.newAction(name, iconName, enableCheck, consumer, runInBackground);
final EnableCheck itemCheckedEnableCheck = enableCheck(itemChecked);
menu.addCheckboxMenuItem(groupName, action, itemCheckedEnableCheck);
return action;
}
use of com.revolsys.swing.action.enablecheck.EnableCheck in project com.revolsys.open by revolsys.
the class MapPanel method newToolBarUndoButtons.
private void newToolBarUndoButtons() {
final EnableCheck canUndo = new ObjectPropertyEnableCheck(this.undoManager, "canUndo");
final EnableCheck canRedo = new ObjectPropertyEnableCheck(this.undoManager, "canRedo");
this.toolBar.addButton("undo", "Undo", "arrow_undo", canUndo, this.undoManager::undo);
this.toolBar.addButton("undo", "Redo", "arrow_redo", canRedo, this.undoManager::redo);
}
use of com.revolsys.swing.action.enablecheck.EnableCheck in project com.revolsys.open by revolsys.
the class PointCloudLayer method factoryInit.
public static void factoryInit() {
MapObjectFactoryRegistry.newFactory("pointCloudLayer", "Point Cloud Layer", PointCloudLayer::new);
// TODO Need to handle memory and rendering better
// addIoFactoryMenuItem("pointCloud", "Add Point Cloud Layer", "point_cloud",
// PointCloudReadFactory.class);
final EnableCheck enableCheck = RsSwingServiceInitializer.enableCheck(PointCloudReadFactory.class);
TreeNodes.addMenuItem(PathTreeNode.MENU, "point_cloud", "Zoom to Point Cloud", (final PathTreeNode node) -> actionZoomTo(node)).setVisibleCheck(//
enableCheck).setIconName("point_cloud", "magnifier");
}
use of com.revolsys.swing.action.enablecheck.EnableCheck in project com.revolsys.open by revolsys.
the class AbstractLayer method menuItemPathAddLayer.
public static void menuItemPathAddLayer(final String menuGroup, final String menuName, final String iconName, final Class<? extends IoFactory> factoryClass) {
final EnableCheck enableCheck = RsSwingServiceInitializer.enableCheck(factoryClass);
TreeNodes.addMenuItem(PathTreeNode.MENU, menuGroup, menuName, (final PathTreeNode node) -> {
final URL url = node.getUrl();
final Project project = Project.get();
project.openFile(url);
}).setVisibleCheck(//
enableCheck).setIconName(iconName, "add");
}
Aggregations