Problem while solving Bug#14709

classic Classic list List threaded Threaded
4 messages Options
nikhil goel nikhil goel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Problem while solving Bug#14709

Hello,

    I was solving Bug#14709. I was able to make checkbox and radiobutton support LaTeX. While trying to make listbox support LaTeX, I encountered a problem.
    When I tried to call ScilabSpecialTextUtilities.setText() within the constructor of SwingScilabListBox resulted in a compatibility error as 'this' could not be converted to JComponent type. I tried to overload the setText method in ScilabSpecialTextUtilities so that SwingScilabListBox type variable could be passed to it but this also resulted in the same error. 
   I think that the compatibility error is because SwingScilabListBox is not a part of the hierarchy of JComponent class.

[javac] /home/nikhil/scilab_master/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/listbox/SwingScilabListBox.java:112: error: incompatible types: <anonymous ListCellRenderer> cannot be converted to JComponent

   Am I proceeding in the right direction or am I doing something wrong? Is there any other way to do this?

_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
Clément David-2 Clément David-2
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem while solving Bug#14709

Hi Nikhil,

> I tried to overload the setText method in ScilabSpecialTextUtilities so that SwingScilabListBox
> type variable could be passed to it but this also resulted in the same error. 
>    I think that the compatibility error is because SwingScilabListBox is not a part of the
> hierarchy of JComponent class.
>
> [javac]
> /home/nikhil/scilab_master/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/listbox/Swing
> ScilabListBox.java:112: error: incompatible types: <anonymous ListCellRenderer> cannot be
> converted to JComponent
>
>    Am I proceeding in the right direction or am I doing something wrong? Is there any other way to
> do this?

Yep you find the more complex part of Scilab GUI, Scilab components (within the bridge package) are
not directly mapped to the Java ones but instead has an indirection (using the composition pattern)
to them. For exemple :

SwingScilabListBox class as an associated JList class stored in the 'list' field. If you want the
rendering of an item of the list, take a look at SwingScilabListBox.java line 107 where JList
default renderer is changed to a Scilab specific one.

Thanks for you involvement, do not hesitate to ask questions,

--
Clément
_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
nikhil goel nikhil goel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem while solving Bug#14709

Hi Clément
I am sorry I had my mid semester examinations due to which I was unable to work on this bug for a while.
I have a few questions-
Uicontrol.java- line 1231 - this function sets the string of all the uicontrol styles.
 SwingScilabPushButton.java line 107 - Function SetText.
This function is implementing the LaTeX in pushbutton. If I remove this, the latex string disappears and $/alpha$ appears.

When I try to use a similar function in Checkbox/RadioButton, the LaTeX string appears but the white portion of the checkbox/radiobutton disappears.
 I am unable to understand what is causing the checkbox/radiobutton to break.

Also in ScilabSwingPushButton.java setText function line 117. If i remove this line/change the text inside it, the latex is still being implemented. Does this mean this line is just updating the text?

If I remove majority of the code of ScilabSwingPushButton, the PushButton/checkbox/radiobutton is still working, which means that most of the code is setting properties of pushbutton/checkbox/radiobutton.

Draw function is the rendering function so removing it removes the entire PushButton/checkbox/radiobutton.
But I am not able to find why the checkbox/radiobutton is breaking.
I am unable to understand what is rendering the white box of checkbox/radiobutton.
Can you please help me figure this out?

Thanking you in anticipation
Nikhil

On Fri, Feb 24, 2017 at 1:21 PM, Clément David <[hidden email]> wrote:
Hi Nikhil,

> I tried to overload the setText method in ScilabSpecialTextUtilities so that SwingScilabListBox
> type variable could be passed to it but this also resulted in the same error. 
>    I think that the compatibility error is because SwingScilabListBox is not a part of the
> hierarchy of JComponent class.
>
> [javac]
> /home/nikhil/scilab_master/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/listbox/Swing
> ScilabListBox.java:112: error: incompatible types: <anonymous ListCellRenderer> cannot be
> converted to JComponent
>
>    Am I proceeding in the right direction or am I doing something wrong? Is there any other way to
> do this?

