Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 67929 invoked from network); 26 Oct 2007 10:52:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Oct 2007 10:52:08 -0000 Received: (qmail 63610 invoked by uid 500); 26 Oct 2007 10:51:55 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 63262 invoked by uid 500); 26 Oct 2007 10:51:53 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 63253 invoked by uid 99); 26 Oct 2007 10:51:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Oct 2007 03:51:53 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [134.134.136.20] (HELO mga02.intel.com) (134.134.136.20) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Oct 2007 10:51:56 +0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 26 Oct 2007 03:51:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.21,332,1188802800"; d="scan'208";a="256111320" Received: from fmsmsx333.amr.corp.intel.com ([132.233.42.2]) by orsmga001.jf.intel.com with ESMTP; 26 Oct 2007 03:51:04 -0700 Received: from mssmsx411.ccr.corp.intel.com ([10.125.144.12]) by fmsmsx333.amr.corp.intel.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 26 Oct 2007 03:51:04 -0700 Content-class: urn:content-classes:message MIME-Version: 1.0 X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: RE: [classlib][swing] javax.swing.JComponent is not supposed to be imported by awt Date: Fri, 26 Oct 2007 14:51:01 +0400 Message-ID: In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [classlib][swing] javax.swing.JComponent is not supposed to be imported by awt Thread-Index: AcgXuaTvJIOpAu/4TYKfpALJXyJE1QAAq5ZQ From: "Maenkova, Evgeniya G" To: X-OriginalArrivalTime: 26 Oct 2007 10:51:04.0310 (UTC) FILETIME=[1AEE2960:01C817BE] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org >1) Please, tell me the advantages Don't need repeat in awt text component logic (I mean text drawing, caret behaviour, highlighter functionality, etc) >2) I understand and in some sence agree (my disagreement is - there is a >lot >of other places to improve - but my note is non-constructive at all) >UI do not loads with JComponent: Just UIManager and abstract ComponentUI. >All the plubbable look and feels are called by reflection. Please, don't >guilty UIs. Always we have something to be improved. :) JComponent has "import org.apache.harmony.x.swing.Utilities" ; package org.apache.harmony.x.swing.Utilities.has; import javax.swing.Icon; import javax.swing.InputMap; import javax.swing.JComponent; import javax.swing.JMenuBar;=20 import javax.swing.JPopupMenu; import javax.swing.KeyStroke; import javax.swing.LookAndFeel; import javax.swing.MenuElement; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.plaf.UIResource; import javax.swing.plaf.basic.BasicComboPopup; import javax.swing.plaf.basic.BasicGraphicsUtils; import javax.swing.text.Position; JMenuBar-> import javax.swing.plaf.MenuBarUI; Just the simplest chain. But situation isn't trivial. And we can find more :) >3) Why this classes directly used in swing? This is inconvinient decision >for my opinion >I think this is an area of improvement - because it makes harder to work >with text in JComponents (the example I wrote above) but I cannot help with >it now. Yeah, we have always something to be improved. >But I think that search all the "swing" words in awt module will be good >step to improve both modules. Thanks to you and Alexey for this idea. Then I'm surprised :) What is your point then? I happy we reached agreement. Thanks, Evgeniya -----Original Message----- From: Dmitry Irlyanov [mailto:irlyanov@gmail.com]=20 Sent: Friday, October 26, 2007 2:18 PM To: dev@harmony.apache.org Subject: Re: [classlib][swing] javax.swing.JComponent is not supposed to be imported by awt Yes, I understand, thank you. My notes is: 1) Please, tell me the advantages 2) I understand and in some sence agree (my disagreement is - there is a lot of other places to improve - but my note is non-constructive at all) UI do not loads with JComponent: Just UIManager and abstract ComponentUI. All the plubbable look and feels are called by reflection. Please, don't guilty UIs. 3) Why this classes directly used in swing? This is inconvinient decision for my opinion I think this is an area of improvement - because it makes harder to work with text in JComponents (the example I wrote above) but I cannot help with it now. But I think that search all the "swing" words in awt module will be good step to improve both modules. Thanks to you and Alexey for this idea. 2007/10/26, Maenkova, Evgeniya G : > > I told you what it suggested to be 'by design'. > > 1) reuse some swing logic regarding text component; > This approach has both advantages and disadvantages. The decision was do > it this way. > 2) don't use JComponent, as it automatically loads all swing, UIs, etc. > 3) for (2) there was TextUtils and TextKit, in particular. > > The idea is: don't use all swing (=3D=3DJComponent) while you need only awt. > If you are working in this area now, you are welcome to make any > improvements. > > > >And (shame on me!) I cannot understand the 'heavy' and 'light' terms - > if > >this is a performance issue why we look here and doesn't look at event > >queue > >that unoptimised at all. > > Sure, we will look everywhere. > > Thanks, > Evgeniya > > -----Original Message----- > From: Dmitry Irlyanov [mailto:irlyanov@gmail.com] > Sent: Friday, October 26, 2007 1:15 PM > To: dev@harmony.apache.org > Subject: Re: [classlib][swing] javax.swing.JComponent is not supposed to > be imported by awt > > awt is independent from swing module (at least in theory) If the method > used > in swing only - what it does in awt module? > > The main question for me is: why the awt.text.TextUtils performs so > important role? > > As far as I remember this class makes more than it needed in awt. A lot > of > work that should be implemeted in swing for me. Why I should think about > TextKit (close friend of TextUtils) when I implement, say, html > processing > in JComponents? Furthermore, why I should implement it because the > TextKit > and TextUtils are implementation-specific classes and all the previous > (In > JEditorPane, say) implementations are hidden. What the reason of > harmony-specific way here? > > And (shame on me!) I cannot understand the 'heavy' and 'light' terms - > if > this is a performance issue why we look here and doesn't look at event > queue > that unoptimised at all. > > 2007/10/26, Maenkova, Evgeniya G : > > > > The point is: there is pretty big difference between references to > some > > classes with logic (like Document, Caret, etc) and references to > > JComponent. > > > > If you use JComponent in awt it increases startup time (as a pretty > big > > part of swing is loaded actually) and makes awt text component > heavier. > > > > 'Model' classes are pretty light. They don't load all swing. > > > > The idea was reuse in awt some swing logic, common for all text > > component, w/o loading swing per se. > > > > Thanks, > > Evgeniya > > > > > > > > -----Original Message----- > > From: Alexey Petrenko [mailto:alexey.a.petrenko@gmail.com] > > Sent: Friday, October 26, 2007 11:28 AM > > To: dev@harmony.apache.org > > Subject: Re: [classlib][swing] javax.swing.JComponent is not supposed > to > > be imported by awt > > > > As far as I remember we have one implementation of text processing > > routines for awt and swing. That's why awt code could reference swing > > classes. > > > > I'll take a look... > > > > SY, Alexey > > > > 2007/10/26, Alexei Fedotov : > > > Hello, > > > > > > I'm currently looking through the swing and awt code to find out > what > > > should be done to make drag and drop work. Today I find out that the > > > class org.apache.harmony.awt.text.TextUtils contains nearly the same > > > functionality as javax.swing.TransferHandler [2]. Thanks to Evgeniya > > > Maenkova! She explained me that AWT cannot reuse > > > javax.swing.TransferHandler due to referenced javax.swing.JComponent > > > which is heavy class. I have looked through the dev@ list and > couldn't > > > find that this core principle of our client API was referenced here > > > before. > > > > > > Finally I've prepared a patch to remove another existing reference > to > > > JComponent from org.apache.harmony.awt.text.TextUtils [1]. Could > > > anyone review and commit the patch? > > > > > > Thanks! > > > > > > [1] https://issues.apache.org/jira/browse/HARMONY-5023 > > > [2] > > > org.apache.harmony.awt.text.TextUtils: > > > public static final boolean importData(final TextKit textKit, > > > final Transferable t) { > > > > > > if (t =3D=3D null) { > > > return false; > > > } > > > DataFlavor[] flavors =3D t.getTransferDataFlavors(); > > > DataFlavor flavor =3D null; > > > for (DataFlavor element : flavors) { > > > flavor =3D element; > > > if > > (String.class.isAssignableFrom(flavor.getRepresentationClass())) > > > { > > > break; > > > } > > > flavor =3D null; > > > } > > > if (flavor !=3D null) { > > > try { > > > String text =3D (String) t.getTransferData(flavor); > > > textKit.replaceSelectedText(text); > > > return true; > > > } catch (UnsupportedFlavorException e) { > > > return false; > > > } catch (IOException e) { > > > return false; > > > } > > > } > > > return false; > > > } > > > > > > javax.swing.TransferHandler: > > > public boolean importData(final JComponent c, > > > final Transferable t) { > > > PropertyDescriptor descriptor =3D getPropertyDescriptor(c); > > > if (descriptor =3D=3D null) { > > > return false; > > > } > > > Class propertyType =3D descriptor.getPropertyType(); > > > DataFlavor flavor =3D getPrefferedFlavor(t, propertyType); > > > if (flavor =3D=3D null) { > > > return false; > > > } > > > > > > try { > > > Object value =3D t.getTransferData(flavor); > > > Method writer =3D descriptor.getWriteMethod(); > > > writer.invoke(c, new Object[]{value}); > > > return true; > > > } catch (UnsupportedFlavorException e) { > > > } catch (IOException e) { > > > } catch (InvocationTargetException e) { > > > } catch (IllegalAccessException e) { > > > } > > > return false; > > > } > > > > > > > > > > > > > > > -- > > > With best regards, > > > Alexei, > > > ESSD, Intel > > > > > -------------------------------------------------------------------- > > Closed Joint Stock Company Intel A/O > > Registered legal address: 125252, Moscow, Russian Federation, > > Chapayevsky Per, 14. > > > > This e-mail and any attachments may contain confidential material for > > the sole use of the intended recipient(s). Any review or distribution > > by others is strictly prohibited. If you are not the intended > > recipient, please contact the sender and delete all copies. > > > > > > -- > _______________ > With Best Regards, > Irlyanov Dmitry > -------------------------------------------------------------------- > Closed Joint Stock Company Intel A/O > Registered legal address: 125252, Moscow, Russian Federation, > Chapayevsky Per, 14. > > This e-mail and any attachments may contain confidential material for > the sole use of the intended recipient(s). Any review or distribution > by others is strictly prohibited. If you are not the intended > recipient, please contact the sender and delete all copies. > --=20 _______________ With Best Regards, Irlyanov Dmitry -------------------------------------------------------------------- Closed Joint Stock Company Intel A/O Registered legal address: 125252, Moscow, Russian Federation,=20 Chapayevsky Per, 14. This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.