package com.dbxml.db.admin.components;
/*
* dbXML - Native XML Database
* Copyright (c) 1999-2006 The dbXML Group, L.L.C.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* $Id: GridEditor.java,v 1.3 2006/02/02 18:53:46 bradford Exp $
*/
import com.dbxml.db.admin.Admin;
import com.dbxml.db.admin.DocWrapper;
import com.dbxml.db.admin.TabbedNodeEditor;
import com.dbxml.db.admin.xmleditor.XMLEditor;
import java.awt.Color;
import java.awt.Cursor;
/**
* GridEditor
*/
public class GridEditor extends XMLEditor implements TabbedNodeEditor {
private DocWrapper doc;
private boolean reset;
public GridEditor() {
try {
jbInit();
}
catch ( Exception e ) {
Admin.getInstance().addMessage(e.toString());
}
}
private void jbInit() throws Exception {
this.setAttribLabelSize(100);
this.setShowAttribs(true);
this.setIndentSize(35);
this.setExpanded(true);
//this.setCollapseText(false);
this.setCommentColor(new Color(224, 224, 224));
this.setFont(new java.awt.Font("Dialog", 0, 12));
this.setTextColor(Color.yellow);
this.setAttribColor(new Color(255, 255, 219));
this.setElementColor(Color.white);
this.setOpaque(true);
this.setDoubleBuffered(false);
this.getViewport().setBackground(Color.white);
this.setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_ALWAYS);
this.setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_ALWAYS);
}
public void reset() {
reset = true;
}
public void setDocWrapper(DocWrapper doc) {
reset = this.doc != doc;
this.doc = doc;
}
public boolean isCutEnabled() {
return false;
}
public void cut() {
/** @todo This */
}
public boolean isCopyEnabled() {
return false;
}
public void copy() {
/** @todo This */
}
public boolean isPasteEnabled() {
return false;
}
public void paste() {
/** @todo This */
}
public boolean isUndoEnabled() {
return false;
}
public void undo() {
/** @todo This */
}
public void find() {
/** @todo This */
}
public void findNext() {
/** @todo This */
}
public boolean isBeautifyEnabled() {
return false;
}
public void beautify() {
/** @todo This */
}
public DocWrapper getDocWrapper() {
return doc;
}
public void activate(boolean readOnly) {
if ( readOnly != isReadOnly() || reset ) {
Admin admin = Admin.getInstance();
admin.setCursor(Cursor.WAIT_CURSOR);
setReadOnly(readOnly);
super.setNode(doc.getNode());
setModified(false);
admin.setCursor(Cursor.DEFAULT_CURSOR);
}
}
public boolean deactivate() {
if ( isModified() )
doc.setNode(super.getNode());
return true;
}
}