Search in sources :

Example 6 with EnableCheck

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;
}
Also used : EnableCheck(com.revolsys.swing.action.enablecheck.EnableCheck)

Example 7 with EnableCheck

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;
}
Also used : EnableCheck(com.revolsys.swing.action.enablecheck.EnableCheck)

Example 8 with EnableCheck

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);
}
Also used : ObjectPropertyEnableCheck(com.revolsys.swing.action.enablecheck.ObjectPropertyEnableCheck) EnableCheck(com.revolsys.swing.action.enablecheck.EnableCheck) ObjectPropertyEnableCheck(com.revolsys.swing.action.enablecheck.ObjectPropertyEnableCheck)

Example 9 with EnableCheck

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");
}
Also used : PathTreeNode(com.revolsys.swing.tree.node.file.PathTreeNode) EnableCheck(com.revolsys.swing.action.enablecheck.EnableCheck)

Example 10 with EnableCheck

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");
}
Also used : PathTreeNode(com.revolsys.swing.tree.node.file.PathTreeNode) EnableCheck(com.revolsys.swing.action.enablecheck.EnableCheck) URL(java.net.URL)

Aggregations

EnableCheck (com.revolsys.swing.action.enablecheck.EnableCheck)14 RecordDefinition (com.revolsys.record.schema.RecordDefinition)3 RunnableAction (com.revolsys.swing.action.RunnableAction)3 ObjectPropertyEnableCheck (com.revolsys.swing.action.enablecheck.ObjectPropertyEnableCheck)3 MapPanel (com.revolsys.swing.map.MapPanel)3 MenuFactory (com.revolsys.swing.menu.MenuFactory)3 PathTreeNode (com.revolsys.swing.tree.node.file.PathTreeNode)3 DataType (com.revolsys.datatype.DataType)2 LayerRecord (com.revolsys.swing.map.layer.record.LayerRecord)2 RecordLayerTableModel (com.revolsys.swing.map.layer.record.table.model.RecordLayerTableModel)2 ToolBar (com.revolsys.swing.toolbar.ToolBar)2 Icon (javax.swing.Icon)2 LinkedHashMapEx (com.revolsys.collection.map.LinkedHashMapEx)1 MapEx (com.revolsys.collection.map.MapEx)1 Maps (com.revolsys.collection.map.Maps)1 MapSerializer (com.revolsys.io.map.MapSerializer)1 Condition (com.revolsys.record.query.Condition)1 FieldDefinition (com.revolsys.record.schema.FieldDefinition)1 Icons (com.revolsys.swing.Icons)1 ConsumerAction (com.revolsys.swing.action.ConsumerAction)1