use of com.servoy.j2db.persistence.Style in project servoy-client by Servoy.
the class ClientPluginAccessProvider method getStyleSheet.
/*
* (non-Javadoc)
*
* @see com.servoy.j2db.plugins.IClientPluginAccess#getStyleSheet(java.lang.String)
*/
public IStyleSheet getStyleSheet(String name) {
FlattenedSolution flattenedSolution = application.getFlattenedSolution();
if (flattenedSolution == null) {
// when called before flattened solution is set.
return null;
}
String style_name = ComponentFactory.getOverriddenStyleName(application, name);
Style s = flattenedSolution.getStyle(style_name);
return ComponentFactory.getCSSStyle(application, s);
}
use of com.servoy.j2db.persistence.Style in project servoy-client by Servoy.
the class JSSolutionModel method newForm.
protected JSForm newForm(String name, String dataSource, String styleName, boolean show_in_menu, int width, int height, boolean isResponsive) {
FlattenedSolution fs = application.getFlattenedSolution();
try {
Style style = null;
if (styleName != null) {
style = fs.getStyle(styleName);
}
Form form = createNewForm(style, IdentDocumentValidator.checkName(name), dataSource, show_in_menu, new Dimension(width, height));
if (!isResponsive) {
form.createNewPart(Part.BODY, height);
} else {
form.setResponsiveLayout(true);
}
if (fs.getSolution().getSolutionType() == SolutionMetaData.MOBILE) {
// mobile solution, make the form mobile
form.putCustomMobileProperty(IMobileProperties.MOBILE_FORM.propertyName, Boolean.TRUE);
// set internal style name
form.setStyleName("_servoy_mobile");
}
application.getFormManager().addForm(form, false);
return instantiateForm(form, true);
} catch (RepositoryException e) {
throw new RuntimeException(e);
}
}
use of com.servoy.j2db.persistence.Style in project servoy-client by Servoy.
the class JSSolutionModel method newStyle.
/**
* Creates a new style with the given css content string under the given name.
*
* NOTE: Will throw an exception if a style with that name already exists.
*
* @sample
* var form = solutionModel.newForm('myForm','db:/my_server/my_table',null,true,1000,800);
* if (form.transparent == false)
* {
* var style = solutionModel.newStyle('myStyle','form { background-color: yellow; }');
* style.text = style.text + 'field { background-color: blue; }';
* form.styleName = 'myStyle';
* }
* var field = form.newField('columnTextDataProvider',JSField.TEXT_FIELD,100,100,100,50);
* forms['myForm'].controller.show();
*
* @param name the name of the new style
*
* @param content the css content of the new style
*
* @return a JSStyle object
*/
@JSFunction
public JSStyle newStyle(String name, String content) {
Style style = application.getFlattenedSolution().createStyle(name, null);
if (style == null) {
return null;
}
JSStyle jsStyle = new JSStyle(application, style, true);
jsStyle.setText(content);
return jsStyle;
}
use of com.servoy.j2db.persistence.Style in project servoy-client by Servoy.
the class J2DBClient method closeSolution.
@Override
public boolean closeSolution(boolean force, Object[] args) {
if (getSolution() == null || isClosing)
return true;
// $NON-NLS-1$
blockGUI(Messages.getString("servoy.client.status.closingsolution"));
try {
if (!super.closeSolution(force, args))
return false;
if (frame != null)
frame.setTitle(getDisplayApplicationName());
// delete all dialogs
Iterator<Window> it = dialogs.values().iterator();
while (it.hasNext()) {
Window element = it.next();
element.dispose();
}
dialogs = new HashMap<String, Window>();
Collection<Style> userStyles = getFlattenedSolution().flushUserStyles();
if (userStyles != null) {
for (Style style : userStyles) {
ComponentFactory.flushStyle(this, style);
}
}
// $NON-NLS-1$
setStatusText("", null);
ComponentFactory.flushCachedItems(this);
invokeLater(new // make some stuff later null so its not created again
Runnable() {
public void run() {
editLabel.setIcon(empty);
insertModeLabel.setIcon(empty);
transactionLabel.setIcon(empty);
lockLabel.setIcon(empty);
dataChangeLabel.setIcon(empty);
invokeLater(new Runnable() {
public void run() {
if (getSolution() == null && getClientInfo() != null) {
// select new solution, run later because logout may trigger a login dialog as well
handleClientUserUidChanged(null, getClientInfo().getUserUid());
}
}
});
}
});
// SmartClient needs to flush the Perist cache because reloading them does create a new instance of the solution
PersistIndexCache.flush();
return true;
} catch (Exception ex) {
Debug.error(ex);
return false;
} finally {
releaseGUI();
}
}
use of com.servoy.j2db.persistence.Style in project servoy-client by Servoy.
the class JSSolutionModel method removeStyle.
/**
* Removes the specified style.
*
* @sample
* var s = solutionModel.newStyle("smStyle1",'form { background-color: yellow; }');
* var status = solutionModel.removeStyle("smStyle1");
* if (status == false) application.output("Could not remove style.");
* else application.output("Style removed.");
*
* @param name the name of the style to be removed
*
* @return true if the removal was successful, false otherwise
*/
@JSFunction
public boolean removeStyle(String name) {
FlattenedSolution fs = application.getFlattenedSolution();
Style style = fs.getStyle(name);
if (style != null) {
fs.removeStyle(name);
return true;
}
return false;
}
Aggregations