05_developer_tutorials:02_extending_groimp:create-windows
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| 05_developer_tutorials:02_extending_groimp:create-windows [2025/01/31 14:05] – removed - external edit (Unknown date) 127.0.0.1 | 05_developer_tutorials:02_extending_groimp:create-windows [2025/11/21 16:50] (current) – gaetan | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ===== Create windows ===== | ||
| + | There are many level of windows that can be created in GroIMP, depending on the needs. | ||
| + | |||
| + | ==== Basic windows ==== | ||
| + | |||
| + | The most common way of creating a new window is by invoking the " | ||
| + | |||
| + | A simple example to create a windows in your plugin is: | ||
| + | |||
| + | <code java> | ||
| + | public class CreateWindow { | ||
| + | |||
| + | public static Panel startPanel(Context ctx, Map params) { | ||
| + | GraphManager graph = ctx.getWorkbench().getRegistry().getProjectGraph(); | ||
| + | UIToolkit ui = UIToolkit.get(ctx); | ||
| + | Panel p = ui.createPanel(ctx, | ||
| + | // Do anything on to fill the panel here | ||
| + | // ... | ||
| + | return p; | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | You can then register your new panel (which start a window) in the GroIMP panel menu entries with adding in your '' | ||
| + | |||
| + | <code xml> | ||
| + | <ref name=" | ||
| + | <ref name=" | ||
| + | <panel name=" | ||
| + | <exists name=" | ||
| + | <object expr=" | ||
| + | <var name=" | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Finally, you can customize the panel name and icon displayed in GroIMP by attributing some values in the '' | ||
| + | |||
| + | In this example the panel is added to the menu entries in the _Panel_ section. Indeed, after starting GroIMP add all element of _/ | ||
| + | |||
| + | If you want your window to be openable from another menu than _panels_, you need to register it as a '' | ||
| + | |||
| + | Example: | ||
| + | |||
| + | <code java> | ||
| + | public class CreateWindow { | ||
| + | |||
| + | public static void startPanelFromCommand(Item item, Object information, | ||
| + | GraphManager graph = context.getWorkbench().getRegistry().getProjectGraph(); | ||
| + | UIToolkit ui = UIToolkit.get(context); | ||
| + | Panel p = ui.createPanel(context, | ||
| + | // Do anything on to fill the panel here | ||
| + | // ... | ||
| + | p.show(true, | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | The window can then be added to the menu (YOUR_MENU_NAME> | ||
| + | |||
| + | <code xml> | ||
| + | < | ||
| + | < | ||
| + | <panel name=" | ||
| + | <command name=" | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | === Dialog Window === | ||
| + | |||
| + | The methods '' | ||
| + | It can be open from a registry '' | ||
| + | |||
| + | Example: | ||
| + | |||
| + | <code java> | ||
| + | public static void startInputDialogWindow(Item item, Object information, | ||
| + | I18NBundle thisI18NBundle = context.getWorkbench().getRegistry().getPluginDescriptor(" | ||
| + | Workbench.current().getWindow().showInputDialog( | ||
| + | thisI18NBundle.getString (" | ||
| + | thisI18NBundle.getString (" | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | === File explorer === | ||
| + | |||
| + | The method '' | ||
