How to change text size for a Status Widget in GXT - gxt

I need to create a info message for a FieldSet which contains a grid. I am setting the message using:
Status status = new Status();
status.setText("You can choose max 40 persons");
status.addStyleName("x-form-info-tip");
But in the output, the text looks really big, so how can I change the text size for this Status message?
Thank you in advance.

Try
status.setAttribute("font-size","45px");

Related

How to show header of ListView when its empty

I am developing the following screen
The fourboxes next to each other are buttons. On clicking of the buttons I am changing the adapter of the listview.
Since the content above the listview took up lot of space I made the whole thing as an header and added it via code.
myPollsList = (ListView) findViewById(R.id.listArea);
myPollsList.addHeaderView(getLayoutInflater().inflate(R.layout.profile_listview_header, null));
Now I want to show some view when the list is empty. But if I do that then the header also goes away.
I am using this in a Activity and not a ListActivity. Any suggestions or workarounds for showing the header even when the list is empty ?
EDIT: Refer to my earlier question here ListView not getting space to show content on smaller screens . This is where someone suggested me to solve the problem by putting it as a header
I found a simple solution for this problem. If there's no elements for list and you are not adding the adapter, just add this:
mListView.setAdapter(null);
and the header will appear. It's easier than adding empty / fake item to the list.
So this is how I solved it. I had a custom adapter which was connected to the listview. When it found that it had zero items to display. It would add a fake empty view as an item to the list.
maybe you will like this Android addHeaderView disappears when no items in ListView
override/subclass your adapter to return false from isEmpty()
Don't use top layouts of button as header for list view.
So to adjust UI without using list header use weights.
Give parent Linear layout weight sum as 4 and 1, 1 to top Layouts and 2 for list view.

QTreeView: Show "loading" message when expanding item

With PyQT and a QTreeView, I need to display a "loading" message or a "spinning wheel" when the user expands an item, because the childs are retrieved by making a http request.
Any ideas on how to implement this?
Thanks
If the time taken to retrieve the child items is relatively short (say, a few seconds), then by far the simplest solution is to display a busy/wait cursor.
You can either set the cursor on the treeview:
treeview.setCursor(QtCore.Qt.BusyCursor)
# retrieve and insert child items ...
treeview.unsetCursor()
or set it globally:
QtGui.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor))
# retrieve and insert child items ...
QtGui.QApplication.restoreOverrideCursor()
But other solutions will be much more complicated than this.
For instance you could show a QProgressBar in the status bar, or perhaps use a QMovie to display an animated icon somehow.

LWUIT Wrong size of scrollbar recalculate?

I'm using LWUIT on a Nokia Device.
The Form which is displayed contains several different LayoutManagers(), Flow+Y_AXIS and many Labels. Those get added in a Class which parses an XML file. This class gets returned and is displayed by another Class.
The scrollbar is sometimes "too short", meaning there's still text on the form which is cutoff, or hidden under the soft buttons.
Is there a function to have the layout recalculated?
I tried form.getContentPane().layoutContainer(); and form.invalidate(); form.revalidate();
Thanks in advance
Revalidate is enough to layout, it is invoked implicitly when showing a form. If you are using the scrollbar in SVN should be pretty accurate for all lengths of data, if you have a compiling working test case where the scrollbar isn't accurately calculated you can use the LWUIT issue tracker ( http://java.net/jira/browse/LWUIT ) to submit a bug report and attach said test case.

Limiting Text to spark textarea available size

I'm trying to build a dynamically sized spark textArea which limits the possible text to its size.
E.g the textarea is set to width="300" and height="100". Now the user should only be able to enter or paste as much text as can be visible in the component. I don't want the textArea to scroll or linebreak if more text is entered.
I tried all sorts of approaches, but none with success.
Help is highly appreciated!
I encountered the same issue but no perfect solution is found. But I found a simple workaround for this issue.
Spark TextArea has a textDisplay attribute of type IEditableText. by default, a RichEditableText component is assigned to this attribute. There is a property called contentHeight in this component. I used this property to determine if the text height exceeds textArea height. So my simple solution is like this:
protected function textArea1_changeHandler(event:TextOperationEvent):void {
if (textArea1.textDisplay is RichEditableText){
if ((textArea1.textDisplay as RichEditableText).contentHeight > textArea1.height){
textArea1.maxChars = textArea1.text.length;
}
else {
textArea1.maxChars = 0;
}
}
}
Of cause, this needs to be fine tuned before using in an application. But I wanted to post the solution as soon as possible :) I will post exact logic required. But I think you can do it by your own too...
for a Spark textArea I used this on each change of text:
while (textArea.textFlow.flowComposer.numLines>textArea.heightInLines)
textArea.text = textArea.text.substr(0,textArea.text.length-1);

How do I send a custom error message to the client a Telerik MVC Grid Ajax Insert/Update/Delete?

I am working with Ajax Editing within a Telerik Grid extension. I would like to handle errors/exceptions on Insert/Update/Delete and display a user friendly message in the message box that is displayed back to the client, instead of the default message of "Error! The requested URL returned 500 - Internal Server Error" or the like.
Is there a way to tell the grid to display a custom text message?
Someone customized the alert here: http://www.telerik.com/community/forums/aspnet-mvc/grid/how-to-return-error-information-to-grid-in-ajax-editing-mode.aspx, but I'm still searching for a way to actually update the grid itself...
There's a little hope in the client-side grid's noRecordsTemplate property, but we still need a way to clear the grid of any records that may have already been there.
Edit:
Found it: To clear the grid, and set your message, do the following:
var grid = $('#Grid').data('tGrid');
grid.total = 0;
grid.dataBind(Array());
$('#Grid').find('.t-no-data td').text('My Custom Error Message');
Of course, you can figure out on your own how to combine the my example and the example from the link above.

Resources