Dependent JMenuItem at addMenuBarCustomizer
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 165
- Joined: Fri Feb 28, 2020 4:02 pm
Dependent JMenuItem at addMenuBarCustomizer
Post by vishwavaranasi »
Hello Team , here am attaching the sample plugin project with my requirements.
1 . First time MenuItem1Action enabled and MenuItem2Action is disabled.
2. user click on MenuItem1Action - This will open a Jframe with a Jtable and Menu2tem1Action enabled.
3. Now users can access Menu2tem1Action - this will open a jframe with 2 text fields.
4. here the requirement is , in the step3 of Jframe I want to access if any table row selected from the Jframe opened in step 2.
Would you please help me here how to achieve the same here.
1 . First time MenuItem1Action enabled and MenuItem2Action is disabled.
2. user click on MenuItem1Action - This will open a Jframe with a Jtable and Menu2tem1Action enabled.
3. Now users can access Menu2tem1Action - this will open a jframe with 2 text fields.
4. here the requirement is , in the step3 of Jframe I want to access if any table row selected from the Jframe opened in step 2.
Would you please help me here how to achieve the same here.
- sample-plugin-workspace-access.zip
- (154.49 KiB) Downloaded 67 times
Thanks,
vishwa
vishwa
Re: Dependent JMenuItem at addMenuBarCustomizer
Hi,
You do not seem to have much experience writing Java code, unfortunately I do not have time to review your entire Java code, my purpose here is just to help you with advice using our Oxygen specific APIs, not to help you with building custom Swing components.
Just a couple of observations, code like this:
The TableExample is also a JFrame, you could just configure and show it directly. Because right now the method "com.oxygenxml.sdksamples.workspace.TableExample.getGUI()" returns the JFrame and then you place the JFrame in another JFrame.
This code:
instructs the operating system to force close the entire Java application when the end user closes the frame. So once the end user closes this custom frame of yours the entire Oxygen application will be force closed.
Are you sure you want to use JFrame and not some modal dialogs (JDialog) which block the application until the end user chooses content in them?
I would suggest also removing this code:
Your code runs in Oxygen, it is not a standalone Swing application. Oxygen sets up its own color theme, look and feel.
Coming back to your original request:
Regards,
Radu
You do not seem to have much experience writing Java code, unfortunately I do not have time to review your entire Java code, my purpose here is just to help you with advice using our Oxygen specific APIs, not to help you with building custom Swing components.
Just a couple of observations, code like this:
Code: Select all
JFrame f = new JFrame("Test123");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
TableExample tableData = new TableExample();
f.setContentPane(tableData.getGUI());
This code:
Code: Select all
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Are you sure you want to use JFrame and not some modal dialogs (JDialog) which block the application until the end user chooses content in them?
I would suggest also removing this code:
Code: Select all
try {
// Significantly improves the look of the output in
// terms of the file names returned by FileSystemView!
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch(Exception weTried) {
}
Coming back to your original request:
A way to do this would be to keep the "tableData" as a field, once it's a field you can access it also from the other "MenuItem2Action".here the requirement is , in the step3 of Jframe I want to access if any table row selected from the Jframe opened in step 2.
Code: Select all
private TableExample tableData;
@SuppressWarnings("serial")
private AbstractAction createMenuItem1Action(StandalonePluginWorkspace pluginWorkspaceAccess) {
return new AbstractAction("MenuItem1Action") {
@Override
public void actionPerformed(ActionEvent e) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
// Significantly improves the look of the output in
// terms of the file names returned by FileSystemView!
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch(Exception weTried) {
}
JFrame f = new JFrame("Test123");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
tableData = new TableExample();
f.setContentPane(tableData.getGUI());
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service