Is it possible to set some styles like width and height to the Boolean cell renderer ??
var BooleanRenderer = new qx.ui.table.cellrenderer.Boolean();
You can define your own renderer that will allow you to have complete control of the presentation; the BooleanRenderer class is fairly straightforward, and would be a good place to start.
Related
I am trying to change the background color for a specific container with this line of code :
Container container = new Container(new BorderLayout());
container.getStyle().setBgColor(0x99CCCC);
but nothing happens, i used also repaint() but also nothing. the same with setBgTransparency(0)
If you want to format the container or change style of the container, then you just have to create UIID in designer for container, Here you can format background color, margin, padding, etc. So you just have to create UIID and apply it to specific container.
For example:-
Container container = new Container();
container.setUIID("Container_uiid_name");
and you achieve the expected output.
setBgTransparency(0) make container to transparent so setBgTransparency to 255 to make it opaque . And hope the following codes will help you
Container container = new Container(new BorderLayout());
container.getStyle().setBgColor(0x99CCCC);
container.getStyle().setBgTransparency(255);
The Component background can be tricky. Some things to consider:
If the style has an image border defined, then that will take precedence over any other background settings.
If the style has an image background, then that will take precedence over BgColor()
If the style's BgTransparency() is set to 0 then it doesn't matter what bgcolor you set, you won't be able to see it.
So, to cover all bases, you might do something like:
myComponent.getAllStyles().setBorder(Border.createEmpty());
myComponent.getAllStyles().setBackgroundType(BACKGROUND_NONE);
myComponent.getAllStyles().setBgTransparency(255);
myComponent.getAllStyles().setBgColor(myColor);
Or, using the fluent API of the ComponentSelector class:
$(myComponent)
.setBorder(Border.createEmpty())
.setBackgroundType(BACKGROUND_NONE)
.setBgTransparency(255)
.setBgColor(myColor);
In CodeNameOne three steps to have a gradient colored container:
1. getUnselectedstyle
2. setBackgroundType :
that can be either :
BACKGROUND_GRADIENT_LINEAR_HORIZONTAL
BACKGROUND_GRADIENT_LINEAR_VERTICAL ...
setBackgroundGradientStartColor and EndColor
(if you wish to have no gradient you should make same color for StartColor and EndColor)
Container Container1 = new Container();
Container1.getUnselectedStyle().setBackgroundType(Style.BACKGROUND_GRADIENT_RADIAL);
Container1.getUnselectedStyle().setBackgroundGradientEndColor(0xFFBCCA);
Container1.getUnselectedStyle().setBackgroundGradientStartColor(0xFFBCCA);
Using a theme that extends Triton, I find that the resize handles on instances of Ext.window.Window are 10px wide. That thickness interferes with scrollbars (and maybe other things). I cannot, however, figure out how what theme variable influences resize handle thickness.
https://fiddle.sencha.com/#fiddle/1fun
I'm not sure which version of Ext you're using, so hereby I assume you use 6.0.2. I found in the documentation there's a Resizer component that is used by several components including Window. Here's a link: http://docs.sencha.com/extjs/6.0.2-classic/Ext.resizer.Resizer.html
If you there look into the theme veriables you'll find this: $resizer-handle-size. By default this is set to the same width of $panel-frame-border-width. To override that you'll need to change the number in your sass yourself.
Hope this helps you out!
I need to add markers to my map. Problem: I'm using WPF, not WinForms.
GMapMarker marker = new GMapMarker(new PointLatLng(-25.966688, 32.580528));
gmap.Markers.Add(marker);
Now according to this question the solution is:
marker.Shape = new MarkerShape(....);
Could someone explain to me, how to I initalize this shape?
Thanks!
I resolved the problem with:
marker.Shape = new Ellipse
{
Width = 10,
Height = 10,
Stroke = Brushes.Black,
StrokeThickness = 1.5
};
That's a little black circle.
You have to add a new UserControl - your own, and inside the control put a image you like (for example pin image). Note that all the events (like Click event) must be implement inside a control.
After that you can add the marker like:
GMapMarker marker = new GMapMarker(new PointLatLng(##, ##));
marker.Shape = new PinControl();
gmap.Markers.Add(marker);
In the following http://plnkr.co/edit/B7Y6WNmmw8Z2pfohFPjy?p=preview
It seems like virtualization is not being respected. I have the height set to 300px and set to only show 25 records at a time, but instead the grid is showing all available data at once.
Any help would be much appreciated.
Thanks!
Josh
The ngGridFlexibleHeightPlugin ("Automatically resize a table to accomodate a varying number of rows.") you're including is overriding your settings. It's adjusting the css directly on the element so it's changes are overriding yours.
So, the plugin overrides virtualization. If you want to manually control the height of the grid remove this plugin from your options:
plugins: [new ngGridFlexibleHeightPlugin()]
If you want it to support a max-height (flexible height until it hits a max) then it looks like you'd need to add that to the plugin yourself. plugin code here
Set the maxHeight option - e.g. ngGridFlexibleHeightPlugin({ maxHeight : 300}) will set the max height to 300..
I have to draw a lot of Shape (about 1/2 hundred thousand) as [Canvas][2]'s childrens. I make this in my WPF application dividing work in two parts: first thing I create shapes by setting the properties of each of them (like Margin, Fill, Width, etc...), after I add shapes as Canvas's children.
MyCanvas.Children.Add(MyShape)
Now i want to improve the performance of the second part, because when i draw the shapes my application is blocked for a long period of time. So i tried to use the Dispatcher and its method [BeginInvoke][4] with different [priorities][5]: only if I use the Background priority the main application does not block, otherwise the application remains blocked and the "picture" is not displayed until all shapes are added to my Canvas, but if I use the Background priority obviously everything is slower. I also tried to create a new thread instead of using the Dispatcher, but there was no significant change.
How can I fix this problem, and generally improve the performance of my application when I add my shapes to Canvas?
Thanks.
Need to use Visual objects instead of Shape; in particular, as suggested, DrawingVisual: a visual object that can be used to render vector graphics. In fact, as written in the MSDN library:
DrawingVisual is a lightweight drawing class that is used to render shapes, images, or text. This class is considered lightweight because it does not provide layout, input, focus, or event handling, which improves its performance. For this reason, drawings are ideal for backgrounds and clip art.
So, for example, to create a DrawingVisual that contains a rectangle:
private DrawingVisual CreateDrawingVisualRectangle()
{
DrawingVisual drawingVisual = new DrawingVisual();
// Retrieve the DrawingContext in order to create new drawing content.
DrawingContext drawingContext = drawingVisual.RenderOpen();
// Create a rectangle and draw it in the DrawingContext.
Rect rect = new Rect(new System.Windows.Point(160, 100), new System.Windows.Size(320, 80));
drawingContext.DrawRectangle(System.Windows.Media.Brushes.LightBlue, (System.Windows.Media.Pen)null, rect);
// Persist the drawing content.
drawingContext.Close();
return drawingVisual;
}
In order to use DrawingVisual objects, you need to create a host container for the objects. The host container object must derive from the FrameworkElement class, which provides the layout and event handling support that the DrawingVisual class lacks. When you create a host container object for visual objects, you need to store the visual object references in a VisualCollection.
public class MyVisualHost : FrameworkElement
{
// Create a collection of child visual objects.
private VisualCollection _children;
public MyVisualHost()
{
_children = new VisualCollection(this);
_children.Add(CreateDrawingVisualRectangle());
// Add the event handler for MouseLeftButtonUp.
this.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(MyVisualHost_MouseLeftButtonUp);
}
}
The event handling routine can then implement hit testing by invoking the HitTest method. The method's HitTestResultCallback parameter refers to a user-defined procedure that you can use to determine the resulting action of a hit test.
Agreed that if you want to draw millions of elements, you simply can't do it in WPF. WriteableBitmapEx as mentioned is a good alternative.
See this related question which goes into depth on high performance graphics in WPF and the alternatives available.
If you simply must use Canvas, check out this ZoomableApplication2 - A million items. This is a Canvas based demo which makes heavy use of Virtualization to get reasonable performance with 1,000,000 UIElements on a Canvas.
That's a lot of UIElements and probably isn't going to give the kind of performance you're looking for. Do you need to be able to interact with each of the elements you're rendering? If not, I would highly recommend looking into using WriteableBitmap instead. If you need to draw shapes and don't want to create all that logic yourself (who would want to?), check out the WriteableBitmapEx project over on CodePlex.
This may be somewhat unrelated, and I apologize if you feel this way, but in the hopes that it can shed some light for other users, I'll share this tidbit.
We had some performance issues with a Canvas control used for capturing signatures. The capture was very jagged, and we couldn't draw curved lines as a result. It turned out to be related to a style was was generating drop-shadows on the UI elements. Disabling the drop-shadow effect solved our problem.