How to collapse a codename one accordion component programmatically? - codenameone

How to collapse a codename one accordion component programmatically?
In my App, I have an accordion that expands a body container with some radio buttons. I want to collapse (Close) the body automatically when a radio button is selected.
Adding more details about the problem:
My intention is create a component that has same behavior of a ComboBox, but using Accodion component as base class.
I wrote a minimal use case that reproduce the problem and you can get its source file here MyApplication.java.This code implements Steve Hanna answer.I suppose. And it didn't work for me. Running this code is simple.
Just create a CodeName One project and replace the MyApplication.java file generated by CodeName One Wizard and run the project (I use Netbeans IDE).
I put inside Radio Button action the command to collapse the component as you can see at lines 271 til 280. But it didn't work.

In the radio button's action listener, check if it's not selected and then call collapse(bodyContainer) on the accordion.
EDIT: There was a bug in Accordion that caused collapse() to work incorrectly. This has now been fixed, and will be available in the next plugin update.
See this sample to see correct usage.
Note that after calling collapse(component), you should call the Accordion's animateLayout() method so that the change is shown.

Related

I'm using material ui accordion component and don't want to collapse it unless I click the expandIcon

I'm using the material ui accordion component and I couldn't find a way to stop the panel from collapsing when clicked. My goal is to open and close the panel only by clicking the icon in the accordionsummery component. I found many ways to stop collapsing by click a checkbox for example, but not what I'm looking for.
With default Material-UI package ;
"No" way
Because, on AccordionSummary there is a context mechanism which watches if that Accordion is expanded and produces isExpanded as a value. You need to manipulate core package code the way you wanted, which is a long haul.
Btw, adding onClick function to ExpandMoreIcon gives infinite loop because of that context.
You can go with Additional actions version of Material-UI accordion and hide the checkbox as only viewing the data.

TestRecorder with MaterialCommand in Toolbar

In a test-class, is there any way to invoke Buttons inside the toolbar, without a name (""), which were added like this?
getToolbar().addMaterialCommandToRightBar("", FontImage.MATERIAL_PICTURE_AS_PDF, e -> createPDF());
Or can I somehow tell the test-class to show a specific form ?(which is happening when I click the button without a label).
The test recorder is not generating any code in that case. It seems that it is only working with buttons, which have a non-empty String as name, as they are simply invoked by
clickButtonByLabel("Label");
The test recorder was written before the Toolbar existed, we tried to update it for the Toolbar recently but this proved to be pretty difficult.
We have this issue that covers this bug. As a workaround you can post the command directly in the code of the test.

Bootstrap Toggle checkbox not working every time

I have a bootstrap toggle checkbox from http://www.bootstraptoggle.com/ in a partialview (bootstrap modal window). Inside the partial view, I have reference to the js file (from https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js).
The bootstrap check/uncheck seem to work alternatively. For example, if I open the popup for the first time it works, second time doesn't work, third time works etc.
Is this a known issue and a workaround exists? Can someone please guide? Thanks!

Hide checker (if true) in a interactive PDF with custom checkbox created with inDesign

I got a problem with checkbox field using Adobe Indesign.
I want an image to become my checkbox button and also change the image after clicking. Unfortunately, after clicking on this button the image changes properly, but it also adds checker (check sign) in the middle of the picture. Can't see to overcome this.
It looks like this:
checkmarks
I would consider using two buttons for that. One hiding the opposite and vice-versa. Here is an example:
And here is a link to the package :
http://www.filedropper.com/dossieronoff
And here is a link to a demo PDF:
http://www.filedropper.com/onoff

In my Windows Phone app,I want to turn my current page unable in gray and show a textbox in foreground

Like the title said,how may i turn the grid(or page) and the components in it into background gray and unable and show a new component in foreground.
It's a common effect in the web page,but i cannot do that with a xaml.
Please answer in detail better with sample code if you do.Thanks in advance.
Here's an example of using a Popup to display a UserControl when a Page is navigated to. The OnNavigatedTo function creates a popup, binds a Click event to the UserControl, and then shows the UserControl over the entire page. If the correct password is entered, ("password" in the example) the control disappears. You'll need to modify it for your own requirements, but it should definitely get you started.
https://skydrive.live.com/redir.aspx?cid=ef08824b672fb5d8&resid=EF08824B672FB5D8!343
You'll want to use the VisualStateManager and create some animation transitions to switch between the old and new components. I won't paste the code here for brevity, but if you check out:
http://visualstudiomagazine.com/articles/2011/07/22/wcmob_visual-states.aspx
You'll see a simple example of switching between two UI components on a single page within a Windows Phone 7 PhoneApplicationPage. In your scenario, you'd use this paradigm to create 2 animation storyboards, one for showing an overlay control and one for settings the 'disabled' property on the main grid.

Resources