@@ -697,19 +697,8 @@ public void stateChanged(ChangeEvent e) {
697697 System .out .println (id + " stateChange " + dumpEvent (e ));
698698 }
699699
700- @ Override
701- public void propertyChange (PropertyChangeEvent e ) {
702- String prop = e .getPropertyName ();
703- if (prop == "ancestor" ) {
704- updatePropertyAncestor (false );
705- if (e .getNewValue () == null )
706- return ;
707- if (isDisposed && c .visible && e .getNewValue () != null )
708- setVisible (true );
709- }
710- propertyChangedCUI (prop );
711- }
712700
701+
713702 private void updatePropertyAncestor (boolean fromButtonListener ) {
714703 if (fromButtonListener ) {
715704 setTainted ();
@@ -720,11 +709,9 @@ private void updatePropertyAncestor(boolean fromButtonListener) {
720709 JSComponentUI parentui = (JSComponentUI ) (p == null ? null : p .getUI ());
721710 if (parentui != null ) {
722711 parentui .setTainted ();
723- parentui .setHTMLElement ();
724712 if (fromButtonListener ) {
713+ parentui .setHTMLElement ();
725714 if (parentui .menu != null ) {
726- // System.out.println(
727- // "ancestor " + fromButtonListener + " " + id + " " + parentui.id + " " + p.isVisible());
728715 ((JSPopupMenuUI ) parentui ).updateMenu ();
729716 } else if (parentui .isPopupMenu && p .getParent () == null ) {
730717 p = (JComponent ) ((JPopupMenu ) p ).getInvoker ();
@@ -735,7 +722,49 @@ private void updatePropertyAncestor(boolean fromButtonListener) {
735722 p = (JComponent ) p .getParent ();
736723 }
737724 }
725+
726+
727+ //
728+ // @Override
729+ // public void propertyChange(PropertyChangeEvent e) {
730+ // // old
731+ // String prop = e.getPropertyName();
732+ // if (prop == "ancestor") {
733+ // JComponent p = (JComponent) jc.getParent();
734+ // while (p != null) {
735+ // JSComponentUI parentui = (JSComponentUI) (p == null ? null : p.getUI());
736+ // if (parentui != null)
737+ // parentui.setTainted();
738+ // p = (JComponent) p.getParent();
739+ // }
740+ //
741+ // if (e.getNewValue() == null)
742+ // return;
743+ // if (isDisposed && c.visible && e.getNewValue() != null)
744+ // setVisible(true);
745+ // }
746+ // propertyChangedCUI(prop);
747+ // }
748+ //
749+ //
750+
738751
752+ @ Override
753+ public void propertyChange (PropertyChangeEvent e ) {
754+ String prop = e .getPropertyName ();
755+ if (prop == "ancestor" ) {
756+ updatePropertyAncestor (false );
757+ if (e .getNewValue () == null )
758+ return ;
759+ if (isDisposed && c .visible && e .getNewValue () != null )
760+ setVisible (true );
761+ }
762+ propertyChangedCUI (prop );
763+ }
764+
765+
766+
767+
739768 /**
740769 * plaf ButtonListener and TextListener will call this to update common
741770 * properties such as "text".
@@ -748,6 +777,9 @@ void propertyChangedFromListener(String prop) {
748777 propertyChangedCUI (prop );
749778 }
750779
780+
781+
782+
751783 protected void propertyChangedCUI (String prop ) {
752784 // don't want to update a menu until we have to, after its place is set
753785 // and we know it is not a JMenuBar menu
@@ -808,6 +840,85 @@ protected void propertyChangedCUI(String prop) {
808840 System .out .println ("JSComponentUI: unrecognized prop: " + this .id + " " + prop );
809841 }
810842
843+
844+ // /**
845+ // * plaf ButtonListener and TextListener will call this to update common
846+ // * properties such as "text".
847+ // *
848+ // * @param prop
849+ // */
850+ // void propertyChangedFromListener(String prop) {
851+ // propertyChangedCUI(prop);
852+ // }
853+
854+
855+ //
856+ // protected void propertyChangedCUI(String prop) {
857+ // // don't want to update a menu until we have to, after its place is set
858+ // // and we know it is not a JMenuBar menu
859+ // if (!isMenu)
860+ // updateDOMNode();
861+ // if (prop == "preferredSize") {
862+ // // size has been set by JComponent layout
863+ // preferredSize = c.getPreferredSize(); // may be null
864+ // getPreferredSize();
865+ // return;
866+ // }
867+ // if (prop == "background") {
868+ // setBackground(c.getBackground());
869+ // return;
870+ // }
871+ // if (prop == "foreground") {
872+ // setForeground(c.getForeground());
873+ // return;
874+ // }
875+ // if (prop == "opaque") {
876+ // setBackground(c.getBackground());
877+ // return;
878+ // }
879+ // if (prop == "inverted") {
880+ // updateDOMNode();
881+ // return;
882+ // }
883+ // if (prop == "text") {
884+ // String val = ((AbstractButton) c).getText();
885+ // if (val == null ? currentText != null : !val.equals(currentText))
886+ // setIconAndText(prop, currentIcon, currentGap, (String) val);
887+ // return;
888+ // }
889+ // if (prop == "iconTextGap") {
890+ // if (iconNode != null) {
891+ // int gap = ((AbstractButton) c).getIconTextGap();
892+ // if (currentGap != gap)
893+ // setIconAndText(prop, currentIcon, gap, currentText);
894+ // }
895+ // return;
896+ // }
897+ // if (prop == "icon") {
898+ // if (iconNode != null) {
899+ // // note that we use AbstractButton cast here just because
900+ // // it has a getIcon() method. JavaScript will not care if
901+ // // it is really a JLabel or JOptionPane, which also have icons
902+ // ImageIcon icon = getIcon(c, null);
903+ // if (icon == null ? currentIcon != null : !icon.equals(currentIcon))
904+ // setIconAndText(prop, icon, currentGap, currentText);
905+ // }
906+ // return;
907+ // }
908+ // if (prop == "horizontalAlignment" || prop == "verticalAlignment") {
909+ // setAlignment();
910+ // return;
911+ // }
912+ // if (debugging)
913+ // System.out.println("JSComponentUI: unrecognized prop: " + this.id + " " + prop);
914+ // }
915+ //
916+
917+
918+
919+
920+
921+
811922 private String createMsgs = "" ;
812923
813924 /**
0 commit comments