Revision 25020 trunk/extensions/extDockingSkin/src/main/java/org/gvsig/mdiManager/DockingManager.java

View differences:

DockingManager.java
218 218
		if ((iWindow instanceof SingletonWindow) && (wi.isModal())) {
219 219
			throw new RuntimeException("A modal view cannot be a SingletonView");
220 220
		}
221
		if ((iWindow.getWindowProfile() == WindowInfo.DIALOG_PROFILE) && (wi.isModeless())) {
222
			throw new RuntimeException("A modeless view cannot have the DIALOG_PROFILE property");
223
		}
221 224

  
222 225
		/*
223 226
		 * Se obtiene la referencia a la vista anterior por si es una singleton
......
250 253
						IWindow v = wis.getWindowById(Integer.parseInt(e
251 254
								.getActionCommand()));
252 255
						DockWindow f = dockWindowSupport.getDockWindow(v);
253
						f.getTopLevelAncestor().requestFocus();
254
						f.restoreFocus();
256
						//f.getTopLevelAncestor().requestFocus();
257
						//f.restoreFocus();
258
						f.requestFocus();
259
						wss.setActive(v);
255 260
						// activateJInternalFrame(f);
256 261
					}
257 262
				});
......
262 267
				DockWindow frame = (DockWindow) singletonSupport
263 268
						.getFrame((SingletonWindow) iWindow);
264 269
				// activateJInternalFrame(frame);
265
				frame.getTopLevelAncestor().requestFocus();
266
				frame.restoreFocus();
270
				//frame.getTopLevelAncestor().requestFocus();
271
				//frame.restoreFocus();
272
				frame.requestFocus();
267 273
				wss.setActive(iWindow);
268 274
				return dockWindowSupport.getWindow((DockWindow) frame);
269 275
			}
......
287 293
									&& (projectWindow != null)) {
288 294
								DockWindow f = dockWindowSupport
289 295
										.getDockWindow(v);
290
								f.getTopLevelAncestor().requestFocus();
291
								f.restoreFocus();
296
								//f.getTopLevelAncestor().requestFocus();
297
								//f.restoreFocus();
298
								f.requestFocus();
299
								wss.setActive(v);
292 300
							} else {
293 301
								setProjectWindowVisible(!showProjectWindow);
294 302
							}
......
353 361
		wnd.addListener(new DockWindowListener());
354 362

  
355 363
		Integer type = (Integer) wnd.getIWindow().getWindowProfile();
356

  
364
		System.out.println("Class iWindow: " + iWindow.getClass());
357 365
		if (type != null) {
358 366
			if (type.equals(WindowInfo.PROJECT_PROFILE)) {
359 367
				this.projectButton.setName("project window");
......
378 386
				DockingUtil.addWindow(wnd, rootWindow);
379 387
			}
380 388
			if (type.equals(WindowInfo.TOOL_PROFILE)) {
381
				DockingUtil.addWindow(wnd, rootWindow);
389
				rootWindow.getWindowBar(Direction.DOWN).addTab(wnd);
382 390
			}
383 391
			if (type.equals(WindowInfo.PROPERTIES_PROFILE)) {
384 392
				// DockingUtil.addWindow(wnd, rootWindow);
......
392 400
				// Show the window
393 401
				floatingWindow.getTopLevelAncestor().setVisible(true);
394 402
				((JDialog) floatingWindow.getTopLevelAncestor())
395
						.addWindowListener(new FloatingWindowContainerListener(
396
								floatingWindow));
403
				.addWindowListener(new FloatingWindowContainerListener(
404
						floatingWindow));
405
//				DockingUtil.addWindow(wnd, rootWindow);
397 406

  
407
				
398 408
			}
399 409
		} else {
400 410
			JOptionPane
401 411
					.showMessageDialog(
402 412
							null,
403
							"la ventana que se va a a?adir no tiene una zona predeterminada en el skin, rellenar la funcion getWindowProfile()"
413
							"la ventana que se va a aadir no tiene una zona predeterminada en el skin, rellenar la funcion getWindowProfile()"
404 414
									+ "de la clase "
405 415
									+ wnd.getIWindow().getClass());
406 416
			DockingUtil.addWindow(wnd, rootWindow);
......
446 456
		// }
447 457
		// DockingUtil.addWindow(wnd, rootWindow);
448 458
		updateDockWindowProperties(wnd, wi);
449
		if (wnd.getTopLevelAncestor() != null)
450
			wnd.getTopLevelAncestor().requestFocus();
451
		wnd.restoreFocus();
459
		//if (wnd.getTopLevelAncestor() != null)
460
		//	wnd.getTopLevelAncestor().requestFocus();
461
		//wnd.restoreFocus();
462
		wnd.requestFocus();
452 463
		lastFocusedWindow = wnd;
453 464
	}
454 465

  
......
735 746
				DockWindow dockWindow = (DockWindow) view;
736 747
				if (dockWindow == null)
737 748
					return;
738
				WindowInfo wi = ((DockWindow) arg0).getIWindow()
749
				WindowInfo wi = dockWindow.getIWindow()
739 750
						.getWindowInfo();
740 751

  
741 752
				if (wi.isMaximizable()) {
......
756 767
		}
757 768

  
758 769
		public void windowAdded(DockingWindow arg0, DockingWindow arg1) {
770
			DockingWindow view = arg1;
771
			if (view instanceof DockWindow) {
772
				DockWindow dockWindow = (DockWindow) view;
773
				if (dockWindow == null)
774
					return;
775
				WindowInfo wi = dockWindow.getIWindow()
776
						.getWindowInfo();
777

  
778
				if (wi.isMaximizable()) {
779
					dockWindow.getWindowProperties().setMaximizeEnabled(true);
780
				}
781

  
782
				mainFrame.enableControls();
783
				if (wi.getSelectedTools() == null) {
784
					// this is the first time this window is activated
785
					wi.setSelectedTools(new HashMap(mainFrame
786
							.getInitialSelectedTools()));
787
				}
788
				mainFrame.setSelectedTools(wi.getSelectedTools());
789
				callWindowActivated(dockWindow.getIWindow());
790
				lastFocusedWindow = dockWindow;
791
			}
759 792
			mainFrame.enableControls();
760

  
793
			rootWindow.validate();
761 794
		}
762 795

  
763 796
		public void windowClosed(DockingWindow view) {
......
781 814

  
782 815
				if (!wi.isPalette())
783 816
					mainFrame.enableControls();
817
				mainFrame.enableControls();
818
				rootWindow.validate();
784 819
			}
785
			rootWindow.repaint();
786 820
		}
787 821

  
788 822
		public void windowClosing(DockingWindow view)
789 823
				throws OperationAbortedException {
824
			mainFrame.enableControls();
825
			rootWindow.validate();
790 826

  
791 827
		}
792 828

  
793 829
		public void windowDocked(DockingWindow arg0) {
794 830
			mainFrame.enableControls();
831
			rootWindow.validate();
795 832

  
796 833
		}
797 834

  
798 835
		public void windowDocking(DockingWindow arg0)
799 836
				throws OperationAbortedException {
800
			// TODO Auto-generated method stub
837
			mainFrame.enableControls();
838
			rootWindow.validate();
801 839

  
802 840
		}
803 841

  
804 842
		public void windowHidden(DockingWindow arg0) {
805 843
			mainFrame.enableControls();
844
			rootWindow.validate();
806 845
		}
807 846

  
808 847
		public void windowMaximized(DockingWindow arg0) {
809
			// TODO Auto-generated method stub
810

  
811
			setProjectWindowVisible(!showProjectWindow);
812 848
			mainFrame.enableControls();
849
			rootWindow.validate();
813 850
		}
814 851

  
815 852
		public void windowMaximizing(DockingWindow arg0)
816 853
				throws OperationAbortedException {
817
			// TODO Auto-generated method stub
854
			setProjectWindowVisible(false);
855
			mainFrame.enableControls();
856
			rootWindow.validate();
818 857

  
819
			setProjectWindowVisible(!showProjectWindow);
820

  
821 858
		}
822 859

  
823 860
		public void windowMinimized(DockingWindow arg0) {
824
			// TODO Auto-generated method stub
825 861
			mainFrame.enableControls();
862
			rootWindow.validate();
826 863

  
827 864
		}
828 865

  
829 866
		public void windowMinimizing(DockingWindow arg0)
830 867
				throws OperationAbortedException {
831
			// TODO Auto-generated method stub
868
			mainFrame.enableControls();
869
			rootWindow.validate();
832 870

  
833 871
		}
834 872

  
835 873
		public void windowRemoved(DockingWindow arg0, DockingWindow arg1) {
836 874
			mainFrame.enableControls();
875
			rootWindow.validate();
837 876

  
838 877
		}
839 878

  
840 879
		public void windowRestored(DockingWindow arg0) {
841
			// TODO Auto-generated method stub
842 880
			mainFrame.enableControls();
881
			rootWindow.validate();
843 882
		}
844 883

  
845 884
		public void windowRestoring(DockingWindow arg0)
846 885
				throws OperationAbortedException {
847
			// TODO Auto-generated method stub
886
			mainFrame.enableControls();
887
			rootWindow.validate();
848 888

  
849 889
		}
850 890

  
851 891
		public void windowShown(DockingWindow arg0) {
852
			// TODO Auto-generated method stub
853 892
			mainFrame.enableControls();
893
			rootWindow.validate();
854 894
		}
855 895

  
856 896
		public void windowUndocked(DockingWindow arg0) {
......
860 900
								arg0));
861 901
			}
862 902
			mainFrame.enableControls();
903
			rootWindow.validate();
863 904

  
864 905
		}
865 906

  
866 907
		public void windowUndocking(DockingWindow arg0)
867 908
				throws OperationAbortedException {
868
			// TODO Auto-generated method stub
909
			mainFrame.enableControls();
910
			rootWindow.validate();
869 911

  
870 912
		}
871 913

  

Also available in: Unified diff