⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 viewporttimeyaxis.java

📁 fortran并行计算包
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    public void eraseSearchedDrawable()    {        searched_dobj = null;    }    private static final double INVALID_TIME   = Double.NEGATIVE_INFINITY;    private              double searched_time  = INVALID_TIME;    /*        searchBackward() is for ActionSearchBackward    */    public boolean searchBackward()    {        SearchPanel  dobj_panel = null;        // searchBackward can only be called from TimelineFrame, JFrame.        if ( search_dialog == null ) {            Window window  = SwingUtilities.windowForComponent( this );            if ( window instanceof Frame )                search_dialog  = new SearchDialog( (Frame) window, this );            else                Dialogs.error( window,                               "ViewportTimeYaxis.searchBackward() "                             + "is meant to be invoked from a top JFrame." );        }                if ( searching_time != searched_time )            dobj_panel  = searchable.searchPreviousComponent( searching_time );        else            dobj_panel  = searchable.searchPreviousComponent();        if ( dobj_panel != null ) {            searched_dobj = dobj_panel.getSearchedDrawable();            searched_time = searched_dobj.getEarliestTime();            // Scroll the Time axis and set Time Focus at the drawable found.            time_model.scroll( searched_time - searching_time );            searching_time = searched_time;            // Scroll the Y-axis as well so searched_dobj becomes visible            tree_view.scrollRowToVisible( searched_dobj.getRowID() );            //  call this.paint( g );            this.repaint();            search_dialog.replace( dobj_panel );            if ( ! search_dialog.isVisible() )                 search_dialog.setVisibleAtDefaultLocation();            return true;        }        else {            if (    searched_dobj != null                 && (    searched_dobj.getEarliestTime()                      == time_model.getTimeGlobalMinimum() ) )                Dialogs.info( SwingUtilities.windowForComponent( this ),                              "The FIRST drawable in the logfile has been "                            + "reached.\n  Search backward has no more "                            + "drawable to return.\n", null );            else                Dialogs.warn( SwingUtilities.windowForComponent( this ),                              "If the logfile's beginning is not within view,\n"                            + "SCROLL BACKWARD till you see more drawables\n"                            + "are within view.  All drawables in view or in \n"                            + "the memory have been searched.\n" );            search_dialog.setVisible( false );            searched_dobj = null;            searched_time = INVALID_TIME;            this.repaint();            return false;        }    }    /*        searchForward() is for ActionSearchForward    */    public boolean searchForward()    {        SearchPanel  dobj_panel = null;        // searchForward can only be called from TimelineFrame, JFrame.        if ( search_dialog == null ) {            Window window  = SwingUtilities.windowForComponent( this );            if ( window instanceof Frame )                search_dialog  = new SearchDialog( (Frame) window, this );            else                Dialogs.error( window,                               "ViewportTimeYaxis.searchForward() "                             + "is meant to be invoked from a top JFrame." );        }        if ( searching_time != searched_time )            dobj_panel  = searchable.searchNextComponent( searching_time );        else            dobj_panel  = searchable.searchNextComponent();        if ( dobj_panel != null ) {            searched_dobj = dobj_panel.getSearchedDrawable();            searched_time = searched_dobj.getEarliestTime();            // Scroll the screen and set Time Focus at the drawable found.            time_model.scroll( searched_time - searching_time );            searching_time = searched_time;            // Scroll the Y-axis as well so searched_dobj becomes visible            tree_view.scrollRowToVisible( searched_dobj.getRowID() );            //  call this.paint( g );            this.repaint();            search_dialog.replace( dobj_panel );            if ( ! search_dialog.isVisible() )                 search_dialog.setVisibleAtDefaultLocation();            return true;        }        else {            if (    searched_dobj != null                 && (    searched_dobj.getLatestTime()                      == time_model.getTimeGlobalMaximum() ) )                Dialogs.info( SwingUtilities.windowForComponent( this ),                              "The LAST drawable in the logfile has been "                            + "reached.\n  Search forward has no more "                            + "drawable to return.\n", null );            else                Dialogs.warn( SwingUtilities.windowForComponent( this ),                              "If the end of the logfile is not within view,\n"                            + "SCROLL FORWARD till you see more drawables\n"                            + "are within view.  All drawables in view or in \n"                            + "the memory have been searched.\n" );            search_dialog.setVisible( false );            searched_dobj = null;            searched_time = INVALID_TIME;            this.repaint();            return false;        }    }    public boolean searchInit()    {        InfoDialog  info_popup = super.getLastInfoDialog();        if ( info_popup != null ) {            searching_time = info_popup.getClickedTime();            info_popup.getCloseButton().doClick();            this.repaint();            return true;        }        else {            Dialogs.warn( SwingUtilities.windowForComponent( this ),                          "No info dialog box! Info dialog box can be set\n"                        + "by right mouse clicking on the timeline canvas\n" );            return false;        }    }        /*            Interface to Overload MouseInputListener()        */        public void mouseClicked( MouseEvent mouse_evt )        {            Point  vport_click;            super.mouseClicked( mouse_evt );            if ( SwingUtilities.isLeftMouseButton( mouse_evt ) ) {                if ( ! super.isLeftMouseClick4Zoom ) {  // Hand Mode                    vport_click    = mouse_evt.getPoint();                    searching_time = super.coord_xform.convertPixelToTime(                                                       vport_click.x );                    this.repaint();                }            }        }        private int     mouse_last_Yloc;        private double  ratio_ymodel2vportH;        /*            In order to allow grasp & scroll along Y-axis, the change in            mouse movement in Y-axis on this Viewport needs to be translated            to movement in Yaxis scrollbar's model coordinate.  The trick is            that the "extent" of Yaxis scrollbar's model should be mapped            to the viewport height in pixel.        */        public void mousePressed( MouseEvent mouse_evt )        {            Point  vport_click;            super.mousePressed( mouse_evt );            if ( SwingUtilities.isLeftMouseButton( mouse_evt ) ) {                if ( ! super.isLeftMouseClick4Zoom ) {  // Hand Mode                    vport_click          = mouse_evt.getPoint();                    mouse_last_Yloc      = vport_click.y;                    ratio_ymodel2vportH  = (double) y_model.getExtent()                                                  / this.getHeight();                }            }        }        public void mouseDragged( MouseEvent mouse_evt )        {            Point  vport_click;            int    y_change, sb_change;            super.mouseDragged( mouse_evt );            if ( SwingUtilities.isLeftMouseButton( mouse_evt ) ) {                if ( ! super.isLeftMouseClick4Zoom ) {  // Hand Mode                    vport_click = mouse_evt.getPoint();                    y_change    = mouse_last_Yloc - vport_click.y;                     sb_change   = (int) Math.round( ratio_ymodel2vportH                                                  * y_change );                    // y_model.setValue() invokes adjustmentValueChanged() above                    y_model.setValue( y_model.getValue() + sb_change );                    mouse_last_Yloc = vport_click.y;                }            }        }        public void mouseReleased( MouseEvent mouse_evt )        {            Point  vport_click;            int    y_change, sb_change;            super.mouseReleased( mouse_evt );            if ( SwingUtilities.isLeftMouseButton( mouse_evt ) ) {                if ( ! super.isLeftMouseClick4Zoom ) {                    vport_click = mouse_evt.getPoint();                    y_change  = mouse_last_Yloc - vport_click.y;                     sb_change = (int) Math.round( ratio_ymodel2vportH                                                * y_change );                    // y_model.setValue() invokes adjustmentValueChanged() above                    y_model.setValue( y_model.getValue() + sb_change );                    mouse_last_Yloc = vport_click.y;                }            }        }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -