PhpStorm fluent setters by default - phpstorm

Every time I use "code generate" functionality for setters I need to check "Fluent setters" checkbox. Is it possible to make that checkbox enabled by default?

Not possible yet: https://youtrack.jetbrains.com/issue/WI-38880 - feel free to vote/comment for it in order to increase its priority and get notified about updates.

If in fact you always prefer this behaviour, you can replace the code for a normal setter with the code for a fluent setter.
If you want to sometimes have a non fluent setter you could also switch the codes. And then check the fluent setter box to insert normal setters.
Admitted, a hacky solution, but this solved the issue for me.

I'm using PHPStorm 2019.1.3 (Mac) and pressing option+return opens a popup menu allowing me to create fluent setter.

Related

how to disable bootstrap-dateTimepicker's pick function?

now, I am trying to disable the pick function for some reason, I just want to display the date/time, but it can't be done, it seems that there is no such option or function to reach this? Anyone has an idea why this is the case?
I find that in the latest version of datetimepicker, there is a option "ignoreReadonly", it's default value is false and we don't change it. Just to make add the readonly attribute to the input. Then we can disable the widget.
In my old version, there is no such option. so, thanks for your answers and thanks Eonasdan. by the way, the version contains this option, is 4.14+.
And you can view the demo by [disabled datetimepicker demo](https://jsfiddle.net/xjkms/hzwpsnjw/2/).

How to programmatically focus view?

I read the Supporting Focus Within Your App and I'm still missing how can I shift focus to some custom view programmatically.
I know there are setNeedsFocusUpdate and preferredFocusedView methods. However, I'm looking for a method like [button bringIntoFocus].
Does something as simple as this exist?
There is no such way, it all needs to be indirectly done. You configure the Focus-chain from the higher up view (or view controller) to end up on the view you need to be focused. So yes, you need to check state at every view/VC in between and grant preferred focus conditionally.

JcomboBox multiple selection

I have a jcombobox in my application.
and i want it to support multiple selection (like it do in a jlist).
is there any code example?
I think it's not possible, unless you use a JList, like you said.
The JComboBox API reports:
The user can select a value from the drop-down list, which appears at
the user's request.
And a JComboBox tutorial:
Lists are not terribly attractive, but they're more appropriate than
combo boxes when the number of items is large (say, over 20) or when
selecting multiple items might be valid.
Update:
I reviewed this answer, because actually it's "possible" to do that using a ListCellRenderer, adding a checkbox to each item. Please consider this answer to implement this "solution".
However, I don't think it's a good idea for the following reasons:
there's a control like a JList that allows multiple selection;
a JComboBox control is designed just for single item selection;
it doesn't make sense to me to still use a JComboBox control and allow a multiple selection.
It's not quite impossible but there's a lot of work to do to get the job done. You'll need to create your own classes to extend/implement all of these:
ListCellRenderer (so you can mark the selected items when the popup is showing and indicate (at least) that there are multiple selections when it is not).
JComboBox (obviously)
BasicComboBoxUI (this is actually where most of the work is)
BasicListUI (at least I had to)
ComboBoxModel
And you'll need to develop your own class that implements ItemListener, MouseListener, PopupMenuListener, MouseMotionListener, PropertyChangeListener, KeyListener, ListSelectionListener.
Hint: you'll need to override a lot of createXXXListener() methods in the UI classes in order to bypass the many places where multiple selections are discarded.
[And it still doesn't allow for an editable multi-selection combo.]

java swing, simulate JTable terminateEditOnFocusLost behaviour

putClientProperty("terminateEditOnFocusLost", Boolean);
to make jtable end editing and clear current selected rows when it lose focus or when simply click over an other GUI component.
This is very useful, but with "terminateEditOnFocusLost" there are some strange behaviours if it is used with editCellAt and changeSelection.
There are also some undesiderable TableModelEvents fired for some fake table updates.
So, im looking for an hack to simulate "terminateEditOnFocusLost without using it, is this possibile?
Thanks all.
Overload the function to make it suit your needs.
No hack at this moment.
putClientProperty("terminateEditOnFocusLost", Boolean) seem to be the only correct way.

How to Control a Class Name class="fValidate['required']" in MooTools

I am using fValidator plugin for MooTools, and find necessary to control (depending on user selections) the required class it's used by the plugin.
The class uses a weird formatting which have never used before and for some reason MooTools can recognize it. It probably has something to do with escaping the square brackets and the single quotes.
I tried something like this, among other things, but no luck yet.
This is the code:
$("checkbox3").removeClass("fValidate\\[\\'required\\'\\]");
Are you looking to remove/add required elements to the validation? As it picks up all the elements at first you'd have to unregister them, remove the class and then re-register them.
Unfortunately it doesn't seem to have an unregister method by default so you'd have to monkey patch the script to add this, also as the register method doesn't parse class names you'd have to add a new method that does this. Finally you'd have to make the event that is added to the field for the blur in register a binding that you could re-use the binding to remove that event
It's quite an involved patch/rewrite of fValidator to achieve this and if possible I would look at another validation script -- such as form check which does allow you to un-register and re-register fields at run time (among a lot of other improvements).