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
Related
I am using Vaadin framework with Spring boot and I need to display a PIE Chart with its contents. The thing is everything is working fine and when I click the legends labels the animation works fine.
Pre-click:
When I click the labels:
Note that when I clicked the labels the pie changed, which is what I want.
But when I click all the labels:
The pie chart turns into this blue I don't even know what this is.
I was wondering if anyone knows how would I access the labels in the legends to check if they are selected via Java and if none of them is selected I wouldn't let the user deselect the last one.
Thank you for your help
Find the chart code here:
private Component getCompaniesChart() {
Chart chart = new Chart(ChartType.PIE);
Configuration conf = chart.getConfiguration();
DataSeries dataSeries = new DataSeries();
service.findAllDepartments()
.forEach(Department -> dataSeries.add(new DataSeriesItem(Department.getName(), Department.getEmployeeCount())));
Options3d options3d = new Options3d();
options3d.setEnabled(true);
options3d.setAlpha(70);
options3d.setBeta(0);
conf.getChart().setOptions3d(options3d);
PlotOptionsPie plotOptions = new PlotOptionsPie();
plotOptions.setDepth(100);
plotOptions.setAllowPointSelect(true);
plotOptions.setShowInLegend(true);
plotOptions.setShadow(true);
plotOptions.setSize("200%");
conf.getLegend().setLabelFormat("{name} ({y})");
conf.getLegend().setItemMarginTop(100);
conf.setPlotOptions(plotOptions);
conf.setSeries(dataSeries);
conf.getChart().setStyledMode(true);
return chart;
}
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:
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:
I've been running into a problem lately where I try to se a JMenuItems icon which when I define and point to the icon the application it self don't start/show.
I started looking for errors, but there where none; started looking for write occurencies, which typically pretty much does appear when I add the icon and after that as pointed above the application doesn't start/show.
When the icon is set but commented:
Code
mntmMaximize = new JMenuItem();
mntmMaximize.setText("Maximize Window");
mntmMaximize.setActionCommand("maximize");
mntmMaximize.addActionListener(this);
mntmMaximize.setMnemonic(KeyEvent.VK_PLUS);
mntmMaximize.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, ActionEvent.CTRL_MASK));
// mntmMaximize.setIcon(new ImageIcon(Vision.class.getResource("xray/fullscreen16x.png")));
mnWindow.add(mntmMaximize);<br>
Picture:
Screen Shot Of Visible Application
After the icon is set and trying to execute application:
Code:
mntmMaximize = new JMenuItem();
mntmMaximize.setText("Maximize Window");
mntmMaximize.setActionCommand("maximize");
mntmMaximize.addActionListener(this);
mntmMaximize.setMnemonic(KeyEvent.VK_PLUS);
mntmMaximize.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, ActionEvent.CTRL_MASK));
mntmMaximize.setIcon(new ImageIcon(Vision.class.getResource("xray/fullscreen16x.png")));
mnWindow.add(mntmMaximize);<br>
Picture:
The window not created and application terminated
Note that when the window is not created in this picture the application is therefor terminated.
Please try to answer nice, and if you need the whole source file it is possible.
Edit:
Also if needed i can make a video where i show when i start the application when the icon is set but not commented.
getResource uses the relative path with respect to the package (folder), like in
Vision.class.getResource("fullscreen16x.png")
or absolute like in:
Vision.class.getResource("/xray/fullscreen16x.png")
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);