*            after writing this page, load this new page. Pass null if no new page has to be loaded.
	 */
	protected boolean savePage(boolean alwaysAsk, String newAddress) {

		FileFilter filter = FileFilterFactory.getFilter(FileUtilities.getSuffix(pageAddress));
		if (filter == null)
			filter = FileFilterFactory.getFilter("cml");

		saveReminder.setChanged(false);
		properties.clear();
		deselect();

		if (!alwaysAsk) {
			if (!pageAddress.equals("Untitled.cml") && !isRemote()) {
				if (!isWriting()) {
					final File file = new File(pageAddress);
					if (validateFileName(file)) {
						final String newPageAddress = newAddress;
						new SwingWorker("Page-saving thread") {
							public Object construct() {
								notifyPageListeners(new PageEvent(Page.this, PageEvent.PAGE_OVERWRITE_BEGIN));
								synchronized (lock) {
									saveTo(file);
								}
								return file;
							}

							public void finished() {
								isWriting = false;
								if (newPageAddress != null)
									readPageWithThread(newPageAddress);
								notifyPageListeners(new PageEvent(Page.this, PageEvent.PAGE_OVERWRITE_END));
							}
						}.start();
					}
				} else {
					System.out.println("busy writing " + pageAddress);
				}
				return true;
			}
		}

		boolean overwrite = false;
		Frame frame = JOptionPane.getFrameForComponent(this);
		if (filter != null) {
			fileChooser.setAcceptAllFileFilterUsed(false);
			fileChooser.addChoosableFileFilter(filter);
		} else {
			fileChooser.setAcceptAllFileFilterUsed(true);
		}
		fileChooser.setDialogType(JFileChooser.SAVE_DIALOG);
		String s = Modeler.getInternationalText("SavePage");
		fileChooser.setDialogTitle(s != null ? s : "Save page");
		fileChooser.setApproveButtonMnemonic('S');
		String latestPath = fileChooser.getLastVisitedPath();
		if (latestPath != null)
			fileChooser.setCurrentDirectory(new File(latestPath));
		fileChooser.setAccessory(null);
		if (isRemote()) {
			try {
				fileChooser.setSelectedFile(new File(fileChooser.getCurrentDirectory(), FileUtilities.getFileName(pageAddress)));
			} catch (NullPointerException npe) {
				npe.printStackTrace();
				fileChooser.resetTextField();
			}
		} else {
			try {
				File f2 = new File(fileChooser.getCurrentDirectory(), FileUtilities.getFileName(pageAddress));
				if (f2.exists()) {
					fileChooser.setSelectedFile(new File(fileChooser.getCurrentDirectory(), "Copy of " + FileUtilities.getFileName(pageAddress)));
				} else {
					fileChooser.setSelectedFile(f2);
				}
			} catch (NullPointerException npe) {
				npe.printStackTrace();
				fileChooser.resetTextField();
			}
		}

		if (fileChooser.showSaveDialog(frame) == JFileChooser.APPROVE_OPTION) {
			final File file = new File(FileUtilities.fileNameAutoExtend(filter, fileChooser.getSelectedFile()));
			if (!validateFileName(file)) {
				fileChooser.resetChoosableFileFilters();
				return false;
			}
			if (file.exists()) {
				s = Modeler.getInternationalText("FileExists");
				String s1 = Modeler.getInternationalText("File");
				String s2 = Modeler.getInternationalText("Overwrite");
				String s3 = Modeler.getInternationalText("Exists");
				if (JOptionPane.showConfirmDialog(frame, (s1 != null ? s1 : "File") + " " + file.getName() + " " + (s3 != null ? s3 : "exists") + ", " + (s2 != null ? s2 : "overwrite") + "?", s != null ? s : "File exists", JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION) {
					fileChooser.resetChoosableFileFilters();
					return false;
				}
				overwrite = true;
			}

			final PageEvent pe_beg = new PageEvent(this, overwrite ? PageEvent.PAGE_OVERWRITE_BEGIN : PageEvent.PAGE_WRITE_BEGIN);
			final PageEvent pe_end = new PageEvent(this, overwrite ? PageEvent.PAGE_OVERWRITE_END : PageEvent.PAGE_WRITE_END);

			if (!isWriting()) {
				final String newPageAddress = newAddress;
				new SwingWorker("Page-saving thread") {
					public Object construct() {
						notifyPageListeners(pe_beg);
						synchronized (lock) {
							saveTo(file);
						}
						return file;
					}

					public void finished() {
						isWriting = false;
						String s = file.getAbsolutePath();
						if (navigator != null)
							navigator.storeLocation(s);
						notifyPageListeners(pe_end);
						if (newPageAddress != null) {
							readPageWithThread(newPageAddress);
							if (navigator != null)
								navigator.storeLocation(newPageAddress);
						}
						setAddress(s);
					}
				}.start();
				fileChooser.rememberPath(fileChooser.getCurrentDirectory().toString());
				fileChooser.rememberFile(file.getAbsolutePath(), recentFilesMenu);

			}
		}

		fileChooser.resetChoosableFileFilters();
		return true;

	}