bibliothek.gui.Dockable Java Examples

The following examples show how to use bibliothek.gui.Dockable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TopicPanelMenuAction.java    From wandora with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void action(Dockable dockable) {
    System.out.println("ACTION Open topic panel options TRIGGERED");
    try {
        if(topicPanel != null) {
            JPopupMenu popupMenu = topicPanel.getViewPopupMenu();
            Point p = new Point(dockable.getComponent().getWidth(), 0);
            if(dockable instanceof WandoraDockable) {
                System.out.println("Dockable is WandoraDockable");
                MouseEvent me = ((WandoraDockable) dockable).getLastMouseEvent();
                System.out.println("Dockable's last mousevent is "+me);
                if(me != null) {
                    p = me.getPoint();
                }
            }
            popupMenu.show(dockable.getComponent(), p.x, p.y );
        }
    }
    catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
Example #2
Source File: CStack.java    From openAGV with Apache License 2.0 6 votes vote down vote up
@Override
public boolean setLocation(Dockable dockable, DockableProperty location, AffectedSet set) {
  set.add(dockable);

  if (isChild(dockable)) {
    getStation().move(dockable, location);
  }
  else {
    boolean acceptable = DockUtilities.acceptable(getStation(), dockable);
    if (!acceptable) {
      return false;
    }

    if (!getStation().drop(dockable, location)) {
      getStation().drop(dockable);
    }
  }

  return true;
}
 
Example #3
Source File: DockingFramePanel.java    From wandora with GNU General Public License v3.0 6 votes vote down vote up
private Object[] getCloseMenuStruct() {
    ArrayList struct = new ArrayList();
    if(dockedTopicPanels != null && !dockedTopicPanels.isEmpty()) {
        for(Dockable dockable : dockedTopicPanels.keySet()) {
            TopicPanel tp = dockedTopicPanels.get(dockable);
            if(tp != null) {
                String label = "Close "+tp.getName();
                label = label + getAdditionalLabel(tp);
                struct.add(label);
                struct.add( tp.getIcon() );
                struct.add( new DeleteDockable(dockable) );
            }
        }
    }
    else {
        struct.add("[Nothing to close]");
    }
    return struct.toArray( new Object[] {} );
}
 
Example #4
Source File: DockingFrame.java    From Rails with GNU General Public License v2.0 6 votes vote down vote up
private void checkAndReplace( Dockable dockable ){
    DockStation station = dockable.getDockParent();
    if( !(station instanceof ScreenDockStation) ) {
        // cancel
        return;
    }

    // .. then we just insert a SplitDockStation
    SplitDockStation split = new SplitDockStation();
    DockController controller = station.getController();

    try {
        // disable events while rearranging our layout
        controller.freezeLayout();

        station.replace( dockable, split );
        split.drop( dockable );
    }
    finally {
        // and enable events after we finished
        controller.meltLayout();
    }

    //ensure the correct availability of the maximize button
    adjustExternalizedActions(dockable);
}
 
Example #5
Source File: DockingFramePanel.java    From wandora with GNU General Public License v3.0 6 votes vote down vote up
private Object[] getSelectMenuStruct() {
    ArrayList struct = new ArrayList();
    if(dockedTopicPanels != null && !dockedTopicPanels.isEmpty()) {
        for(Dockable dockable : dockedTopicPanels.keySet()) {
            TopicPanel tp = dockedTopicPanels.get(dockable);
            if(tp != null) {
                String label = "Select "+tp.getName();
                label = label + getAdditionalLabel(tp);
                struct.add(label);
                struct.add( tp.getIcon() );
                struct.add( new SelectDockable(dockable) );
            }
        }
    }
    else {
        struct.add("[Nothing to select]");
    }
    return struct.toArray( new Object[] {} );
}
 
Example #6
Source File: DockingFramePanel.java    From wandora with GNU General Public License v3.0 6 votes vote down vote up
public void maximizeDockable(Dockable dockable) {
    if(dockable != null) {
        if(dockable.equals(station.getFullScreen())) {
            station.setFullScreen(null);
            try {
                if(currentDockable != null) {
                    TopicPanel tp = dockedTopicPanels.get(dockable);
                    if(tp != null) {
                        tp.refresh();
                    }
                }
            }
            catch(Exception e) {}
        }
        else {
            station.setFullScreen(dockable);
        }
    }
}
 
Example #7
Source File: DockingFramePanel.java    From wandora with GNU General Public License v3.0 6 votes vote down vote up
private Object[] getOptionsMenuStruct() {
    ArrayList struct = new ArrayList();
    if(dockedTopicPanels != null && !dockedTopicPanels.isEmpty()) {
        for(Dockable dockable : dockedTopicPanels.keySet()) {
            TopicPanel tp = dockedTopicPanels.get(dockable);
            if(tp != null) {
                String label = "Configure "+tp.getName();
                label = label + getAdditionalLabel(tp);
                SimpleMenu confMenu = new SimpleMenu(label);
                confMenu.setIcon(tp.getIcon());
                UIBox.attachMenu(confMenu, tp.getViewMenuStruct(), wandora);
                struct.add( confMenu );
            }
        }
    }
    else {
        struct.add("[Nothing to configure]");
    }
    return struct.toArray( new Object[] {} );
}
 
Example #8
Source File: DockingFramePanel.java    From wandora with GNU General Public License v3.0 5 votes vote down vote up
public void deleteDockable(Dockable dockable) {
    TopicPanel tp = dockedTopicPanels.get(dockable);
    if(tp != null) {
        tp.stop();
    }
    dockedTopicPanels.remove(dockable);
    station.removeDockable(dockable);
    if(!dockedTopicPanels.isEmpty()) {
        currentDockable = dockedTopicPanels.keySet().iterator().next();
    }
    else {
        currentDockable = null;
    }
    wandora.topicPanelsChanged();
}
 
Example #9
Source File: DockingFramePanel.java    From wandora with GNU General Public License v3.0 5 votes vote down vote up
public Dockable getDockableFor(TopicPanel topicPanel) {
    if(topicPanel != null) {
        for(Dockable dockable : dockedTopicPanels.keySet()) {
            TopicPanel dockedTopicPanel = dockedTopicPanels.get(dockable);
            if(dockedTopicPanel.equals(topicPanel)) {
                return dockable;
            }
        }
    }
    return null;
}
 
Example #10
Source File: DockingFramePanel.java    From wandora with GNU General Public License v3.0 5 votes vote down vote up
public void updateDockableTitle(TopicPanel topicPanel) {
    if(topicPanel != null) {
        Dockable dockable = getDockableFor(topicPanel);
        if(dockable != null) {
            if(dockable instanceof AbstractDockable) {
                AbstractDockable abstractDockable = (AbstractDockable) dockable;
                abstractDockable.setTitleText(topicPanel.getTitle());
            }
        }
    }
}
 
Example #11
Source File: MaximizeDockableAction.java    From wandora with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void action(Dockable dockable) {
    System.out.println("ACTION MaximizeDockableAction TRIGGERED");
    try {
        dockingFramePanel.maximizeDockable(dockable);
    }
    catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
Example #12
Source File: DockingFramePanel.java    From wandora with GNU General Public License v3.0 5 votes vote down vote up
public void openTo(Topic topic, TopicPanel topicPanel) throws TopicMapException, OpenTopicNotSupportedException {
    for(Dockable dockable : dockedTopicPanels.keySet()) {
        TopicPanel dockedTopicPanel = dockedTopicPanels.get(dockable);
        if(dockedTopicPanel.equals(topicPanel)) {
            currentDockable = dockable;
            open(topic);
        }
    }
}
 
Example #13
Source File: DockingFramePanel.java    From wandora with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void refresh() throws TopicMapException {
    if(dockedTopicPanels != null && !dockedTopicPanels.isEmpty()) {
        for(Dockable dockable : dockedTopicPanels.keySet()) {
            TopicPanel topicPanel = dockedTopicPanels.get(dockable);
            if(topicPanel != null) {
                //System.out.println("refresh topic panel at docking frame panel");
                topicPanel.refresh();
                updateDockableTitle(topicPanel);
            }
        }
    }
    revalidate();
    repaint();
}
 
Example #14
Source File: WandoraToolWrapperAction.java    From wandora with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void action(Dockable dockable) {
    System.out.println("ACTION TRIGGERED");
    try {
        if(tool != null) {
            tool.execute(Wandora.getWandora(), (ActionEvent) null);
        }
    }
    catch (TopicMapException ex) {
        ex.printStackTrace();
    }
}
 
Example #15
Source File: CloseDockableAction.java    From wandora with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void action(Dockable dockable) {
    System.out.println("ACTION CloseDockableAction TRIGGERED");
    try {
        dockingFramePanel.deleteDockable(dockable);
    }
    catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
Example #16
Source File: DockingFramePanel.java    From wandora with GNU General Public License v3.0 5 votes vote down vote up
public void deleteAllDockables() {
    if(dockedTopicPanels != null && !dockedTopicPanels.isEmpty()) {
        for(Dockable dockable : dockedTopicPanels.keySet()) {
            TopicPanel tp = dockedTopicPanels.get(dockable);
            if(tp != null) {
                tp.stop();
            }
            station.removeDockable(dockable);
        }
        dockedTopicPanels.clear();
        chainedTopicPanels.clear();
        currentDockable = null;
        wandora.topicPanelsChanged();
    }
}
 
Example #17
Source File: DockingFrame.java    From Rails with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void dockableAdded( DockStation station, final Dockable dockable ){
    // ... and the new child is not a SplitDockStation ...
    if( !(dockable instanceof SplitDockStation) ) {
        SwingUtilities.invokeLater( new Runnable(){
            @Override
            public void run(){
                checkAndReplace( dockable );
            }
        } );
    }
}
 
Example #18
Source File: FrmCustom.java    From MeteoInfo with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void init(Dockable dockable){
    if (dockable != null){
        String text = dockable.getTitleText();
        switch(text){
            case "Figures":
                this.init_Figure();
                break;
            case "Editor":
                this.init_Editor();
                break;
        }            
    }
}
 
Example #19
Source File: CStack.java    From openAGV with Apache License 2.0 5 votes vote down vote up
@Override
public CLocation getCLocation(Dockable dockable, Location location) {
  DockableProperty property = location.getLocation();
  if (property == null) {
    return getStationLocation();
  }

  return getStationLocation().expandProperty(getStation().getController(), property);
}
 
Example #20
Source File: MaximizeDockableAction.java    From wandora with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String getTooltipText(Dockable dckbl) {
    return "Maximize (and normalize) dockable";
}
 
Example #21
Source File: DockingFramePanel.java    From wandora with GNU General Public License v3.0 4 votes vote down vote up
public void selectDockable(Dockable dockable) {
    control.setFocusedDockable(dockable, true);
}
 
Example #22
Source File: DockingFramePanel.java    From wandora with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void titleBound(Dockable dckbl, DockTitle dt) {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
Example #23
Source File: DockingFramePanel.java    From wandora with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Object[] getViewMenuStruct() {
    JMenu addMenu =  new SimpleMenu("New panel", UIBox.getIcon("gui/icons/topic_panel_add.png"));
    List<List> availableTopicPanels = wandora.topicPanelManager.getAvailableTopicPanels();
    ArrayList addTopicPanelMenuStruct = new ArrayList();
    for(List panelData : availableTopicPanels) {
        try {
            Class panelClass = Class.forName((String) panelData.get(0));
            if(!this.getClass().equals(panelClass)) {
                addTopicPanelMenuStruct.add( (String) panelData.get(1) );
                addTopicPanelMenuStruct.add( (Icon) panelData.get(2) );
                addTopicPanelMenuStruct.add( new AddDockable( panelClass ) );
            }
        }
        catch(Exception e) {}
        
    }

    UIBox.attachMenu(addMenu, addTopicPanelMenuStruct.toArray(new Object[] {} ), wandora);
    
    //JMenu selectMenu =  new SimpleMenu("Select", UIBox.getIcon("gui/icons/topic_panel_select.png"));
    //UIBox.attachMenu(selectMenu, getSelectMenuStruct(), wandora);
    
    //JMenu closeMenu =  new SimpleMenu("Close", UIBox.getIcon("gui/icons/topic_panel_close.png"));
    //UIBox.attachMenu(closeMenu, getCloseMenuStruct(), wandora);

    //JMenu optionsMenu =  new SimpleMenu("Options", UIBox.getIcon("gui/icons/topic_panel_options.png"));
    //UIBox.attachMenu(optionsMenu, getOptionsMenuStruct(), wandora);

    ArrayList struct = new ArrayList();
    
    struct.add(addMenu);
           
    if(dockedTopicPanels != null && !dockedTopicPanels.isEmpty()) {
        struct.add("---");
        for(Dockable dockable : dockedTopicPanels.keySet()) {
            TopicPanel tp = dockedTopicPanels.get(dockable);
            if(tp != null) {
                String label = tp.getName();
                label = label + getAdditionalLabel(tp);
                JMenu topicPanelMenu =  new SimpleMenu(label, tp.getIcon());
                
                ArrayList subStruct = new ArrayList();
                
                Object[] subMenuStruct = tp.getViewMenuStruct();
                if(subMenuStruct != null) {
                    if(subMenuStruct.length > 0) {
                        for( Object subMenuItem : subMenuStruct ) {
                            subStruct.add(subMenuItem);
                        }
                        subStruct.add("---");
                    }
                }
                
                subStruct.add( "Select" );
                subStruct.add( UIBox.getIcon( "gui/icons/select_dockable.png" ) );
                subStruct.add( new SelectDockable(dockable) );
                
                if(dockable.equals(station.getFullScreen())) {
                    subStruct.add( "Demaximize" );
                    subStruct.add( UIBox.getIcon( "gui/icons/demaximize_dockable.png" ) );
                }
                else {
                    subStruct.add( "Maximize" );
                    subStruct.add( UIBox.getIcon( "gui/icons/maximize_dockable.png" ) );
                }
                subStruct.add( new MaximizeDockable(dockable) );

                subStruct.add( "Close" );
                subStruct.add( UIBox.getIcon("gui/icons/close_dockable.png") );
                subStruct.add( new DeleteDockable(dockable) );
                
                UIBox.attachMenu(topicPanelMenu, subStruct.toArray(), wandora);
                
                struct.add( topicPanelMenu );
            }
        }
        struct.add("---");
        struct.add("Close current");
        struct.add(new DeleteCurrentDockable());
        struct.add("Close all");
        struct.add(new DeleteAllDockables());
    }
    
    return struct.toArray();
}
 
Example #24
Source File: DockingFramePanel.java    From wandora with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void titleUnbound(Dockable dckbl, DockTitle dt) {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
Example #25
Source File: DockingFramePanel.java    From wandora with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void titleTextChanged(Dockable dckbl, String string, String string1) {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
Example #26
Source File: DockingFramePanel.java    From wandora with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void titleIconChanged(Dockable dckbl, Icon icon, Icon icon1) {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
Example #27
Source File: DockingFramePanel.java    From wandora with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void titleToolTipChanged(Dockable dckbl, String string, String string1) {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
Example #28
Source File: DockingFramePanel.java    From wandora with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void titleExchanged(Dockable dckbl, DockTitle dt) {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
Example #29
Source File: CloseDockableAction.java    From wandora with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String getText(Dockable dckbl) {
    return "Close dockable";
}
 
Example #30
Source File: CStack.java    From openAGV with Apache License 2.0 4 votes vote down vote up
@Override
public DockableProperty getLocation(Dockable child) {
  return DockUtilities.getPropertyChain(getStation(), child);
}