I'm stuck with this Codename one UI component for two days and still couldn't get a proper solution...I added tabs in my application but when I run the application, the tabs I added don't look as I expected.
The height of my tab is too big and I want to reduce it.
See the screenshot of how the tab currently looks below:
And here is the code I'm using in my application:
Tabs t = new Tabs();
Style s = UIManager.getInstance().getComponentStyle("Tab");
FontImage icon1 = FontImage.createMaterial(FontImage.MATERIAL_QUESTION_ANSWER, s);
Container container1 = BoxLayout.encloseY();
Container container2 = BoxLayout.encloseY();
t.addTab("Tab1", icon1, container1);
t.addTab("Tab2", container2);
hi.add(BorderLayout.SOUTH, t);
hi.show();
Open your GUI Builder and style the Tab Uiid to reduce the padding as necessary:
Style the Unselected, Selected and Pressed to have the same padding size, see the image below to know the key elements to touch:
Related
Vaadin 8 editor of grid doesn't work correctly when I double click on cell that I can edit.
I use the simple code for create grid and add for one column editor component.
VerticalLayout content = new VerticalLayout();
content.setMargin(false);
content.setSpacing(false);
content.setSizeFull();
setContent(content);
Grid<OrderModel> grid = new Grid(OrderModel.class);
grid.setItems(generate());
grid.setSizeFull();
grid.getEditor().setEnabled(true);
grid.getColumn("planningStatus").setEditorComponent(getCombobox());
Next I run app and start to scroll grid till column "planningStatus".
How it works:
So. What should I do or how I should fix it for correct open editor in grid?
Could your problem be related to issue reported here: https://github.com/vaadin/framework/issues/7746 ?
There exists now also add-on which fixes couple of known Editor cell sizing issues:
Hi I am working on a vaadin application integrating the vaadin app in the application UI . The image is :
the Scroll bar is up and grid is below.
For setting a grid i have tried setSizeFull() and layout.setSizeUndefined() but it's not working for the grid..
this happens when i add object of BeanItemContainer to the grid.
BeanItemContainer<Partner> container = new BeanItemContainer<Partner>(Partner.class, model.getPartnerList());
Grid grid = new Grid();
grid.setColumns("code","surname","name","companyName");
grid.getColumn("code").setHeaderCaption("Code");
grid.getColumn("lastname").setHeaderCaption("Last Name");
grid.getColumn("name").setHeaderCaption("First Name");
grid.getColumn("companyName").setHeaderCaption("Company");
//grid.setContainerDataSource(container);
layout.addComponent(grid);
addComponent(layout);
return layout;
I have had this error too.
A developer who compiled the theme when project started had
$v-included-components: remove($v-included-components, grid);
in the theme scss file.
Please comment this line out or remove the line completely and try again
I am creating a window with two image buttons (using TriplePlay in my playN game).
Now I need dynamic text on these buttons. But when I add buttons with images (setIcon), I am not able to add Text on it same time. Please check the following code block I use now.
Interface iface = new Interface(null);
pointer().setListener(iface.plistener);
Styles buttonStyles = Styles.none().add(Style.BACKGROUND.is(new NullBackground())).
addSelected(Style.BACKGROUND.is(Background.solid(0xFFCCCCCC)));
Stylesheet rootSheet = Stylesheet.builder().add(Button.class, buttonStyles).create();
Root buttonroot = iface.createRoot(AxisLayout.horizontal().gap(150), rootSheet);
buttonroot.setSize(width_needed, height_needed);
buttonroot.addStyles(Styles.make(Style.BACKGROUND.is(new NullBackground())));
graphics().rootLayer().add(buttonroot.layer);
Button you = new Button().setIcon(buttonImage);
Button friend = new Button().setIcon(buttonImage);
buttonroot.add(you).add(friend);
buttonroot.layer.setTranslation(x_needed, y_needed);
Root nameroot = iface.createRoot(AxisLayout.horizontal().gap(300), rootSheet);
nameroot.setSize(width_needed, height_needed);
nameroot.addStyles(Styles.make(Style.BACKGROUND.is(new NullBackground())));
graphics().rootLayer().add(nameroot.layer);
name = new Label("YOU");// we need the dynamic string variable instead
friendName = new Label("FRIEND"); // we need the dynamic string variable instead
nameroot.add(name).add(friendName);
nameroot.layer.setTranslation(x_needed, y_needed);
here I have tried making a root then add button with images to it then making another root and add labels on it so that it will be show like text on the image buttons. But I know this is a bad way of doing it, and the alignment will not be according to what needed as it a dynamic text. Is there anyway to add a button, with image and a label on it?
Thanks in anticipation
Creating a button with text and an icon is trivial:
Button button = new Button("Text").setIcon(iconImage);
You can then change the text on the button any time you like, like so:
button.text.update("New Text");
If you want a button with a background image with text rendered over the background, then do the following:
Button button = new Button("Text").
addStyles(Background.is(Background.image(bgImage)));
Note that you will need the latest TriplePlay code (from Github) to use the ImageBackground. The latest code also supports Flash-style "scale9" backgrounds:
Button button = new Button("Text").
addStyles(Background.is(Background.scale9(bgImage)));
I have written an Eclipse plugin which provides some UI which uses the CTabFolder component.
The CTabItems provided by Eclipse have a blue border when active and a white border when inactive (grey if the CTabItem is an Eclipse View).
The CTabItems which I have created are always bordered in white and the text on the active tab is underlined.
How can I control the style of my CTabItems to more closely match the Eclipse tabs?
EDIT:
I have come up with the following code which extracts the correct colors from the active Eclipse theme.
IWorkbench workBench = PlatformUI.getWorkbench();
ITheme theme = workBench.getThemeManager().getCurrentTheme();
ColorRegistry colreg = theme.getColorRegistry();
Color c1 = colreg.get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_START);
Color c2 = colreg.get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_END);
However, this isn't ideal as IWorkbenchThemeConstants is within an eclipse ui internal package.
Is there an alternative public way to reference the same colors referred to by these internal IWorkbenchThemeConstants?
You can use methods for defining gradient on selected and non-selected CTabFolder items. For example
CTabFolder folder = new CTabFolder(shell, SWT.BORDER);
folder.setBackground(new Color[]{display.getSystemColor(SWT.COLOR_YELLOW), display.getSystemColor(SWT.COLOR_RED)}, new int[]{100}, true);
folder.setSelectionBackground(new Color[]{display.getSystemColor(SWT.COLOR_WHITE), display.getSystemColor(SWT.COLOR_BLUE)}, new int[]{100}, true);
will produces this (ugly) tabs
So you just have to hit right colors which eclipse have..
Or you could write your own CTabFolderRenderer and set it to your CTabFolder instance.
EDIT
For Eclipse colors try
folder.setSelectionBackground(new Color[]{new Color(display, new RGB(242, 244, 247)), new Color(display, new RGB(157, 167, 195))}, new int[]{100}, true);
EDIT
Found the way how to do it correctly
folder.setSelectionBackground(new Color[]{display.getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT), display.getSystemColor(SWT.COLOR_TITLE_BACKGROUND)}, new int[]{100}, true);
I have strange issue with browseField2 API on device 9700 (BB OS 5.0).
Browser field is displays blank white space exactly of screen height after rendering HTML content of the browser field. I have added browser field on VerticalFieldManager and this manager also has other controls on it. I also tried with directly adding browse field on screen in combination of other controls on screen, but it doesn’t worked. My goal is to add browser field on screen which has others controls added on it. Also scrolling between controls should be proper.
Here is code snippet which I am using –
BrowserFieldConfig myBrowserFieldConfig = new BrowserFieldConfig(); myBrowserFieldConfig.setProperty(BrowserFieldConfig.NAVIGATION_MODE,BrowserFieldConfig.NAVIGATION_MODE_CARET);
myBrowserFieldConfig.setProperty(BrowserFieldConfig.JAVASCRIPT_ENABLED,Boolean.TRUE);
browseField = new BrowserField(myBrowserFieldConfig);
LOMABrowseField2Listener listener = new LOMABrowseField2Listener();
ProtocolController protocolController = new ProtocolController(browseField);
myBrowserFieldConfig.setProperty(BrowserFieldConfig.CONTROLLER, protocolController);
String myProtocol = "http";
protocolController.setNavigationRequestHandler(myProtocol, listener);
browseField.displayContent(htmlSpecificContent,"");
Please help me out.
Thanks in Advance,
I have solved this issue. This was not the issue with browser field instead the screen which has the browser field was vertically scrollable. The fix is the screen should be vertically non scrollable.