📄 elanlayoutmanager.java
字号:
if (plModel.player.getVisualComponent() != null) { container.remove(plModel.player.getVisualComponent()); } syncManager.remove(plModel.player); if (mode == SYNC_MODE) { doLayout(); } } return; } container.remove(syncManager.getPlayerLabel(plModel.player)); syncManager.remove(plModel.player); if (plModel.isVisual()) { if (plModel.isAttached()) { container.remove(plModel.visualComponent); } else { // attach destroys a detached frame... plModel.attach(); } } playerList.remove(plModel); if ((index == 0) && (playerList.size() > 0)) { //the master media has been removed PlayerLayoutModel model = (PlayerLayoutModel) playerList.get(0); masterMediaPlayer = model.player; } if (playerList.size() == 0) { container.remove(syncManager.getPlayerSelectionPanel()); } doLayout(); } /** * Detaches the specified viewer or player. * * @param object the viewer or player to remove from the main application frame */ public void detach(Object object) { if (object instanceof AbstractViewer) { container.remove((Component) object); // should create a kind of list of ViewerLayoutModel objects // once attaching and detaching of viewers is implemented String title = object.getClass().getName(); int index = title.lastIndexOf('.'); if (index > 0) { title = title.substring(index + 1, title.length()); } JDialog dlg = new DetachedViewerFrame(this, (Component) object, title); dlg.setSize(500, 300); dlg.setVisible(true); } else if (object instanceof Component) { // might be a visual component of a player PlayerLayoutModel model; for (int i = 0; i < playerList.size(); i++) { model = (PlayerLayoutModel) playerList.get(i); if (model.visualComponent == object) { if (model.isVisual() && model.isAttached()) { container.remove(model.visualComponent); model.detach(); doLayout(); } break; } } } } /** * Attaches the specified viewer or player. * * @param object the viewer or player to attach */ public void attach(Object object) { /* if (object instanceof AbstractViewer) { // detach from frame/dialog, destroy dialog and add to container // use a ViewerLayoutModel container.add((Component)object); } else */ if (object instanceof Component) { // might be a visual component of a player PlayerLayoutModel model; for (int i = 0; i < playerList.size(); i++) { model = (PlayerLayoutModel) playerList.get(i); if (model.visualComponent == object) { if (model.isVisual() && !model.isAttached()) { model.attach(); container.add(model.visualComponent); doLayout(); // test for QT if (model.player instanceof QTMediaPlayer) { // force movie to resize try { Thread.sleep(100); } catch (Exception e) { } Rectangle rec = model.visualComponent.getBounds(); model.visualComponent.setBounds(new Rectangle( rec.x, rec.y, rec.width - 1, rec.height - 1)); container.validate(); } } break; } } } } /** * When more than one video players are present and attached, this will make * the specified video the one that is displayed as the first (and largest) * video. * @param player the player to display as the first (attached) video */ public void setFirstPlayer(ElanMediaPlayer player) { if (player == null) { return; } PlayerLayoutModel model; for (int i = 0; i < playerList.size(); i++) { model = (PlayerLayoutModel) playerList.get(i); if (model.player == player) { model.setDisplayedFirst(true); } else { model.setDisplayedFirst(false); } } doLayout(); } /** * DOCUMENT ME! * * @param mediaPlayerController */ private void setMediaPlayerController( ElanMediaPlayerController mediaPlayerController) { this.mediaPlayerController = mediaPlayerController; // add the control components to the container container.add(mediaPlayerController.getPlayButtonsPanel()); container.add(mediaPlayerController.getTimePanel()); // container.add(mediaPlayerController.getDurationPanel()); container.add(mediaPlayerController.getModePanel()); container.add(mediaPlayerController.getSelectionPanel()); container.add(mediaPlayerController.getSelectionButtonsPanel()); container.add(mediaPlayerController.getAnnotationNavigationPanel()); container.add(mediaPlayerController.getSliderPanel()); container.add(mediaPlayerController.getAnnotationDensityViewer()); controlPanel.add(mediaPlayerController.getVolumePanel()); controlPanel.add(mediaPlayerController.getRatePanel()); addToTabPane(ElanLocale.getString("Tab.Controls"), controlPanel); doLayout(); } /** * DOCUMENT ME! * * @param signalViewer */ private void setSignalViewer(SignalViewer signalViewer) { this.signalViewer = signalViewer; if (signalComponent == null) { // dit al voorbakken signalComponent = new JPanel(); signalComponent.setLayout(null); signalComponent.addComponentListener(new SignalSplitPaneListener()); } // place the component in the split pane signalComponent.add(signalViewer); getTimeLineSplitPane().setTopComponent(signalComponent); int divLoc = (signalComponent.getHeight() < DEF_SIGNAL_HEIGHT) ? DEF_SIGNAL_HEIGHT : signalComponent.getHeight(); timeLineSplitPane.setDividerLocation(divLoc); doLayout(); } /** * Returns the SignalViewer. * * @return the SignalViewer, can be null */ public SignalViewer getSignalViewer() { return signalViewer; } /** * Removes the SignalViewer from the layout. */ private void removeSignalViewer() { if (signalViewer != null) { if (signalComponent != null) { signalComponent.remove(signalViewer); getTimeLineSplitPane().setTopComponent(null); //timeLineSplitPane.setDividerLocation(0); doLayout(); } } } /** * DOCUMENT ME! * * @param timeLineViewer */ private void setTimeLineViewer(TimeLineViewer timeLineViewer) { this.timeLineViewer = timeLineViewer; if (timeLineComponent == null) { timeLineComponent = new JPanel(); timeLineComponent.setLayout(null); } if (multiTierControlPanel == null) { multiTierControlPanel = viewerManager.getMultiTierControlPanel(); timeLineComponent.add(multiTierControlPanel); } // disable the interlinear viewer if it exists if (interlinearViewer != null) { viewerManager.disableViewer(interlinearViewer); } // place the component in the split pane timeLineComponent.add(timeLineViewer); getTimeLineSplitPane().setBottomComponent(timeLineComponent); if (getTimeLineSplitPane().getTopComponent() != null) { getTimeLineSplitPane().setDividerLocation(DEF_SIGNAL_HEIGHT); } doLayout(); } /** * DOCUMENT ME! * * @param interlinearViewer */ private void setInterlinearViewer(InterlinearViewer interlinearViewer) { this.interlinearViewer = interlinearViewer; if (timeLineComponent == null) { timeLineComponent = new JPanel(); timeLineComponent.setLayout(null); } if (multiTierControlPanel == null) { multiTierControlPanel = viewerManager.getMultiTierControlPanel(); timeLineComponent.add(multiTierControlPanel); } // disable the interlinear viewer if it exists if (timeLineViewer != null) { viewerManager.disableViewer(timeLineViewer); } // place the component in the split pane timeLineComponent.add(interlinearViewer); getTimeLineSplitPane().setBottomComponent(timeLineComponent); doLayout(); } /** * Sets the one timeseries viewer. This has to be changed if there is a need * for more than one timeseries viewer. * * @param viewer the timeseries viewer */ private void setTimeSeriesViewer(TimeSeriesViewer timeseriesViewer) { this.timeseriesViewer = timeseriesViewer; // add to the layout if there is no SignalViewer?? // for now just create a detached frame for the viewer detach(timeseriesViewer); } /** * DOCUMENT ME! * * @return DOCUMENT ME! */ public MultiTierControlPanel getMultiTierControlPanel() { return multiTierControlPanel; } /** * DOCUMENT ME! */ public void showTimeLineViewer() { showTimeLineViewer = true; showInterlinearViewer = false; enableDisableLogic(); doLayout(); } /** * DOCUMENT ME! */ public void showInterlinearViewer() { showTimeLineViewer = false; showInterlinearViewer = true; enableDisableLogic(); doLayout(); } private void enableDisableLogic() { if (showTimeLineViewer) { if (timeLineViewer != null) { viewerManager.enableViewer(timeLineViewer); } if (interlinearViewer != null) { viewerManager.disableViewer(interlinearViewer); } } else if (showInterlinearViewer) { if (timeLineViewer != null) { viewerManager.disableViewer(timeLineViewer); } if (interlinearViewer != null) { viewerManager.enableViewer(interlinearViewer); } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -