Compare commits

..

2 Commits

Author SHA1 Message Date
sdv%sparc.spb.su
53866ece4f workaround for bug=30927
git-svn-id: svn://10.0.0.236/branches/M15-patch@72213 18797224-902f-48f8-a5cc-f745e15eee43
2000-06-14 11:34:36 +00:00
(no author)
350be55313 This commit was manufactured by cvs2svn to create branch 'M15-patch'.
git-svn-id: svn://10.0.0.236/branches/M15-patch@52901 18797224-902f-48f8-a5cc-f745e15eee43
1999-11-06 02:47:16 +00:00
11 changed files with 105 additions and 652 deletions

View File

@@ -0,0 +1,105 @@
/*
The contents of this file are subject to the Mozilla Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is mozilla.org code.
The Initial Developer of the Original Code is Sun Microsystems,
Inc. Portions created by Sun are
Copyright (C) 1999 Sun Microsystems, Inc. All
Rights Reserved.
Contributor(s):
*/
#ifndef __JavaDOMGlobals_h__
#define __JavaDOMGlobals_h__
#include "jni.h"
#include "prclist.h"
#include "nsError.h"
#ifdef ERROR
#undef ERROR
#endif
class nsISupports;
class nsIDOMNode;
struct PRLogModuleInfo;
struct PRLock;
class JavaDOMGlobals {
public:
static jclass attrClass;
static jclass cDataSectionClass;
static jclass commentClass;
static jclass documentClass;
static jclass documentFragmentClass;
static jclass documentTypeClass;
static jclass domImplementationClass;
static jclass elementClass;
static jclass entityClass;
static jclass entityReferenceClass;
static jclass namedNodeMapClass;
static jclass nodeClass;
static jclass nodeListClass;
static jclass notationClass;
static jclass processingInstructionClass;
static jclass textClass;
static jfieldID nodePtrFID;
static jfieldID nodeListPtrFID;
static jfieldID domImplementationPtrFID;
static jfieldID nodeTypeAttributeFID;
static jfieldID nodeTypeCDataSectionFID;
static jfieldID nodeTypeCommentFID;
static jfieldID nodeTypeDocumentFragmentFID;
static jfieldID nodeTypeDocumentFID;
static jfieldID nodeTypeDocumentTypeFID;
static jfieldID nodeTypeElementFID;
static jfieldID nodeTypeEntityFID;
static jfieldID nodeTypeEntityReferenceFID;
static jfieldID nodeTypeNotationFID;
static jfieldID nodeTypeProcessingInstructionFID;
static jfieldID nodeTypeTextFID;
static jclass domExceptionClass;
static jmethodID domExceptionInitMID;
static jclass runtimeExceptionClass;
static jmethodID runtimeExceptionInitMID;
static const char* const DOM_EXCEPTION_MESSAGE[];
typedef enum ExceptionType { EXCEPTION_RUNTIME,
EXCEPTION_DOM } ExceptionType;
static PRLogModuleInfo* log;
static PRCList garbage;
static PRLock* garbageLock;
static PRInt32 javaMaxInt;
static void Initialize(JNIEnv *env);
static void Destroy(JNIEnv *env);
static jobject CreateNodeSubtype(JNIEnv *env,
nsIDOMNode *node);
static void AddToGarbage(nsISupports* domObject);
static void TakeOutGarbage();
static void ThrowException(JNIEnv *env,
const char * message = NULL,
nsresult rv = NS_OK,
ExceptionType exceptionType = EXCEPTION_RUNTIME);
};
#endif /* __JavaDOMGlobals_h__ */

View File

@@ -1,41 +0,0 @@
#! gmake
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2000 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Stuart Parmenter <pavlov@netscape.com>
#
DEPTH = ../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
CHROME_DIR = packages/widget-toolkit
CHROME_CONTENT_DIR = global/content
CHROME_CONTENT = \
filepicker.xul \
filepicker.js \
filepicker.css \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -1,10 +0,0 @@
/* This file is for non skin-specific rules for the filepicker dialog */
.tree-cell-twisty { display: none; }
treeitem[container="true"] > treerow > treecell {
list-style-image: url("chrome://global/skin/dir-closed.gif");
}

View File

@@ -1,357 +0,0 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 2000 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
* Brian Ryner <bryner@netscape.com>
* Jan Varga <varga@utcru.sk>
* Peter Annema <disttsc@bart.nl>
*/
const nsILocalFile = Components.interfaces.nsILocalFile;
const nsILocalFile_PROGID = "component://mozilla/file/local";
const nsIFilePicker = Components.interfaces.nsIFilePicker;
const nsIDirectoryServiceProvider = Components.interfaces.nsIDirectoryServiceProvider;
const nsIDirectoryServiceProvider_PROGID = "component://netscape/file/directory_service";
const nsStdURL_PROGID = "component://netscape/network/standard-url";
const nsIFileURL = Components.interfaces.nsIFileURL;
const NC_NAMESPACE_URI = "http://home.netscape.com/NC-rdf#";
var sfile = Components.classes[nsILocalFile_PROGID].createInstance(nsILocalFile);
var retvals;
var filePickerMode;
var currentFilter;
var lastClicked;
var dirHistory;
var homeDir;
var directoryTree;
var textInput;
var bundle = srGetStrBundle("chrome://global/locale/filepicker.properties");
function onLoad() {
dirHistory = new Array();
directoryTree = document.getElementById("directoryTree");
textInput = document.getElementById("textInput");
if (window.arguments) {
var o = window.arguments[0];
retvals = o.retvals; /* set this to a global var so we can set return values */
const title = o.title;
filePickerMode = o.mode;
if (o.displayDirectory)
const directory = o.displayDirectory.path;
const initialText = o.defaultString;
const filterTitles = o.filters.titles;
const filterTypes = o.filters.types;
const numFilters = filterTitles.length;
window.title = title;
if (initialText) {
textInput.value = initialText;
}
/* build filter popup */
var filterPopup = document.createElement("menupopup");
currentFilter = filterTypes[0];
applyFilter();
for (var i = 0; i < numFilters; i++) {
var menuItem = document.createElement("menuitem");
menuItem.setAttribute("value", filterTitles[i] + " (" + filterTypes[i] + ")");
menuItem.setAttribute("filters", filterTypes[i]);
filterPopup.appendChild(menuItem);
}
var filterMenuList = document.getElementById("filterMenuList");
filterMenuList.appendChild(filterPopup);
}
// setup the dialogOverlay.xul button handlers
doSetOKCancel(onOK, onCancel);
// get the home dir
var dirServiceProvider = Components.classes[nsIDirectoryServiceProvider_PROGID].getService().QueryInterface(nsIDirectoryServiceProvider);
var persistent = new Object();
homeDir = dirServiceProvider.getFile("Home", persistent);
if (directory)
sfile.initWithPath(directory);
if (!directory || !(sfile.exists() && sfile.isDirectory())) {
// Start in the user's home directory
sfile.initWithPath(homeDir.path);
}
retvals.buttonStatus = nsIFilePicker.returnCancel;
gotoDirectory(sfile);
textInput.focus();
}
function onFilterChanged(target)
{
var filterTypes = target.getAttribute("filters");
currentFilter = filterTypes;
applyFilter();
}
function applyFilter()
{
/* This is where we manipulate the DOM to create new <rule>s */
var splitFilters = currentFilter.split("; ");
var matchAllFiles = false;
/* get just the extensions for each of the filters */
var extensions = new Array(splitFilters.length);
for (var j = 0; j < splitFilters.length; j++) {
var tmpStr = splitFilters[j];
if (tmpStr == "*") {
matchAllFiles = true;
break;
} else
extensions[j] = tmpStr.substring(1); /* chop off the '*' */
}
/* delete all rules except the first one */
for (var j = 1;; j++) {
var ruleNode = document.getElementById("matchRule."+j);
if (ruleNode) {
ruleNode.parentNode.removeChild(ruleNode);
} else {
break;
}
}
/* if we are matching all files, just clear the extension attribute
on the first match rule and we're done */
var rule0 = document.getElementById("matchRule.0");
if (matchAllFiles) {
rule0.removeAttributeNS(NC_NAMESPACE_URI, "extension");
directoryTree.builder.rebuild();
return;
}
/* rule 0 is special */
rule0.setAttributeNS(NC_NAMESPACE_URI, "extension" , extensions[0]);
/* iterate through the remaining extensions, creating new rules */
var ruleNode = document.getElementById("fileFilter");
for (var k=1; k < extensions.length; k++) {
var newRule = rule0.cloneNode(true);
newRule.setAttribute("id", "matchRule."+k);
newRule.setAttributeNS(NC_NAMESPACE_URI, "extension", extensions[k]);
ruleNode.appendChild(newRule);
}
directoryTree.builder.rebuild();
}
function onOK()
{
var ret = nsIFilePicker.returnCancel;
var isDir = false;
var isFile = false;
var input = textInput.value;
if (input[0] == '~') // XXX XP?
input = homeDir.path + input.substring(1);
var file = sfile.clone().QueryInterface(nsILocalFile);
if (!file)
return false;
/* XXX we need an XP way to test for an absolute path! */
if (input[0] == '/') /* an absolute path was entered */
file.initWithPath(input);
else {
try {
file.appendRelativePath(input);
} catch (e) {
dump("Can't append relative path '"+input+"':\n");
return false;
}
}
if (!file.exists() && (filePickerMode != nsIFilePicker.modeSave)) {
return false;
}
if (file.exists()) {
var isDir = file.isDirectory();
var isFile = file.isFile();
}
switch(filePickerMode) {
case nsIFilePicker.modeOpen:
if (isFile) {
retvals.directory = file.parent.path;
ret = nsIFilePicker.returnOK;
} else if (isDir) {
if (!sfile.equals(file)) {
gotoDirectory(file);
}
textInput.value = "";
ret = nsIFilePicker.returnCancel;
}
break;
case nsIFilePicker.modeSave:
if (isFile) {
// we need to pop up a dialog asking if you want to save
rv = window.confirm(file.path + " " + bundle.GetStringFromName("confirmFileReplacing"));
if (rv)
ret = nsIFilePicker.returnReplace;
else
ret = nsIFilePicker.returnCancel;
retvals.directory = file.parent.path;
} else if (!file.exists()) {
ret = nsIFilePicker.returnOK;
retvals.directory = file.parent.path;
}
break;
case nsIFilePicker.modeGetFolder:
if (isDir) {
retvals.directory = file.parent.path;
ret = nsIFilePicker.returnOK;
}
break;
}
retvals.file = file;
retvals.buttonStatus = ret;
if (ret == nsIFilePicker.returnCancel)
return false;
else
return true;
}
function onCancel()
{
// Close the window.
retvals.buttonStatus = nsIFilePicker.returnCancel;
return true;
}
function onClick(e) {
if ( e.detail == 2 ) {
var file = URLpathToFile(e.target.parentNode.getAttribute("path"));
if (file.isDirectory()) {
gotoDirectory(file);
}
else if (file.isFile()) {
/* what about symlinks? what if they symlink to a directory? */
return doOKButton();
}
}
}
function onKeypress(e) {
if (e.keyCode == 8) /* backspace */
goUp();
}
function onSelect(e) {
if (e.target.selectedItems.length != 1)
return;
var file = URLpathToFile(e.target.selectedItems[0].firstChild.getAttribute("path"));
if (file.isFile()) {
textInput.value = file.leafName;
lastClicked = file.leafName;
}
}
function onDirectoryChanged(target)
{
var path = target.getAttribute("value");
var file = Components.classes[nsILocalFile_PROGID].createInstance(nsILocalFile);
file.initWithPath(path);
gotoDirectory(file);
}
function addToHistory(directoryName) {
var found = false;
var i = 0;
while (!found && i<dirHistory.length) {
if (dirHistory[i] == directoryName)
found = true;
else
i++;
}
if (found) {
if (i!=0) {
dirHistory.splice(i, 1);
dirHistory.splice(0, 0, directoryName);
}
} else {
dirHistory.splice(0, 0, directoryName);
}
var menu = document.getElementById("lookInMenu");
var children = menu.childNodes;
for (var i=0; i < children.length; i++)
menu.removeChild(children[i]);
for (var i=0; i < dirHistory.length; i++) {
var menuItem = document.createElement("menuitem");
menuItem.setAttribute("value", dirHistory[i]);
menu.appendChild(menuItem);
}
var menuList = document.getElementById("lookInMenuList");
menuList.selectedIndex = 0;
}
function goUp() {
try {
var parent = sfile.parent;
} catch(ex) { dump("can't get parent directory\n"); }
if (parent) {
gotoDirectory(parent);
}
}
function gotoDirectory(directory) {
var newURL = fileToURL(directory);
addToHistory(directory.path);
directoryTree.setAttribute("ref", fileToURL(directory).spec);
sfile = directory;
}
function fileToURL(aFile) {
var newDirectoryURL = Components.classes[nsStdURL_PROGID].createInstance().QueryInterface(nsIFileURL);
newDirectoryURL.file = aFile;
return newDirectoryURL;
}
function URLpathToFile(aURLstr) {
var fileURL = Components.classes[nsStdURL_PROGID].createInstance().QueryInterface(nsIFileURL);
fileURL.spec = aURLstr;
return fileURL.file;
}

View File

@@ -1,110 +0,0 @@
<?xml version="1.0"?> <!-- -*- Mode: HTML -*- -->
<!--
- The contents of this file are subject to the Mozilla Public
- License Version 1.1 (the "License"); you may not use this file
- except in compliance with the License. You may obtain a copy of
- the License at http://www.mozilla.org/MPL/
- Software distributed under the License is distributed on an "AS
- IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- implied. See the License for the specific language governing
- rights and limitations under the License.
- The Original Code is mozilla.org code.
- The Initial Developer of the Original Code is Netscape
- Communications Corporation. Portions created by Netscape are
- Copyright (C) 2000 Netscape Communications Corporation.
- All Rights Reserved.
- Contributor(s):
- Stuart Parmenter <pavlov@netscape.com>
- Brian Ryner <bryner@netscape.com>
- Jan Varga <varga@utcru.sk>
- Peter Annema <disttsc@bart.nl>
-->
<?xml-stylesheet href="chrome://global/skin/filepicker.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<?xml-stylesheet href="chrome://global/content/filepicker.css" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://global/locale/filepicker.dtd" >
<window id="main-window"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:nc="http://home.netscape.com/NC-rdf#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
orient="vertical"
onload="onLoad();"
width="426" height="300"
class="dialog"
persist="screenX screenY">
<script src="chrome://global/content/strres.js"/>
<script src="chrome://global/content/filepicker.js"/>
<keyset id="keyset"/>
<box autostretch="never">
<text value="&lookInMenuList.label;"/>
<menulist id="lookInMenuList" flex="1" oncommand="onDirectoryChanged(event.target);">
<menupopup id="lookInMenu"/>
</menulist>
<button value=".." onclick="goUp();"/>
</box>
<box flex="1">
<tree id="directoryTree" flex="1" onkeypress="onKeypress(event)"
onselect="onSelect(event)" datasources="rdf:files">
<template id="fileFilter">
<!-- This is the rule for files matching the filter -->
<rule id="matchRule.0">
<treechildren flex="1">
<treeitem uri="..." empty="true"
type="rdf:http://home.netscape.com/NC-rdf#File-Type"
loading="rdf:http://home.netscape.com/NC-rdf#loading" >
<treerow path="rdf:http://home.netscape.com/NC-rdf#URL">
<treecell class="treecell-filename treecell-indent"
indent="true" type="rdf:http://home.netscape.com/NC-rdf#File-Type"
value="rdf:http://home.netscape.com/NC-rdf#Name"/>
<treecell value="rdf:http://home.netscape.com/NC-rdf#Content-Length" />
<treecell value="rdf:http://home.netscape.com/WEB-rdf#LastModifiedDate" />
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
<treecolgroup>
<treecol flex="1" id="FilenameColumn" rdf:resource="http://home.netscape.com/NC-rdf#Name" sortActive="true" sortDirection="ascending"/>
<splitter class="tree-splitter"/>
<treecol flex="1" id="ContentLengthColumn" rdf:resource="http://home.netscape.com/NC-rdf#ContentLength"/>
<splitter class="tree-splitter"/>
<treecol flex="1" id="LastModifiedDateColumn" rdf:resource="http//home.netscape.com/WEB-rdf#LastModifiedDate"/>
</treecolgroup>
<treehead>
<treerow>
<treecell class="treecell-header" value="&name.label;"/>
<treecell class="treecell-header" value="&size.label;"/>
<treecell class="treecell-header" value="&lastModified.label;"/>
</treerow>
</treehead>
<treechildren flex="1" onclick="onClick(event)"/>
</tree>
</box>
<box autostretch="never" style="margin-top: 5px">
<text value="&textInput.label;"/>
<textfield id="textInput" flex="1"/>
</box>
<box autostretch="never">
<text value="&filterMenuList.label;"/>
<menulist id="filterMenuList" flex="1" oncommand="onFilterChanged(event.target);"/>
</box>
<box id="okCancelButtons"/>
</window>

View File

@@ -1,34 +0,0 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
DEPTH=..\..\..\..\..
CHROME_DIR = packages\widget-toolkit
CHROME_CONTENT_DIR = global\content
CHROME_CONTENT = \
.\filepicker.xul \
.\filepicker.js \
.\filepicker.css \
$(NULL)
include <$(DEPTH)\config\rules.mak>

View File

@@ -1,2 +0,0 @@
filepicker.properties
filepicker.dtd

View File

@@ -1,40 +0,0 @@
#! gmake
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2000 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Stuart Parmenter <pavlov@netscape.com>
#
DEPTH = ../../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
CHROME_DIR = locales/en-US
CHROME_L10N_DIR = global/locale
CHROME_L10N = \
filepicker.properties \
filepicker.dtd \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -1,8 +0,0 @@
<!ENTITY lookInMenuList.label "Look in:">
<!ENTITY textInput.label "File name:">
<!ENTITY filterMenuList.label "Files of type:">
<!ENTITY name.label "Name">
<!ENTITY size.label "Size">
<!ENTITY lastModified.label "Last Modified">
<!ENTITY permissions.label "Permissions">

View File

@@ -1,16 +0,0 @@
# LOCALIZATION NOTE FILE
# --do not localize the extensions, only the titles
allTitle=All Files
allFilter=*
htmlTitle=HTML Files
htmlFilter=*.html; *.htm; *.shtml; *.xhtml
textTitle=Text Files
textFilter=*.txt
imageTitle=Image Files
imageFilter=*.png; *.gif; *.jpeg; *.jpg
xmlTitle=XML Files
xmlFilter=*.xml
xulTitle=XUL Files
xulFilter=*.xul
confirmFileReplacing=already exists. Do you want to replace it?

View File

@@ -1,34 +0,0 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2000 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Stuart Parmenter <pavlov@netscape.com>
#
DEPTH=..\..\..\..\..\..
CHROME_DIR = locales\en-US
CHROME_L10N_DIR = global\locale
CHROME_L10N = \
.\filepicker.properties \
.\filepicker.dtd \
$(NULL)
include <$(DEPTH)\config\rules.mak>