Firefox demands to be default XML viewer

I occasionally have to work on XMLs for work, and I prefer to use my Arch laptop to do so. However, I cannot set the default XML reader to anything. As soon as I make a change, Firefox is set to the default again.
I'd like to set the default to gvim.

I'm using the GNOME DE with the Thunar file browser. If I open an XML by double-clicking, it opens with Firefox. If I right-click the file, Firefox is the top choice for applications to use. If I select "Open with other application" and set another as default (say gedit or vim), it will open with the program I chose, but the default will go right back. If I open up the file's properties and change the default, it goes right back to Firefox.

Similar Messages

  • How can I/Can I make Firefox the default .PDF viewer in Windows 7?

    For the basic PDF viewing I do, Adobe Reader is just slow and annoying. I love using Firefox, but unfortunately I cannot set it as the default program to open PDF files. Even when I select Firefox after right clicking and select open with, Windows does not comply. Is there a config option I can change that will allow me to set Firefox as the default PDF reader.
    Thank you for your help.

    You can not make Firefox the default for viewing PDF files for the entire Windows Operating System, only the default viewer from within Firefox. Like when PDF files that are downloaded from websites and displayed in Firefox; you can try using '''File > Open File''' from within Firefox to view PDF file that are already saved on that PC, but I'm not sure that will work - I haven't tried doing that.

  • How to enable the default pdf viewer of firefox after installing acrobat 11?

    I installed acrobat 11, and i dont like its pdf viewer add-on, so i want to switch back to firefox's default pdf viewe, but i cant change the action in the application option to preview in firefox. i also tried disabling the acrobat plugin.
    Firefox 27, windows 8.1,

    thanks for the help.

  • How can I reset the DEFAULT zoom view in Firefox at 125%, like IE, so I don't have to reset it every time ?

    How can I reset the DEFAULT zoom view in Firefox at 125%, like IE, so I don't have to reset it every time ?
    I have seen this question asked previously and it seems there is no answer.
    I know that one can change each individual web page (that reset defaults back to 100%) and, alternatively and apparently one can load an add-on to fix the default size at Full Zoom.
    ... But any hints on how to achieve a DEFAULT 125% zoom would be much appreciated.

    Press CTRL + 0
    Have you tried Firefox's zoom feature? Font size and zoom - increase the size of web pages
    You can "zoom" all sites using this add-on: [https://addons.mozilla.org/en-US/firefox/addon/2592/ NoSquint]. After setting your global zoom level, you can still fine-tune the zoom on individual sites.
    After installing NoSquint, click the % on the Add-on Bar to call up site preferences, then click the Global Settings button, then the Zooming tab.
    If you don't have the Add-on Bar displayed, you can right-click the new tab button ("+") or a blank area of the tab bar to the right of it and choose Add-on Bar from the shortcut menu.
    You can experiment with sizes larger than 125%, but I wouldn't go much higher than 150% unless you have a large high-resolution monitor.
    If there are particular sites that still present a problem, feel free to post their URLs.
    You can find more information about the zoom features Firefox offers in these articles:
    [[Text zoom]] - For zooming text only
    [[Page zoom]] - For zooming the whole page (including images etc.)

  • How to deploy disabled Firefox as the default PDF viewer via GPO

    I am trying to change the settings of 204 Windows 7 PCs. They all use Firefox and with have Adobe Acrobat XI. I would like to know how to use the Mozilla Administrative Template or how to create a GPO to change the default pdf viewer in Firefox to Acrobat XI.

    I'm having this problem too, except I'm trying to push it out to 400 PC's with 2-10 users per PC. i need a way to be able to configure it so when a user logs into the PC via our domain login Firefox will be automatically configured to open PDF's from Firefox in an Adobe Reader window, otherwise we have to manually configure it like FredMcD said, and that gets very frustrating after the 2nd PC

  • How to add .xml, .js and .css files to a xml viewer?

    Hi,
    I have a xml viewer in a web part to display a moving txt message. 
    I created a doc. library called XmlWebParts and in it 3 files with the same name. I am referring the xml file in the doc library with no issues. 
     WarningMessage.xml
    <script type="text/javascript" src="http://icare/sites/IT/tst/XmlWebParts/WarningMessage/WarningMessage.js"></script>
    <div class="marquee">jQuery marquee is the best marquee plugin in the world</div>
    <br/>
    <a class='p' href='#'>Pause</a> | <a class='r' href='#'>Resume</a>
    <link rel="stylesheet" type="text/css" href="http://icare/sites/IT/tst/XmlWebParts/WarningMessage/WarningMessage.css"/>
    WarningMessage.js
    var $mq = $('.marquee').marquee();
    //Pause
    $('.p').click(function(){
      $mq.marquee('pause');
    //Resume
    $('.r').click(function(){
      $mq.marquee('resume');
    and 
    WarningMessage.css
    .marquee {
      width: 300px;
      border: 1px solid #ccc;
      background: #ccc;
    The issue I am having is that the txt display with the formatting but is not moving, is just display the txt.
    I followed this: http://social.technet.microsoft.com/wiki/contents/articles/20764.sharepoint-2013-build-a-webpart-using-html-javascript-and-the-xml-viewer-web-part.aspx
    What I am doing wrong?

    Is not working for me.
    I have the
    WarningMessage.xml
    <script type="text/javascript" src="http://icare/sites/IT/tst/XmlWebParts/WarningMessage/WarningMessage.js"></script>
    WarningMessage.js
    <script type="text/javascript">
    <
    //set the marquee parameters
    function init() { rtl_marquee.start(); }
    var rtl_marquee_Text = 'JavaScript scrolling text';
    var rtl_marquee_Direction = 'left';
    var rtl_marquee_Contents='<span style="font-family:Comic Sans MS;font-size:12pt;white-space:nowrap;">' + rtl_marquee_Text + '</span>';
    rtl_marquee = new xbMarquee('rtl_marquee', '19px', '90%', 6, 100, rtl_marquee_Direction, 'scroll', rtl_marquee_Contents);
    window.setTimeout( init, 200);
    </script>
    xbMarquee.js
    document.writeln('<style type="text/css">');
    document.writeln(' div.marqueecenter1 { text-align: center; }');
    document.writeln(' div.marqueecenter2 { margin- margin-right: auto; }');
    document.writeln(' div.marqueeleft1 { text-align: left; }');
    document.writeln(' div.marqueeleft2 { margin- margin-right: auto; }');
    document.writeln(' div.marqueeright1 { text-align: right; }');
    document.writeln(' div.marqueeright2 { margin- margin-right: 0; }');
    document.writeln('</style>');
    function xbMarquee(id, height, width, scrollAmount, scrollDelay, direction, behavior, html)
      this.id            = id;
      this.scrollAmount  = scrollAmount ? scrollAmount : 6;
      this.scrollDelay   = scrollDelay ? scrollDelay : 85;
      this.direction     = direction ? direction.toLowerCase() : 'left';  
      this.behavior      = behavior ? behavior.toLowerCase() : 'scroll';  
    //  this.name          = 'xbMarquee_' + (++xbMarquee._name);
      this.name          = id;
      this.runId         = null;
      this.html          = html;
      this.isHorizontal = ('up,down'.indexOf(this.direction) == -1);
      if (typeof(height) == 'number')
        this.height = height;
        this.heightUnit = 'px';
      else if (typeof(height) == 'string')
        this.height = parseInt('0' + height, 10);
        this.heightUnit = height.toLowerCase().replace(/^[0-9]+/, '');
      else
        this.height = 100;
        this.heightUnit = 'px';
      if (typeof(width) == 'number')
        this.width = width;
        this.widthUnit = 'px';
      else if (typeof(width) == 'string')
        this.width = parseInt('0' + width, 10);
        this.widthUnit = width.toLowerCase().replace(/^[0-9]+/, '');
      else
        this.width = 100;
        this.widthUnit = 'px';
      // xbMarquee UI events
      this.onmouseover   = null;
      this.onmouseout    = null;
      this.onclick       = null;
      // xbMarquee state events
      this.onstart       = null;
      this.onbounce      = null;
      var markup = '';
      if (document.layers)
        markup = '<ilayer id="' + this.id + 'container" name="' + this.id + 'container" ' +
                 'height="' + height + '" ' +
                 'width="' + width + '"  ' +
                 'clip="' + width + ', ' + height + '" ' +
                 '>' + 
                 '<\/ilayer>';            
      else if (document.body && typeof(document.body.innerHTML) != 'string')
        markup = '<div id="' + this.id + 'container" name="' + this.id + 'container" ' +
                 'style=" ' + 
                 'height: ' + this.height + this.heightUnit + '; ' +
                 'width: ' + this.width + this.widthUnit + '; ' +
                 'clip: rect(0px, ' + this.width + this.widthUnit + ', ' + this.height + this.heightUnit + ', 0px); ' +
                 '">' + 
                 '<div id="' + this.id + '" style="' + 
                 (this.isHorizontal ? 'width:0px;' : '') + // if we scroll horizontally, make the text container as small as possible
                 '">' +
                 (this.isHorizontal ? '<nobr>' : '') +
                 this.html +
                 (this.isHorizontal ? '<\/nobr>' : '') +
                 '<\/div>' +
                 '<\/div>';             
      else 
        markup = '<div id="' + this.id + 'container" name="' + 
                 this.id + 'container" ' +
                 'style=" overflowY: visible; ' + 
                 'height: ' + this.height + this.heightUnit + '; ' +
                 'width: ' + this.width + this.widthUnit + '; ' +
                 'clip: rect(0px, ' + this.width + this.widthUnit + ', ' + this.height + this.heightUnit + ', 0px); ' +
                '">' + 
                 '<\/div>';             
      document.write(markup);  
      window[this.name] = this;
    // Class Properties/Methods
    xbMarquee._name = -1;
    xbMarquee._getInnerSize = function(elm, propName)
      var val = 0;
      if (document.layers)
        // navigator 4
        val = elm.document[propName];    
      else if (elm.style && typeof(elm.style[propName]) == 'number')
        // opera
        // bug in Opera 6 width/offsetWidth. Use clientWidth
        if (propName == 'width' && typeof(elm.clientWidth) == 'number')
          val = elm.clientWidth;
        else
          val =  elm.style[propName];
      else
        //mozilla and IE
        switch (propName)
        case 'height':
           if (typeof(elm.offsetHeight) == 'number')
             val =  elm.offsetHeight;
           break;
        case 'width':
           if (typeof(elm.offsetWidth) == 'number')
             val = elm.offsetWidth;                  
           break;
      return val;
    xbMarquee.getElm = function(id)
      var elm = null;
      if (document.getElementById)
        elm = document.getElementById(id);
      else
        elm = document.all[id];
      return elm;
    xbMarquee.dispatchUIEvent = function (event, marqueeName, eventName)
      var marquee = window[marqueeName];
      var eventAttr = 'on' + eventName;
      if (!marquee)
        return false;
      if (!event && window.event)
        event = window.event;
      switch (eventName)
      case 'mouseover':
      case 'mouseout':
      case 'click':
        if (marquee[eventAttr])
          return marquee['on' + eventName](event);
      return false;
    xbMarquee.createDispatchEventAttr = function (marqueeName, eventName)
      return 'on' + eventName + '="xbMarquee.dispatchUIEvent(event, \'' + marqueeName + '\', \'' + eventName + '\')" ';
    // Instance properties/methods
    xbMarquee.prototype.start = function ()
      var markup = '';
      this.stop();
      if (!this.dirsign)
        if (!document.layers)
          this.containerDiv = xbMarquee.getElm(this.id + 'container')
          if (typeof(this.containerDiv.innerHTML) != 'string')
            return;
          // adjust the container size before inner div is filled in
          // so IE will not hork the size of percentage units 
          var parentNode    = null;
          if (this.containerDiv.parentNode)
            parentNode = this.containerDiv.parentNode;
          else if (this.containerDiv.parentElement)
            parentNode = this.containerDiv.parentElement;
          if (parentNode && 
              typeof(parentNode.offsetHeight) == 'number' && 
              typeof(parentNode.offsetWidth) == 'number')
            if (this.heightUnit == '%')
              this.containerDiv.style.height = 
              parentNode.offsetHeight * (this.height/100) + 'px';
            if (this.widthUnit == '%')
              this.containerDiv.style.width = 
              parentNode.offsetWidth * (this.width/100) + 'px';
          markup += '<div id="' + this.id + '" name="' + this.id + '" ' +
            'style=" ' +
            //(this.isHorizontal ? 'width:0px;' : '') + // if we scroll horizontally, make the text container as small as possible
            '" ' +
            xbMarquee.createDispatchEventAttr(this.name, 'mouseover') +
            xbMarquee.createDispatchEventAttr(this.name, 'mouseout') +
            xbMarquee.createDispatchEventAttr(this.name, 'click') +
            '>' +
            (this.isHorizontal ? '<nobr>' : '') +
            this.html +
            (this.isHorizontal ? '<\/nobr>' : '') +
            '<\/div>';
          this.containerDiv.innerHTML = markup;
          this.div                    = xbMarquee.getElm(this.id);
          this.styleObj     = this.div.style;      
        else /* if (document.layers) */
          this.containerDiv = document.layers[this.id + 'container'];
          markup = 
            '<layer id="' + this.id + '" name="' + this.id + '" top="0" left="0" ' +
            xbMarquee.createDispatchEventAttr(this.name, 'mouseover') +
            xbMarquee.createDispatchEventAttr(this.name, 'mouseout') +
            xbMarquee.createDispatchEventAttr(this.name, 'click') +
            '>' +
            (this.isHorizontal ? '<nobr>' : '') + 
            this.html +
            (this.isHorizontal ? '<\/nobr>' : '') +
            '<\/layer>';
          this.containerDiv.document.write(markup);
          this.containerDiv.document.close();
          this.div          = this.containerDiv.document.layers[this.id];
          this.styleObj     = this.div;
        if (this.isHorizontal && this.height < xbMarquee._getInnerSize(this.div, 'height') )
          this.height = xbMarquee._getInnerSize(this.div, 'height')
          this.containerDiv.style.height = this.height + this.heightUnit;
          this.containerDiv.style.clip = 'rect(0px, ' + this.width + this.widthUnit + ', ' + this.height + this.heightUnit + ', 0px)';
        // Start must not run until the page load event has fired
        // due to Internet Explorer not setting the height and width of 
        // the dynamically written content until then
        switch (this.direction)
        case 'down':
          this.dirsign = 1;
          this.startAt = -xbMarquee._getInnerSize(this.div, 'height');
          this._setTop(this.startAt);
          if (this.heightUnit == '%')
            this.stopAt = this.height * xbMarquee._getInnerSize(this.containerDiv, 'height') / 100;
          else
            this.stopAt  = this.height;
          break;
        case 'up':
          this.dirsign = -1;
          if (this.heightUnit == '%')
            this.startAt = this.height * xbMarquee._getInnerSize(this.containerDiv, 'height') / 100;
          else     
            this.startAt = this.height;
          this._setTop(this.startAt);
          this.stopAt  = -xbMarquee._getInnerSize(this.div, 'height');      
          break;
        case 'right':
          this.dirsign = 1;
          this.startAt = -xbMarquee._getInnerSize(this.div, 'width');
          this._setLeft(this.startAt);
          if (this.widthUnit == '%')
            this.stopAt = this.width * xbMarquee._getInnerSize(this.containerDiv, 'width') / 100;
          else    
            this.stopAt  = this.width;
          break;
        case 'left':
        default:
          this.dirsign = -1;
    if (this.widthUnit == '%')
    this.startAt = this.width * xbMarquee._getInnerSize(this.containerDiv, 'width') / 100;
    else  
    this.startAt = this.width        
    this._setLeft(this.startAt);
    // this.stopAt  = -xbMarquee._getInnerSize(this.div,'width')*2;
    // this method does not work very well with FireFox.  offsetWidth property used in this function returns the absolute width of the div container
    // instead of the new offsetWidth when innerHTML is added or when the div becomes wider. To overcome this a new span element is added to 
    // the document body to measure the new offsetwidth and then it is removed.
    var temp_span = document.createElement('span');     
    temp_span.id = 'span_' + this.div.id;
    temp_span.innerHTML = this.html;
    document.body.appendChild(temp_span);                
    this.stopAt = - temp_span.firstChild.firstChild.offsetWidth;
    document.body.removeChild(temp_span);            
          break;
        this.newPosition          = this.startAt;
        this.styleObj.visibility = 'visible'; 
      this.newPosition += this.dirsign * this.scrollAmount;
      if ( (this.dirsign == 1  && this.newPosition > this.stopAt) ||
           (this.dirsign == -1 && this.newPosition < this.stopAt) )
        if (this.behavior == 'alternate')
          if (this.onbounce)
            // fire bounce when alternate changes directions
            this.onbounce();
          this.dirsign = -this.dirsign;
          var temp     = this.stopAt;
          this.stopAt  = this.startAt;
          this.startAt = temp;
        else
          // fire start when position is a start
          if (this.onstart)
            this.onstart();
          this.newPosition = this.startAt;
      switch(this.direction)
        case 'up': 
        case 'down':
          this._setTop(this.newPosition);
          break;
        case 'left': 
        case 'right':
        default:
          this._setLeft(this.newPosition);
          break;
      this.runId = setTimeout(this.name + '.start()', this.scrollDelay);
    xbMarquee.prototype.stop = function ()
      if (this.runId)
        clearTimeout(this.runId);
      this.runId = null;
    xbMarquee.prototype.setInnerHTML = function (html)
      if (typeof(this.div.innerHTML) != 'string')
        return;
      var running = false;
      if (this.runId)
        running = true;
        this.stop();
      this.html = html;
      this.dirsign = null;
      if (running)
        this.start();
    // fixes standards mode in gecko
    // since units are required
    if (document.layers)
      xbMarquee.prototype._setLeft = function (left)
        this.styleObj.left = left;    
      xbMarquee.prototype._setTop = function (top)
        this.styleObj.top = top;    
    else
      xbMarquee.prototype._setLeft = function (left)
        this.styleObj.left = left + 'px';    
      xbMarquee.prototype._setTop = function (top)
        this.styleObj.top = top + 'px';    
    Still not working. Nothing will display on my web part xml viewer.

  • Default xml namespace = v hangs app

    This is probably due to my relative inexperience with Flex (using FlashBuilder 4.5 and Flex SDK 3.6) but I've got an app that is acting strangely and I'd like to find out what's wrong.
    Briefly, I'm trying to parse some XML (returned from a REST service) and, within a private function, am creating a namespace (call it v). I then use the directive default xml namespace = v. However, upon trying to launch and debug the app it hangs at application startup. The default directive is in a private function (actually a function called only when my HTTP service completes) of a component. Regardless, if I comment out the default directive the application works normally.
    Again, this function isn't even CALLED unless I essentially click a button to access the service, so I have absolutely no idea why it appears to be affecting the loading of my app.
    I have used Google to search for "Flex default xml namespace hangs app" but have found only one reference (in passing, with no solution offered).
    Thanks for any pointers.

    I will try at some point but I can't cut down my current app to do it, it's just too large.
    However, I did debug the app and I saw what the problem is. My view component, located in (for example) com.xyz.myapp.view, loads several other components, all located in com.xyz.myapp.components. As a result, the Panel component in the View contains  (among other directives) xmlns:components="com.xyz.myapp.components.*". Both the namespace variable v and the default xml namespace directive are in a private function in one of the components the main view loads. When I ran the app under the debugger it terminated almost immediately with "Error 1065: variable com.xyz.mypp.components::v is not defined".
    That's all I can tell you for now.
    Thanks for the reply.

  • The default PDF viewer does not work

    I understand Firefox has a default PDF viewer, but it is not working on my Mac OS 10.6.8. When I click on a pdf document, nothing happens.

    When you click a link to a PDF you get a blank page, or a black background with an empty progress bar, or you get absolutely nothing at all?
    Can you try changing your setting as described in the following article to launch the PDF outside Firefox and see whether that works? After that test, you can change back and try the internal viewer again. [[How to disable the built-in PDF viewer and use another viewer]]
    Any luck?

  • How can i edit default XML in Poratl?

    How can i edit default XML in Poratl?
    I want make some change on Discussion.xml,but i can't find it and  i  want Edit it, what should i do?
    Thank you very much for your Help!
    Best Regards!
    Han

    all the .XML files will be available in the following path
    project(folder)->dist(folder)->portal-inf(folder)
    in NetWeaver developer studio.
    to edit double click on the xml file and select the source tab in the bottom,you can view and edit the source.

  • How to add processing instruction to my XML view

    Hi,
    How do I add the processing instruction like &lt;?xml version="1.0" encoding="iso-8859-1"?&gt;.
    in my XML view.

    The only way to do at the moment is as follows... And it's not very pretty. The SQL/XML standard is still finalizing the correct way of doing this...
    set echo on
    connect &1/&2@&3
    create or replace view EMPLOYEES_WORKBOOK_XML of xmltype
    xmlschema "excel.xsd" element "Workbook"
    with object id
    'EMPLOYEES_WORKBOOK_XML'
    as
    select
    xmltype(
    '<?xml version="1.0"?>' ||
    xmlElement
    "Workbook",
    xmlAttributes
    'urn:schemas-microsoft-com:office:spreadsheet' as "xmlns",
    'urn:schemas-microsoft-com:office:office' as "xmlns:o",
    'urn:schemas-microsoft-com:office:excel' as "xmlns:x",
    'urn:schemas-microsoft-com:office:spreadsheet' as "xmlns:ss",
    'http://www.w3.org/TR/REC-html40' as "xmlns:html",
    'http://www.w3.org/2001/XMLSchema-instance' as "xmlns:xsi",
    'excel.xsd' as "xsi:noNamespaceSchemaLocation"
    xmlElement
    "DocumentProperties",
    xmlAttributes('urn:schemas-microsoft-com:office:office' as "xmlns"),
    xmlForest
    USER as "Author",
    USER as "LastAuthor",
    '2002-10-11T15:47:35Z' as "Created",
    'Oracle Corporation' as "Company",
    '10.350' as "Version"
    xmlElement
    "OfficeDocumentSettings",
    xmlAttributes('urn:schemas-microsoft-com:office:office' as "xmlns"),
    xmlElement("DownloadComponents"),
    xmlElement
    "LocationOfComponents",
    xmlAttributes('file://' as "HRef")
    xmlElement
    "ExcelWorkbook",
    xmlAttributes('urn:schemas-microsoft-com:office:excel' as "xmlns"),
    xmlForest
    '8835' as "WindowHeight",
    '14220' as "WindowWidth",
    '480' as "WindowTopX",
    '60' as "WindowTopY",
    'False' as "ProtectStructure",
    'False' as "ProtectWindows"
    xmlElement
    "Styles",
    xmlElement
    "Style",
    xmlAttributes('Default' as "ss:ID",'Normal' as "ss:Name"),
    xmlElement("Alignment",xmlAttributes('Bottom' as "ss:Vertical")),
    xmlElement("Borders"),
    xmlElement("Font"),
    xmlElement("Interior"),
    xmlElement("NumberFormat"),
    xmlElement("Protection")
    xmlElement
    "Style",
    xmlAttributes('s21' as "ss:ID"),
    xmlElement("Font",xmlAttributes('Swiss' as "x:Family",'1' as "ss:Bold"))
    xmlElement
    "Worksheet",
    xmlAttributes('EMP' as "ss:Name"),
    xmlElement
    "Table",
    xmlAttributes('11' as "ss:ExpandedColumnCount",'108' as "ss:ExpandedRowCount",'1' as "x:FullColumns",'1' as "x:FullRows"),
    xmlElement
    "Row",
    xmlAttributes('s21' as "ss:StyleID"),
    xmlElement("Cell", xmlElement("Data", xmlAttributes('String' as "ss:Type"), 'Employee ID')),
    xmlElement("Cell", xmlElement("Data", xmlAttributes('String' as "ss:Type"), 'First Name')),
    xmlElement("Cell", xmlElement("Data", xmlAttributes('String' as "ss:Type"), 'Last Name')),
    xmlElement("Cell", xmlElement("Data", xmlAttributes('String' as "ss:Type"), 'Email Address' )),
    xmlElement("Cell", xmlElement("Data", xmlAttributes('String' as "ss:Type"), 'Phone Number' )),
    xmlElement("Cell", xmlElement("Data", xmlAttributes('String' as "ss:Type"), 'Hire Date')),
    xmlElement("Cell", xmlElement("Data", xmlAttributes('String' as "ss:Type"), 'Job Title')),
    xmlElement("Cell", xmlElement("Data", xmlAttributes('String' as "ss:Type"), 'Salary')),
    xmlElement("Cell", xmlElement("Data", xmlAttributes('String' as "ss:Type"), 'Commission Rate')),
    xmlElement("Cell", xmlElement("Data", xmlAttributes('String' as "ss:Type"), 'Manager')),
    xmlElement("Cell", xmlElement("Data", xmlAttributes('String' as "ss:Type"), 'Department'))
    xmlagg
    xmlElement
    "Row",
    xmlAttributes('Default' as "ss:StyleID"),
    xmlElement("Cell", xmlElement("Data", xmlAttributes('Number' as "ss:Type"), e.EMPLOYEE_ID)),
    xmlElement("Cell", xmlElement("Data", xmlAttributes('String' as "ss:Type"), e.FIRST_NAME )),
    xmlElement("Cell", xmlElement("Data", xmlAttributes('String' as "ss:Type"), e.LAST_NAME )),
    xmlElement("Cell", xmlElement("Data", xmlAttributes('String' as "ss:Type"), e.EMAIL )),
    xmlElement("Cell", xmlElement("Data", xmlAttributes('String' as "ss:Type"), e.PHONE_NUMBER )),
    xmlElement("Cell", xmlElement("Data", xmlAttributes('DateTime' as "ss:Type"), to_char(to_char(e.HIRE_DATE,'YYYY-MM-DD"T00:00:00.000"')))),
    xmlElement("Cell", xmlElement("Data", xmlAttributes('String' as "ss:Type"), JOB_TITLE)),
    xmlElement("Cell", xmlElement("Data", xmlAttributes('Number' as "ss:Type"), e.SALARY )),
    xmlElement("Cell", xmlElement("Data", xmlAttributes('Number' as "ss:Type"), e.COMMISSION_PCT)),
    xmlElement("Cell", xmlElement("Data", xmlAttributes('String' as "ss:Type"), m.FIRST_NAME || ' ' || m.LAST_NAME )),
    xmlElement("Cell", xmlElement("Data", xmlAttributes('String' as "ss:Type"), DEPARTMENT_NAME )) )
    xmlElement
    "WorksheetOptions",
    xmlAttributes('urn:schemas-microsoft-com:office:excel' as "xmlns"),
    xmlElement
    "Print",
    xmlElement("ValidPrintInfo"),
    xmlElement("HorizontalResolution",96),
    xmlElement("VerticalResolution",96),
    xmlElement("NumberOfCopies",0)
    xmlElement("Selected"),
    xmlElement
    "Panes",
    xmlElement
    "Pane",
    xmlElement("Number",3),
    xmlElement("ActiveRow",6),
    xmlElement("ActiveCol",1)
    xmlElement("ProectedObjects",'False'),
    xmlElement("ProectedSecenarios",'False')
    ).getClobVal())
    from HR.EMPLOYEES e, HR.JOBS j, HR.DEPARTMENTS d, HR.EMPLOYEES m
    where e.JOB_ID = j.JOB_ID
    and e.DEPARTMENT_ID = d.DEPARTMENT_ID
    and e.MANAGER_ID = m.EMPLOYEE_ID
    pause
    create or replace trigger IGNORE_IO_OPERATIONS
    instead of INSERT or UPDATE or DELETE on EMPLOYEES_WORKBOOK_XML
    begin
    null;
    end;
    show errors
    pause
    quit

  • JTree XML Viewer

    Hi all
    i found this great article http://www.javalobby.org/java/forums/m91839339.html on Xml Viewer.
    But i dont understand how i can use it for JTreeTable because JTreeTable needs a TreeTableModel but
    i have a XMLTableModel .
    Anyone has used it?
    Thanks!!

    Hi all i try to modify the example that i find to make the tree editable but it not works...
    The main
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.event.InputEvent;
    import java.awt.event.MouseEvent;
    import java.util.EventObject;
    import javax.swing.JScrollPane;
    public class MyTreeTable extends JTreeTable{
        public MyTreeTable(TreeTableModel treeTableModel){
            super(treeTableModel);
            setShowGrid(true);
            setGridColor(new Color(234, 234, 234));
            new TableColumnResizer(this);
           // setDefaultRenderer(XMLTreeTableModel.class, new  XMLTreeTableCellRenderer());
            setIntercellSpacing(new Dimension(1, 1));
        public boolean editCellAt(int row, int column, EventObject e){
            if(e instanceof MouseEvent){
                MouseEvent me = (MouseEvent)e;
                // If the modifiers are not 0 (or the left mouse button),
                // tree may try and toggle the selection, and table
                // will then try and toggle, resulting in the
                // selection remaining the same. To avoid this, we
                // only dispatch when the modifiers are 0 (or the left mouse
                // button).
                if(me.getModifiers()==0 ||
                        me.getModifiers()==InputEvent.BUTTON1_MASK){
                    for(int counter = getColumnCount()-1; counter>= 0;
                        counter--){
                        if(getColumnClass(counter)==TreeTableModel.class){
                            MouseEvent newME = new MouseEvent
                                    (tree, me.getID(),
                                            me.getWhen(), me.getModifiers(),
                                            me.getX()-getCellRect(0, counter, true).x,
                                            me.getY(), me.getClickCount(),
                                            me.isPopupTrigger());
                            tree.dispatchEvent(newME);
                            break;
                return false;
            return super.editCellAt(row, column, e);
        public void changeSelection(int row, int column, boolean toggle, boolean extend) {
            if(getCursor()==TableColumnResizer.resizeCursor)
                return;
            super.changeSelection(row, column, toggle, extend);
    }The editor
    import java.util.EventObject;
    import javax.swing.CellEditor;
    import javax.swing.event.CellEditorListener;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.EventListenerList;
    public class AbstractCellEditor implements CellEditor {
        protected EventListenerList listenerList = new EventListenerList();
        public Object getCellEditorValue() { return null; }
        public boolean isCellEditable(EventObject e) { return true; }
        public boolean shouldSelectCell(EventObject anEvent) { return false; }
        public boolean stopCellEditing() { return true; }
        public void cancelCellEditing() {}
        public void addCellEditorListener(CellEditorListener l) {
         listenerList.add(CellEditorListener.class, l);
        public void removeCellEditorListener(CellEditorListener l) {
         listenerList.remove(CellEditorListener.class, l);
         * Notify all listeners that have registered interest for
         * notification on this event type. 
         * @see EventListenerList
        protected void fireEditingStopped() {
         // Guaranteed to return a non-null array
         Object[] listeners = listenerList.getListenerList();
         // Process the listeners last to first, notifying
         // those that are interested in this event
         for (int i = listeners.length-2; i>=0; i-=2) {
             if (listeners==CellEditorListener.class) {
              ((CellEditorListener)listeners[i+1]).editingStopped(new ChangeEvent(this));
    * Notify all listeners that have registered interest for
    * notification on this event type.
    * @see EventListenerList
    protected void fireEditingCanceled() {
         // Guaranteed to return a non-null array
         Object[] listeners = listenerList.getListenerList();
         // Process the listeners last to first, notifying
         // those that are interested in this event
         for (int i = listeners.length-2; i>=0; i-=2) {
         if (listeners[i]==CellEditorListener.class) {
              ((CellEditorListener)listeners[i+1]).editingCanceled(new ChangeEvent(this));
    XML Parserimport javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    import javax.xml.transform.OutputKeys;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMResult;
    import javax.xml.transform.sax.SAXSource;
    import org.w3c.dom.Document;
    import org.xml.sax.InputSource;
    import org.xml.sax.XMLReader;
    public class DOMUtil{
    public static Document createDocument(InputSource is) throws Exception{
    SAXParserFactory saxFactory = SAXParserFactory.newInstance();
    SAXParser parser = saxFactory.newSAXParser();
    XMLReader reader = new XMLTrimFilter(parser.getXMLReader());
    TransformerFactory factory = TransformerFactory.newInstance();
    Transformer transformer = factory.newTransformer();
    transformer.setOutputProperty(OutputKeys.INDENT, "no");
    DOMResult result = new DOMResult();
    transformer.transform(new SAXSource(reader, is), result);
    return (Document)result.getNode();
    } The treeimport java.awt.Color;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Rectangle;
    import java.awt.event.InputEvent;
    import java.awt.event.MouseEvent;
    import java.util.EventObject;
    import javax.swing.DefaultCellEditor;
    import javax.swing.Icon;
    import javax.swing.JTable;
    import javax.swing.JTextField;
    import javax.swing.JTree;
    import javax.swing.ListSelectionModel;
    import javax.swing.LookAndFeel;
    import javax.swing.UIManager;
    import javax.swing.border.Border;
    import javax.swing.event.ListSelectionEvent;
    import javax.swing.event.ListSelectionListener;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import javax.swing.tree.DefaultTreeSelectionModel;
    import javax.swing.tree.TreeCellRenderer;
    import javax.swing.tree.TreeModel;
    import javax.swing.tree.TreePath;
    public class JTreeTable extends JTable {
         /** A subclass of JTree. */
         protected TreeTableCellRenderer tree;
         public JTreeTable(TreeTableModel treeTableModel) {
              super();
              // Creates the tree. It will be used as a renderer and editor.
              tree = new TreeTableCellRenderer(treeTableModel);
              // Installs a tableModel representing the visible rows in the tree.
              super.setModel(new TreeTableModelAdapter(treeTableModel, tree));
              tree.setCellRenderer(new XMLTreeTableCellRenderer());
              // Forces the JTable and JTree to share their row selection models.
              ListToTreeSelectionModelWrapper selectionWrapper = new ListToTreeSelectionModelWrapper();
              tree.setSelectionModel(selectionWrapper);
              setSelectionModel(selectionWrapper.getListSelectionModel());
              // Installs the tree editor renderer and editor.
              setDefaultRenderer(TreeTableModel.class, tree);
              setDefaultEditor(TreeTableModel.class, new TreeTableCellEditor());
              // No grid.
              setShowGrid(false);
              // No intercell spacing
              setIntercellSpacing(new Dimension(0, 0));
              // And update the height of the trees row to match that of
              // the table.
              if (tree.getRowHeight() < 1) {
                   // Metal looks better like this.
                   setRowHeight(20);
         * Overridden to message super and forward the method to the tree. Since the
         * tree is not actually in the component hierarchy it will never receive
         * this unless we forward it in this manner.
         public void updateUI() {
              super.updateUI();
              if (tree != null) {
                   tree.updateUI();
                   // Do this so that the editor is referencing the current renderer
                   // from the tree. The renderer can potentially change each time
                   // laf changes.
                   setDefaultEditor(TreeTableModel.class, new TreeTableCellEditor());
              // Use the tree's default foreground and background colors in the
              // table.
              LookAndFeel.installColorsAndFont(this, "Tree.background",
                        "Tree.foreground", "Tree.font");
         * Workaround for BasicTableUI anomaly. Make sure the UI never tries to
         * resize the editor. The UI currently uses different techniques to paint
         * the renderers and editors; overriding setBounds() below is not the right
         * thing to do for an editor. Returning -1 for the editing row in this case,
         * ensures the editor is never painted.
         public int getEditingRow() {
              return (getColumnClass(editingColumn) == TreeTableModel.class) ? -1
                        : editingRow;
         * Returns the actual row that is editing as <code>getEditingRow</code>
         * will always return -1.
         private int realEditingRow() {
              return editingRow;
         * This is overridden to invoke super's implementation, and then, if the
         * receiver is editing a Tree column, the editor's bounds is reset. The
         * reason we have to do this is because JTable doesn't think the table is
         * being edited, as <code>getEditingRow</code> returns -1, and therefore
         * doesn't automatically resize the editor for us.
         public void sizeColumnsToFit(int resizingColumn) {
              super.sizeColumnsToFit(resizingColumn);
              if (getEditingColumn() != -1
                        && getColumnClass(editingColumn) == TreeTableModel.class) {
                   Rectangle cellRect = getCellRect(realEditingRow(),
                             getEditingColumn(), false);
                   Component component = getEditorComponent();
                   component.setBounds(cellRect);
                   component.validate();
         * Overridden to pass the new rowHeight to the tree.
         public void setRowHeight(int rowHeight) {
              super.setRowHeight(rowHeight);
              if (tree != null && tree.getRowHeight() != rowHeight) {
                   tree.setRowHeight(getRowHeight());
         * Returns the tree that is being shared between the model.
         public JTree getTree() {
              return tree;
         * Overridden to invoke repaint for the particular location if the column
         * contains the tree. This is done as the tree editor does not fill the
         * bounds of the cell, we need the renderer to paint the tree in the
         * background, and then draw the editor over it.
         public boolean editCellAt(int row, int column, EventObject e) {
              boolean retValue = super.editCellAt(row, column, e);
              if (retValue && getColumnClass(column) == TreeTableModel.class) {
                   repaint(getCellRect(row, column, false));
              return retValue;
         * A TreeCellRenderer that displays a JTree.
         public class TreeTableCellRenderer extends JTree implements
                   TableCellRenderer {
              /** Last table/tree row asked to renderer. */
              protected int visibleRow;
              * Border to draw around the tree, if this is non-null, it will be
              * painted.
              protected Border highlightBorder;
              public TreeTableCellRenderer(TreeModel model) {
                   super(model);
              * updateUI is overridden to set the colors of the Tree's renderer to
              * match that of the table.
              public void updateUI() {
                   super.updateUI();
                   // Make the tree's cell renderer use the table's cell selection
                   // colors.
                   TreeCellRenderer tcr = getCellRenderer();
                   if (tcr instanceof DefaultTreeCellRenderer) {
                        DefaultTreeCellRenderer dtcr = ((DefaultTreeCellRenderer) tcr);
                        // For 1.1 uncomment this, 1.2 has a bug that will cause an
                        // exception to be thrown if the border selection color is
                        // null.
                        // dtcr.setBorderSelectionColor(null);
                        dtcr.setTextSelectionColor(UIManager
                                  .getColor("Table.selectionForeground"));
                        dtcr.setBackgroundSelectionColor(UIManager
                                  .getColor("Table.selectionBackground"));
              * Sets the row height of the tree, and forwards the row height to the
              * table.
              public void setRowHeight(int rowHeight) {
                   if (rowHeight > 0) {
                        super.setRowHeight(rowHeight);
                        if (JTreeTable.this != null
                                  && JTreeTable.this.getRowHeight() != rowHeight) {
                             JTreeTable.this.setRowHeight(getRowHeight());
              * This is overridden to set the height to match that of the JTable.
              public void setBounds(int x, int y, int w, int h) {
                   super.setBounds(x, 0, w, JTreeTable.this.getHeight());
              * Sublcassed to translate the graphics such that the last visible row
              * will be drawn at 0,0.
              public void paint(Graphics g) {
                   g.translate(0, -visibleRow * getRowHeight());
                   super.paint(g);
                   // Draw the Table border if we have focus.
                   if (highlightBorder != null) {
                        highlightBorder.paintBorder(this, g, 0, visibleRow
                                  * getRowHeight(), getWidth(), getRowHeight());
              * TreeCellRenderer method. Overridden to update the visible row.
              public Component getTableCellRendererComponent(JTable table,
                        Object value, boolean isSelected, boolean hasFocus, int row,
                        int column) {
                   Color background;
                   Color foreground;
                   if (isSelected) {
                        background = table.getSelectionBackground();
                        foreground = table.getSelectionForeground();
                   } else {
                        background = table.getBackground();
                        foreground = table.getForeground();
                   highlightBorder = null;
                   if (realEditingRow() == row && getEditingColumn() == column) {
                        background = UIManager.getColor("Table.focusCellBackground");
                        foreground = UIManager.getColor("Table.focusCellForeground");
                   } else if (hasFocus) {
                        highlightBorder = UIManager
                                  .getBorder("Table.focusCellHighlightBorder");
                        if (isCellEditable(row, column)) {
                             background = UIManager
                                       .getColor("Table.focusCellBackground");
                             foreground = UIManager
                                       .getColor("Table.focusCellForeground");
                   visibleRow = row;
                   setBackground(background);
                   TreeCellRenderer tcr = getCellRenderer();
                   if (tcr instanceof DefaultTreeCellRenderer) {
                        DefaultTreeCellRenderer dtcr = ((DefaultTreeCellRenderer) tcr);
                        if (isSelected) {
                             dtcr.setTextSelectionColor(foreground);
                             dtcr.setBackgroundSelectionColor(background);
                        } else {
                             dtcr.setTextNonSelectionColor(foreground);
                             dtcr.setBackgroundNonSelectionColor(background);
                   return this;
         * An editor that can be used to edit the tree column. This extends
         * DefaultCellEditor and uses a JTextField (actually, TreeTableTextField) to
         * perform the actual editing.
         * <p>
         * To support editing of the tree column we can not make the tree editable.
         * The reason this doesn't work is that you can not use the same component
         * for editing and renderering. The table may have the need to paint cells,
         * while a cell is being edited. If the same component were used for the
         * rendering and editing the component would be moved around, and the
         * contents would change. When editing, this is undesirable, the contents of
         * the text field must stay the same, including the caret blinking, and
         * selections persisting. For this reason the editing is done via a
         * TableCellEditor.
         * <p>
         * Another interesting thing to be aware of is how tree positions its render
         * and editor. The render/editor is responsible for drawing the icon
         * indicating the type of node (leaf, branch...). The tree is responsible
         * for drawing any other indicators, perhaps an additional +/- sign, or
         * lines connecting the various nodes. So, the renderer is positioned based
         * on depth. On the other hand, table always makes its editor fill the
         * contents of the cell. To get the allusion that the table cell editor is
         * part of the tree, we don't want the table cell editor to fill the cell
         * bounds. We want it to be placed in the same manner as tree places it
         * editor, and have table message the tree to paint any decorations the tree
         * wants. Then, we would only have to worry about the editing part. The
         * approach taken here is to determine where tree would place the editor,
         * and to override the <code>reshape</code> method in the JTextField
         * component to nudge the textfield to the location tree would place it.
         * Since JTreeTable will paint the tree behind the editor everything should
         * just work. So, that is what we are doing here. Determining of the icon
         * position will only work if the TreeCellRenderer is an instance of
         * DefaultTreeCellRenderer. If you need custom TreeCellRenderers, that don't
         * descend from DefaultTreeCellRenderer, and you want to support editing in
         * JTreeTable, you will have to do something similiar.
         public class TreeTableCellEditor extends DefaultCellEditor {
              public TreeTableCellEditor() {
                   super(new TreeTableTextField());
              * Overridden to determine an offset that tree would place the editor
              * at. The offset is determined from the <code>getRowBounds</code>
              * JTree method, and additionally from the icon DefaultTreeCellRenderer
              * will use.
              * <p>
              * The offset is then set on the TreeTableTextField component created in
              * the constructor, and returned.
              public Component getTableCellEditorComponent(JTable table,
                        Object value, boolean isSelected, int r, int c) {
                   Component component = super.getTableCellEditorComponent(table,
                             value, isSelected, r, c);
                   JTree t = getTree();
                   boolean rv = t.isRootVisible();
                   int offsetRow = rv ? r : r - 1;
                   Rectangle bounds = t.getRowBounds(offsetRow);
                   int offset = bounds.x;
                   TreeCellRenderer tcr = t.getCellRenderer();
                   if (tcr instanceof DefaultTreeCellRenderer) {
                        Object node = t.getPathForRow(offsetRow).getLastPathComponent();
                        Icon icon;
                        if (t.getModel().isLeaf(node))
                             icon = ((DefaultTreeCellRenderer) tcr).getLeafIcon();
                        else if (tree.isExpanded(offsetRow))
                             icon = ((DefaultTreeCellRenderer) tcr).getOpenIcon();
                        else
                             icon = ((DefaultTreeCellRenderer) tcr).getClosedIcon();
                        if (icon != null) {
                             offset += ((DefaultTreeCellRenderer) tcr).getIconTextGap()
                                       + icon.getIconWidth();
                   ((TreeTableTextField) getComponent()).offset = offset;
                   return component;
              * This is overridden to forward the event to the tree. This will return
              * true if the click count >= 3, or the event is null.
              public boolean isCellEditable(EventObject e) {
                   if (e instanceof MouseEvent) {
                        MouseEvent me = (MouseEvent) e;
                        // If the modifiers are not 0 (or the left mouse button),
                        // tree may try and toggle the selection, and table
                        // will then try and toggle, resulting in the
                        // selection remaining the same. To avoid this, we
                        // only dispatch when the modifiers are 0 (or the left mouse
                        // button).
                        if (me.getModifiers() == 0
                                  || me.getModifiers() == InputEvent.BUTTON1_MASK) {
                             for (int counter = getColumnCount() - 1; counter >= 0; counter--) {
                                  if (getColumnClass(counter) == TreeTableModel.class) {
                                       MouseEvent newME = new MouseEvent(
                                                 JTreeTable.this.tree, me.getID(), me
                                                           .getWhen(), me.getModifiers(), me
                                                           .getX()
                                                           - getCellRect(0, counter, true).x,
                                                 me.getY(), me.getClickCount(), me
                                                           .isPopupTrigger());
                                       JTreeTable.this.tree.dispatchEvent(newME);
                                       break;
                        if (me.getClickCount() >= 3) {
                             return true;
                        return false;
                   if (e == null) {
                        return true;
                   return false;
         * Component used by TreeTableCellEditor. The only thing this does is to
         * override the <code>reshape</code> method, and to ALWAYS make the x
         * location be <code>offset</code>.
         static class TreeTableTextField extends JTextField {
              public int offset;
              public void reshape(int x, int y, int w, int h) {
                   int newX = Math.max(x, offset);
                   super.reshape(newX, y, w - (newX - x), h);
         * ListToTreeSelectionModelWrapper extends DefaultTreeSelectionModel to
         * listen for changes in the ListSelectionModel it maintains. Once a change
         * in the ListSelectionModel happens, the paths are updated in the
         * DefaultTreeSelectionModel.
         class ListToTreeSelectionModelWrapper extends DefaultTreeSelectionModel {
              /** Set to true when we are updating the ListSelectionModel. */
              protected boolean updatingListSelectionModel;
              public ListToTreeSelectionModelWrapper() {
                   super();
                   getListSelectionModel().addListSelectionListener(
                             createListSelectionListener());
              * Returns the list selection model. ListToTreeSelectionModelWrapper
              * listens for changes to this model and updates the selected paths
              * accordingly.
              ListSelectionModel getListSelectionModel() {
                   return listSelectionModel;
              * This is overridden to set <code>updatingListSelectionModel</code>
              * and message super. This is the only place DefaultTreeSelectionModel
              * alters the ListSelectionModel.
              public void resetRowSelection() {
                   if (!updatingListSelectionModel) {
                        updatingListSelectionModel = true;
                        try {
                             super.resetRowSelection();
                        } finally {
                             updatingListSelectionModel = false;
                   // Notice how we don't message super if
                   // updatingListSelectionModel is true. If
                   // updatingListSelectionModel is true, it implies the
                   // ListSelectionModel has already been updated and the
                   // paths are the only thing that needs to be updated.
              * Creates and returns an instance of ListSelectionHandler.
              protected ListSelectionListener createListSelectionListener() {
                   return new ListSelectionHandler();
              * If <code>updatingListSelectionModel</code> is false, this will
              * reset the selected paths from the selected rows in the list selection
              * model.
              protected void updateSelectedPathsFromSelectedRows() {
                   if (!updatingListSelectionModel) {
                        updatingListSelectionModel = true;
                        try {
                             // This is way expensive, ListSelectionModel needs an
                             // enumerator for iterating.
                             int min = listSelectionModel.getMinSelectionIndex();
                             int max = listSelectionModel.getMaxSelectionIndex();
                             clearSelection();
                             if (min != -1 && max != -1) {
                                  for (int counter = min; counter <= max; counter++) {
                                       if (listSelectionModel.isSelectedIndex(counter)) {
                                            TreePath selPath = tree.getPathForRow(counter);
                                            if (selPath != null) {
                                                 addSelectionPath(selPath);
                        } finally {
                             updatingListSelectionModel = false;
              * Class responsible for calling updateSelectedPathsFromSelectedRows
              * when the selection of the list changse.
              class ListSelectionHandler implements ListSelectionListener {
                   public void valueChanged(ListSelectionEvent e) {
                        updateSelectedPathsFromSelectedRows();
    The resizerimport java.awt.Container;
    import java.awt.Cursor;
    import java.awt.Dimension;
    import java.awt.Point;
    import java.awt.Rectangle;
    import java.awt.event.MouseEvent;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JViewport;
    import javax.swing.event.MouseInputAdapter;
    import javax.swing.table.TableColumn;
    public class TableColumnResizer extends MouseInputAdapter{
    public static Cursor resizeCursor = Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR);
    private int mouseXOffset;
    private Cursor otherCursor = resizeCursor;
    private JTable table;
    public TableColumnResizer(JTable table){
    this.table = table;
    table.addMouseListener(this);
    table.addMouseMotionListener(this);
    private boolean canResize(TableColumn column){
    return column != null
    && table.getTableHeader().getResizingAllowed()
    && column.getResizable();
    private TableColumn getResizingColumn(Point p){
    return getResizingColumn(p, table.columnAtPoint(p));
    private TableColumn getResizingColumn(Point p, int column){
    if(column == -1){
    return null;
    int row = table.rowAtPoint(p);
    if(row==-1)
    return null;
    Rectangle r = table.getCellRect(row, column, true);
    r.grow( -3, 0);
    if(r.contains(p))
    return null;
    int midPoint = r.x + r.width / 2;
    int columnIndex;
    if(table.getTableHeader().getComponentOrientation().isLeftToRight())
    columnIndex = (p.x < midPoint) ? column - 1 : column;
    else
    columnIndex = (p.x < midPoint) ? column : column - 1;
    if(columnIndex == -1)
    return null;
    return table.getTableHeader().getColumnModel().getColumn(columnIndex);
    public void mousePressed(MouseEvent e){
    table.getTableHeader().setDraggedColumn(null);
    table.getTableHeader().setResizingColumn(null);
    table.getTableHeader().setDraggedDistance(0);
    Point p = e.getPoint();
    // First find which header cell was hit
    int index = table.columnAtPoint(p);
    if(index==-1)
    return;
    // The last 3 pixels + 3 pixels of next column are for resizing
    TableColumn resizingColumn = getResizingColumn(p, index);
    if(!canResize(resizingColumn))
    return;
    table.getTableHeader().setResizingColumn(resizingColumn);
    if(table.getTableHeader().getComponentOrientation().isLeftToRight())
    mouseXOffset = p.x - resizingColumn.getWidth();
    else
    mouseXOffset = p.x + resizingColumn.getWidth();
    private void swapCursor(){
    Cursor tmp = table.getCursor();
    table.setCursor(otherCursor);
    otherCursor = tmp;
    public void mouseMoved(MouseEvent e){
    if(canResize(getResizingColumn(e.getPoint()))
    != (table.getCursor() == resizeCursor)){
    swapCursor();
    public void mouseDragged(MouseEvent e){
    int mouseX = e.getX();
    TableColumn resizingColumn = table.getTableHeader().getResizingColumn();
    boolean headerLeftToRight =
    table.getTableHeader().getComponentOrientation().isLeftToRight();
    if(resizingColumn != null){
    int oldWidth = resizingColumn.getWidth();
    int newWidth;
    if(headerLeftToRight){
    newWidth = mouseX - mouseXOffset;
    } else{
    newWidth = mouseXOffset - mouseX;
    resizingColumn.setWidth(newWidth);
    Container container;
    if((table.getTableHeader().getParent() == null)
    || ((container = table.getTableHeader().getParent().getParent()) == null)
    || !(container instanceof JScrollPane)){
    return;
    if(!container.getComponentOrientation().isLeftToRight()
    && !headerLeftToRight){
    if(table != null){
    JViewport viewport = ((JScrollPane)container).getViewport();
    int viewportWidth = viewport.getWidth();
    int diff = newWidth - oldWidth;
    int newHeaderWidth = table.getWidth() + diff;
    /* Resize a table */
    Dimension tableSize = table.getSize();
    tableSize.width += diff;
    table.setSize(tableSize);
    * If this table is in AUTO_RESIZE_OFF mode and has a horizontal
    * scrollbar, we need to update a view's position.
    if((newHeaderWidth >= viewportWidth)
    && (table.getAutoResizeMode() == JTable.AUTO_RESIZE_OFF)){
    Point p = viewport.getViewPosition();
    p.x =
    Math.max(0, Math.min(newHeaderWidth - viewportWidth, p.x + diff));
    viewport.setViewPosition(p);
    /* Update the original X offset value. */
    mouseXOffset += diff;
    public void mouseReleased(MouseEvent e){
    table.getTableHeader().setResizingColumn(null);
    table.getTableHeader().setDraggedColumn(null);
    The mainimport java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.io.FileInputStream;
    import java.io.InputStream;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import org.xml.sax.InputSource;
    public class TreeTableExample0 {
         public static void main(String[] args) throws Exception {
              new TreeTableExample0();
         public TreeTableExample0() throws Exception {
              JFrame frame = new JFrame("TreeTable");
              InputStream inputStream = new FileInputStream("c:\\totali.xml");
              InputSource inputSource = new InputSource(inputStream);
              MyTreeTable treeTable = new MyTreeTable(new XMLTreeTableModel(DOMUtil
                        .createDocument(inputSource)));
              frame.addWindowListener(new WindowAdapter() {
                   public void windowClosing(WindowEvent we) {
                        System.exit(0);
              frame.getContentPane().add(new JScrollPane(treeTable));
              frame.pack();
              frame.show();
    The modelimport javax.swing.tree.TreeModel;
    public interface TreeTableModel extends TreeModel
    * Returns the number of available columns.
    public int getColumnCount();
    * Returns the name for column number <code>column</code>.
    public String getColumnName(int column);
    * Returns the type for column number <code>column</code>.
    public Class getColumnClass(int column);
    * Returns the value to be displayed for node <code>node</code>,
    * at column number <code>column</code>.
    public Object getValueAt(Object node

  • Changing the default associated view for a related entity

    A question from a peer:
    Hey there
    Do you know how in CRM 2015 to change the default associated view for a related entity?
    Say you are in an Account and from the menu open the opportunities for that account.
    That new pop up window states “Opportunity Associated View” I want to change that to “My Custom View”
    I thought we covered this in class years back but cannot remember

    There are a few ways to get what you want, the easiest being
    Create a document as you want it for a particular site, save it is junk.php or similar and create a new file by saving as this as the proper document name such as index.php
    Use the Dreamweaver template system, i.e. create a template with a .dwt.php extension like template.dwt.php and use that to create new pages.
    There are other ways like creating your own php template system. But you can put that in the too hard basket.

  • BI Publisher Report Build - XML view

    Hi Experts,
    I am trying to build the BI publisher report. During the process, I am defining the SQL query structure in the 'Query Builder' once after that I have saved the report.
    As part of the next step , I have clicked on 'view' link to view the report structure as mentioned in the OBE.
    I could only see the 'Data' view but not the 'XML' view. Is there any way I can see the 'XML' view.
    Any help would be appreciated
    Siva

    Data means look at the xml data that you have created.

  • Issues with setting "Maked Reader the default PDF viewer" with Adobe Customization Wizard XI

    I am using the Adobe Customization Wizard XI. I have set the following options in the Adobe Customization Wizard.
    Personalization Options
    Enabled the checkbox for Suppress display of End User License Agreement (EULA)
    Installation Options
    Selected the radio button for Make Reader the default PDF viewer
    Run Installation: selected radio button Silently(No Interface)
    Security
    Enhanced Security Settings - Clicked drop down and set value to Disable
    Online Services and Features
    Checked Disable product updates
    Checkd In Adobe Reader, disable Help > Purchase Adobe Acrobat
    Checked Disable Product Improvement Program
    Checked Disable Viewing of PDF with Ads for Adobe PDF
    Checked Disable all Adobe online services based workflows and entry points.
    I have tried to deploy the MSI with MST via GPO and Command Line with no luck.  Every time i deploy via below methods, the same result occurs, all of the options are set correctly except the "Make Reader the default PDF viewer".  I know how to manually set this option via Windows or Adobe interfaces but i am looking to roll this out to the masses and would not want a bunch of service desk calls because a user clicks on an Adobe PDF file and it is not opening in Adobe Reader.
    GPO
    Create New Package Use AcroRead.msi
    Choose Advanced
    Deployment Options - Click Uninstall this application when it falls out of the scope of management.
    Modifications - Select Transform file located in the folder of MSI
    Command Line.
    Tried these options to try and apply "Make Reader the default PDF viewer"
    msiexec /i  "<path>\AcroRead.msi" TRANSFORMS="<path>\TransformFile.mst"
    msiexec /i  "<path>\AcroRead.msi" TRANSFORMS="<path>\TransformFile.mst" /qn
    msiexec /i "<path>\AcroRead.msi" IW_DEFAULT_VERB=Read
    msiexec /i  "<path>\AcroRead.msi" TRANSFORMS="<path>\TransformFile.mst" IW_DEFAULT_VERB=Read /qn
    Anyone know how to make this setting work with the Transform file, i sure would appreciate assistance on this issue.

    Instead of saving as a PDF thru Work do a Print ➙ PDF ➙ Save as PDF and it will be saved the first time with the Preview icon.

  • How do I change the default PDF viewer on my iPad so I can easily see annotations?

    I keeping missing annotations on PDF because the built-in iPad Mail viewer does not show annotations.  To limit the keystrokes, instead of  using "open with" on each PDF email attachment to view in a third part app, I'd like to just change the mail default viewer. Is that possible with the current iPad operating systems?

    No it is not possible to change the default pdf viewer in mail.

Maybe you are looking for

  • Font problem in Pages

    Hello all, I installed some new fonts (Trajan, Minion and Caflisch if you want to know), working great in for example textedit, BUT in Pages when I change some text to these new fonts, the text is replaced with other letters ! The change is depending

  • Swing app keyboard stops working, mystery ESCAPE keystrokes appear in EDT

    Java 6 Swing app. In our development environment, works great. In QA, they use it for a bit, type in a text field, click out to a Windows XP/7 app, click back in the text field, and the keyboard stops accepting keystrokes. The mouse continues to work

  • How does the bacepanel control the control value of the front?

    I want to use a button as the control one in the front panel and use it as indicator one,I mean that the same button can be used as the controlor and the indicator! How can I do? Please tell me experts!Thanks

  • External firewire drive constant spin-down/up

    I often connect an external Lacie firewire drive to my MacBook Pro for regular time machine backups. When the drive is connected and I'm using my Mac, the drive is constantly spinning and in an 'awake' state. The drive remains in this state for as lo

  • Need to derive fiscal year from 0P_FPER

    Hello, I have a number of queries that are used to report amounts for a given period and also a YTD amount and a rolling 12 month amount.  I would like to be able to have the user pass just one variable, 0P_FPER, and then derive the fiscal year from