We're Hiring!

Working with Tabs

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

Re: Working with Tabs

Postby dskanth » Fri Aug 28, 2009 10:19 am

Thanks for your reply jmarie.
Last edited by dskanth on Tue Sep 22, 2009 5:33 am, edited 2 times in total.
dskanth
 
Posts: 43
Joined: Wed Aug 26, 2009 1:12 pm

Re: Working with Tabs

Postby jburel » Fri Aug 28, 2009 10:50 am

>For the Projects panel, i want to include 3 buttons - Create Project, Create Dataset, Delete >Project/Dataset. These buttons are just tiny icons that are to be placed at the toolbar. See the attached screenshot. ;)
>Also, i want to add few additional panels below Projects panel (Omero.jpg)

To Add (resp. Remove) the buttons (cf. your screenshot) to (resp. from),
you will have to modify the method createMenuBar() in the BrowserUI file (package agents.treeviewer.browser).
You need then to create Browser actions, e.g. DeleteAction etc, just copy how it is done for the buttons already implemented. Follow the same approach so that you have control of state change, selection changes etc.

>To add panel to the project panels,
The browsers are added to the view in the method createTabbedPane() in TreeVieweWin
(package agents.treeviewer.view).
we only add the brower
but you can easily achieve what you want there by adding new components


jmarie
User avatar
jburel
Team Member
 
Posts: 348
Joined: Thu May 21, 2009 6:38 pm
Location: dundee

Re: Working with Tabs

Postby dskanth » Fri Aug 28, 2009 12:12 pm

I have created a new JButton in the BrowserUI.java, in createMenuBar method.
But iam a bit confused with how i can create Browser actions.
And then, in TreeViewerWin.java, but i dont understand how to add my button there.
Last edited by dskanth on Tue Sep 22, 2009 5:35 am, edited 1 time in total.
dskanth
 
Posts: 43
Joined: Wed Aug 26, 2009 1:12 pm

Re: Working with Tabs

Postby jburel » Fri Aug 28, 2009 1:11 pm

You will need a bit more work than that!

You should do something like
button = new JButton(controller.getAction(BrowserControl.CREATE_PROJECT));
button.setBorderPainted(false);
menuBar.add(button); //the button is now added. to the toolbar of the browser: left-hand side.

Go to BrowserControl, declare a static field CREATE_PROJECT.
then , initialize the action
Code: Select all
void createActions(){
....
actionsMap.put(CREATE_PROJECT., new BrowserCreateProjectAction(model));
}


Then go to treeviewer.actions and create a BrowserCreateProjectAction()
Code: Select all
public class BrowserCreateProjectAction
   extends BrowserAction
{

    /** Description of the action. */
    private static final String DESCRIPTION = "Create a project";
   
    /**
     * Creates a new instance.
     *
     * @param model Reference to the Model. Mustn't be <code>null</code>.
     */
    public BrowserCreateProjectAction(Browser model)
    {
        super(model);
        setEnabled(true);
        putValue(Action.SHORT_DESCRIPTION,
                UIUtilities.formatToolTipText(DESCRIPTION));
        IconManager im = IconManager.getInstance();
        putValue(Action.SMALL_ICON, im.getIcon(IconManager.CREATE)); //or other icons
    }
   
    /**
     * Displays the list of supported file formats.
     * @see java.awt.event.ActionListener#actionPerformed(ActionEvent)
     */
    public void actionPerformed(ActionEvent e)
    {
        model.createProject() // code you will have to be implement in Browser
    }

}




The comment about TreeVieweWin was only if you want to add components other than the tree view to the tab cf. screenshot you attached
User avatar
jburel
Team Member
 
Posts: 348
Joined: Thu May 21, 2009 6:38 pm
Location: dundee

Re: Working with Tabs

Postby dskanth » Mon Aug 31, 2009 10:45 am

Thanks for your kind help, i was atlast able to create a static button (iam working on the action part). ;)
dskanth
 
Posts: 43
Joined: Wed Aug 26, 2009 1:12 pm

Previous

Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 0 guests