use of org.apache.pivot.wtk.Border in project pivot by apache.
the class BorderSkin method getPreferredHeight.
@Override
public int getPreferredHeight(int width) {
int preferredHeight = 0;
Border border = (Border) getComponent();
Component content = border.getContent();
if (content != null) {
int widthUpdated = width;
if (widthUpdated != -1) {
widthUpdated = Math.max(widthUpdated - paddingThicknessWidth(), 0);
}
preferredHeight = content.getPreferredHeight(widthUpdated);
}
preferredHeight += paddingThicknessHeight();
return preferredHeight;
}
use of org.apache.pivot.wtk.Border in project pivot by apache.
the class ColorSchemeBuilderWindow method createColorPaletteCell.
private static Component createColorPaletteCell(int index) {
Border border = new Border();
border.getStyles().put(Style.backgroundColor, index);
Theme theme = Theme.getTheme();
Label label = new Label();
label.setText(Integer.toString(index));
label.getStyles().put(Style.font, "{size:'80%'}");
label.getStyles().put(Style.backgroundColor, 4);
label.getStyles().put(Style.padding, 1);
BoxPane boxPane = new BoxPane();
boxPane.getStyles().put(Style.padding, 2);
boxPane.getStyles().put(Style.horizontalAlignment, HorizontalAlignment.CENTER);
boxPane.getStyles().put(Style.verticalAlignment, VerticalAlignment.CENTER);
boxPane.add(new Border(label));
border.setContent(boxPane);
return border;
}
use of org.apache.pivot.wtk.Border in project pivot by apache.
the class ColorPaletteTest method startup.
@SuppressWarnings("unused")
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
Theme theme = Theme.getTheme();
TablePane tablePane = new TablePane();
new TablePane.Column(tablePane, 1, true);
new TablePane.Column(tablePane, 1, true);
new TablePane.Column(tablePane, 1, true);
int numberOfPaletteColors = theme.getNumberOfPaletteColors();
// ArrayList<String> colors = new ArrayList<>(numberOfPaletteColors);
for (int i = 0; i < numberOfPaletteColors; i++) {
TablePane.Row row = new TablePane.Row(tablePane, 1, true);
row.add(createCell(i * 3));
row.add(createCell(i * 3 + 1));
row.add(createCell(i * 3 + 2));
}
tablePane.getStyles().put(Style.horizontalSpacing, 4);
tablePane.getStyles().put(Style.verticalSpacing, 4);
Border border = new Border(tablePane);
border.getStyles().put(Style.padding, 6);
this.window = new Window(border);
this.window.setTitle("Color Palette");
this.window.setMaximized(true);
this.window.open(display);
}
use of org.apache.pivot.wtk.Border in project pivot by apache.
the class PromptTest method startup.
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
BoxPane boxPane = new BoxPane();
boxPane.getStyles().put(Style.horizontalAlignment, HorizontalAlignment.CENTER);
boxPane.getStyles().put(Style.verticalAlignment, VerticalAlignment.BOTTOM);
helloButton = new PushButton("Say Hello");
boxPane.add(helloButton);
helloButton.getButtonPressListeners().add(new ButtonPressListener() {
@Override
public void buttonPressed(Button button) {
String text = button.getButtonData().toString();
if (window.isBlocked()) {
System.out.println("I'm already saying \"" + text + "\" !");
} else {
Prompt.prompt(text, window);
}
}
});
Border border = new Border(boxPane);
border.getStyles().put(Style.color, 7);
border.getStyles().put(Style.padding, 5);
window = new Window(border);
window.setMaximized(true);
window.open(display);
}
use of org.apache.pivot.wtk.Border in project pivot by apache.
the class Pivot951 method startup.
@Override
public void startup(Display display, Map<String, String> properties) {
window = new Window();
Border brd = new Border();
brd.getComponentMouseButtonListeners().add(new ComponentMouseButtonListener() {
@Override
public boolean mouseClick(Component component, Button button, int x, int y, int count) {
if (count == 1) {
System.out.println("Click!");
} else {
System.out.println("Double Click!");
}
return true;
}
});
window.setContent(brd);
window.setTitle("Pivot951: Cannot click twice");
window.setMaximized(true);
window.open(display);
}
Aggregations