Yep you find the more complex part of Scilab GUI, Scilab components (within the bridge package) are
not directly mapped to the Java ones but instead has an indirection (using the composition pattern)
to them. For exemple :

SwingScilabListBox class as an associated JList class stored in the 'list' field. If you want the
rendering of an item of the list, take a look at SwingScilabListBox.java line 107 where JList
default renderer is changed to a Scilab specific one.

Thanks for you involvement, do not hesitate to ask questions,

--
Clément
_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev


_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
nikhil goel nikhil goel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem while solving Bug#14709

Hi Clément
I am sorry I had my mid semester examinations due to which I was unable to work on this bug for a while.
I have a few questions-
Uicontrol.java- line 1231 - this function sets the string of all the uicontrol styles.
 SwingScilabPushButton.java line 107 - Function SetText.
This function is implementing the LaTeX in pushbutton. If I remove this, the latex string disappears and $/alpha$ appears.

When I try to use a similar function in Checkbox/RadioButton, the LaTeX string appears but the white portion of the checkbox/radiobutton disappears.
 I am unable to understand what is causing the checkbox/radiobutton to break.

Also in ScilabSwingPushButton.java setText function line 117. If i remove this line/change the text inside it, the latex is still being implemented. Does this mean this line is just updating the text?

If I remove majority of the code of ScilabSwingPushButton, the PushButton/checkbox/radiobutton is still working, which means that most of the code is setting properties of pushbutton/checkbox/radiobutton.

Draw function is the rendering function so removing it removes the entire PushButton/checkbox/radiobutton.
But I am not able to find why the checkbox/radiobutton is breaking.
I am unable to understand what is rendering the white box of checkbox/radiobutton.
Can you please help me figure this out?

Thanking you in anticipation
Nikhil

On Sun, Mar 12, 2017 at 1:52 PM, nikhil goel <[hidden email]> wrote:
Hi Clément
I am sorry I had my mid semester examinations due to which I was unable to work on this bug for a while.
I have a few questions-
Uicontrol.java- line 1231 - this function sets the string of all the uicontrol styles.
 SwingScilabPushButton.java line 107 - Function SetText.
This function is implementing the LaTeX in pushbutton. If I remove this, the latex string disappears and $/alpha$ appears.

When I try to use a similar function in Checkbox/RadioButton, the LaTeX string appears but the white portion of the checkbox/radiobutton disappears.
 I am unable to understand what is causing the checkbox/radiobutton to break.

Also in ScilabSwingPushButton.java setText function line 117. If i remove this line/change the text inside it, the latex is still being implemented. Does this mean this line is just updating the text?

If I remove majority of the code of ScilabSwingPushButton, the PushButton/checkbox/radiobutton is still working, which means that most of the code is setting properties of pushbutton/checkbox/radiobutton.

Draw function is the rendering function so removing it removes the entire PushButton/checkbox/radiobutton.
But I am not able to find why the checkbox/radiobutton is breaking.
I am unable to understand what is rendering the white box of checkbox/radiobutton.
Can you please help me figure this out?

Thanking you in anticipation
Nikhil


On Fri, Feb 24, 2017 at 1:21 PM, Clément David <[hidden email]> wrote:
Hi Nikhil,

> I tried to overload the setText method in ScilabSpecialTextUtilities so that SwingScilabListBox
> type variable could be passed to it but this also resulted in the same error. 
>    I think that the compatibility error is because SwingScilabListBox is not a part of the
> hierarchy of JComponent class.
>
> [javac]
> /home/nikhil/scilab_master/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/listbox/Swing
> ScilabListBox.java:112: error: incompatible types: <anonymous ListCellRenderer> cannot be
> converted to JComponent
>
>    Am I proceeding in the right direction or am I doing something wrong? Is there any other way to
> do this?

Yep you find the more complex part of Scilab GUI, Scilab components (within the bridge package) are
not directly mapped to the Java ones but instead has an indirection (using the composition pattern)
to them. For exemple :

SwingScilabListBox class as an associated JList class stored in the 'list' field. If you want the
rendering of an item of the list, take a look at SwingScilabListBox.java line 107 where JList
default renderer is changed to a Scilab specific one.

Thanks for you involvement, do not hesitate to ask questions,

--
Clément
_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev



_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
Loading...