use of com.codename1.ui.plaf.UIManager in project CodenameOne by codenameone.
the class SideMenuBar method createSideNavigationPanel.
Container createSideNavigationPanel(Vector commands, String placement) {
Container menu = constructSideNavigationComponent();
if (getUIManager().isThemeConstant("paintsTitleBarBool", false)) {
Container bar = new Container();
bar.setUIID("StatusBarSideMenu");
addComponentToSideMenu(menu, bar);
}
if (!getUIManager().isThemeConstant("sideMenuTensileDragBool", true)) {
menu.setTensileDragEnabled(false);
}
for (int iter = commands.size() - 1; iter > -1; iter--) {
Command c = (Command) commands.elementAt(iter);
if (c.getClientProperty(COMMAND_PLACEMENT_KEY) != placement) {
continue;
}
Component cmp = (Component) c.getClientProperty(COMMAND_SIDE_COMPONENT);
if (cmp != null) {
if (cmp.getParent() != null) {
cmp.getParent().removeAll();
}
if (c.getClientProperty(COMMAND_ACTIONABLE) != null && c.getClientProperty(COMMAND_ACTIONABLE).equals(Boolean.TRUE)) {
Container cnt = new Container(new BorderLayout());
cnt.addComponent(BorderLayout.CENTER, cmp);
Button btn = createTouchCommandButton(c);
btn.setParent(cnt);
cnt.setLeadComponent(btn);
addComponentToSideMenu(menu, cnt);
} else {
addComponentToSideMenu(menu, cmp);
}
initTitleBarStatus();
} else {
// special case: hide back button that doesn't have text, icon or a side component entry
if (parent.getBackCommand() == c && (c.getCommandName() == null || c.getCommandName().length() == 0) && c.getIcon() == null) {
continue;
}
addComponentToSideMenu(menu, createTouchCommandButton(c));
}
}
boolean isRTLValue = isRTL();
if (placement == COMMAND_PLACEMENT_VALUE_RIGHT) {
isRTLValue = !isRTLValue;
}
UIManager uim = menu.getUIManager();
boolean shadowEnabled = uim.isThemeConstant("sideMenuShadowBool", true);
Image sh = (Image) uim.getThemeImageConstant("sideMenuShadowImage");
if (sh == null && shadowEnabled) {
sh = Resources.getSystemResource().getImage("sidemenu-shadow.png");
}
if (isRTLValue && sh != null) {
sh = sh.flipHorizontally(true);
}
final Image shadow = sh;
if (shadow == null) {
return menu;
} else {
Container main = new Container(new LayeredLayout());
Label shadowLabel = new Label();
shadowLabel.getStyle().setBackgroundType(Style.BACKGROUND_IMAGE_TILE_VERTICAL_ALIGN_CENTER);
shadowLabel.getStyle().setBgImage(shadow);
shadowLabel.getStyle().setPadding(0, 0, 0, 0);
shadowLabel.getStyle().setMargin(0, 0, 0, 0);
shadowLabel.getStyle().setBgTransparency(0);
Container c = new Container(new BorderLayout());
if (placement == COMMAND_PLACEMENT_VALUE_RIGHT) {
shadowLabel.setPreferredW(shadow.getWidth());
c.addComponent(BorderLayout.WEST, shadowLabel);
shadowLabel.getStyle().setBgImage(shadow.rotate180Degrees(true));
} else {
if (placement == COMMAND_PLACEMENT_VALUE_TOP) {
// shadowLabel.setPreferredH(shadow.getHeight());
// c.addComponent(BorderLayout.SOUTH, shadowLabel);
// shadowLabel.getStyle().setBgImage(shadow.rotate90Degrees(true));
} else {
shadowLabel.setPreferredW(shadow.getWidth());
c.addComponent(BorderLayout.EAST, shadowLabel);
}
}
main.addComponent(menu);
main.addComponent(c);
return main;
}
}
use of com.codename1.ui.plaf.UIManager in project CodenameOne by codenameone.
the class Tabs method initLaf.
/**
* {@inheritDoc}
*/
protected void initLaf(UIManager manager) {
super.initLaf(manager);
int tabPlace = manager.getThemeConstant("tabPlacementInt", -1);
tabsFillRows = manager.isThemeConstant("tabsFillRowsBool", false);
tabsGridLayout = manager.isThemeConstant("tabsGridBool", false);
changeTabOnFocus = manager.isThemeConstant("changeTabOnFocusBool", false);
BorderLayout bd = (BorderLayout) super.getLayout();
if (bd != null) {
if (manager.isThemeConstant("tabsOnTopBool", false)) {
if (bd.getCenterBehavior() != BorderLayout.CENTER_BEHAVIOR_TOTAL_BELOW) {
bd.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_TOTAL_BELOW);
checkTabsCanBeSeen();
}
} else {
bd.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_SCALE);
}
}
changeTabContainerStyleOnFocus = manager.isThemeConstant("changeTabContainerStyleOnFocusBool", false);
if (tabPlace != -1) {
tabPlacement = tabPlace;
}
}
use of com.codename1.ui.plaf.UIManager in project CodenameOne by codenameone.
the class TextArea method initLaf.
/**
* {@inheritDoc}
*/
protected void initLaf(UIManager uim) {
super.initLaf(uim);
setSelectCommandText(uim.localize("edit", "Edit"));
LookAndFeel laf = uim.getLookAndFeel();
setSmoothScrolling(laf.isDefaultSmoothScrolling());
}
use of com.codename1.ui.plaf.UIManager in project CodenameOne by codenameone.
the class DefaultLookAndFeel method updateCheckBoxConstants.
private void updateCheckBoxConstants(UIManager m, boolean focus, String append) {
Image checkSel = m.getThemeImageConstant("checkBoxChecked" + append + "Image");
if (checkSel != null) {
Image checkUnsel = m.getThemeImageConstant("checkBoxUnchecked" + append + "Image");
if (checkUnsel != null) {
Image disUnsel = m.getThemeImageConstant("checkBoxUncheckDis" + append + "Image");
Image disSel = m.getThemeImageConstant("checkBoxCheckDis" + append + "Image");
if (disSel == null) {
disSel = checkSel;
}
if (disUnsel == null) {
disUnsel = checkUnsel;
}
if (focus) {
setCheckBoxFocusImages(checkSel, checkUnsel, disSel, disUnsel);
} else {
setCheckBoxImages(checkSel, checkUnsel, disSel, disUnsel);
}
}
if (checkUnsel != null) {
if (focus) {
setCheckBoxFocusImages(checkSel, checkUnsel, checkSel, checkUnsel);
} else {
setCheckBoxImages(checkSel, checkUnsel);
}
}
} else {
if (!Font.isTrueTypeFileSupported()) {
return;
}
UIManager uim = UIManager.getInstance();
Style unsel = uim.createStyle("CheckBox.", "", false);
Style sel = uim.createStyle("CheckBox.", "sel#", true);
Style dis = uim.createStyle("CheckBox.", "dis#", false);
FontImage checkedDis = FontImage.createMaterial(FontImage.MATERIAL_CHECK_BOX, dis);
FontImage uncheckedDis = FontImage.createMaterial(FontImage.MATERIAL_CHECK_BOX_OUTLINE_BLANK, sel);
if (focus) {
FontImage checkedSelected = FontImage.createMaterial(FontImage.MATERIAL_CHECK_BOX, sel);
FontImage uncheckedSelected = FontImage.createMaterial(FontImage.MATERIAL_CHECK_BOX_OUTLINE_BLANK, sel);
setCheckBoxFocusImages(checkedSelected, uncheckedSelected, checkedDis, uncheckedDis);
} else {
FontImage checkedUnselected = FontImage.createMaterial(FontImage.MATERIAL_CHECK_BOX, unsel);
FontImage uncheckedUnselected = FontImage.createMaterial(FontImage.MATERIAL_CHECK_BOX_OUTLINE_BLANK, unsel);
setCheckBoxImages(checkedUnselected, uncheckedUnselected, checkedDis, uncheckedDis);
}
}
}
use of com.codename1.ui.plaf.UIManager in project CodenameOne by codenameone.
the class DefaultLookAndFeel method refreshTheme.
/**
* {@inheritDoc}
*/
public void refreshTheme(boolean b) {
chkBoxImages = null;
comboImage = null;
rButtonImages = null;
chkBoxImagesFocus = null;
rButtonImagesFocus = null;
super.refreshTheme(b);
UIManager m = getUIManager();
Image combo = m.getThemeImageConstant("comboImage");
if (combo != null) {
setComboBoxImage(combo);
} else {
if (Font.isNativeFontSchemeSupported()) {
Style c = UIManager.getInstance().createStyle("ComboBox.", "", false);
combo = FontImage.createMaterial(FontImage.MATERIAL_ARROW_DROP_DOWN, c);
setComboBoxImage(combo);
}
}
updateCheckBoxConstants(m, false, "");
updateCheckBoxConstants(m, true, "Focus");
updateRadioButtonConstants(m, false, "");
updateRadioButtonConstants(m, true, "Focus");
}
Aggregations