use of org.pentaho.gwt.widgets.client.utils.string.StringTokenizer in project pentaho-platform by pentaho.
the class DeleteFileCommand method performOperation.
protected void performOperation() {
if (this.getSolutionPath() != null && this.getFileNames() != null && this.getFileIds() != null) {
StringTokenizer pathTk = new StringTokenizer(this.getSolutionPath(), "\n");
StringTokenizer nameTk = new StringTokenizer(this.getFileNames(), "\n");
StringTokenizer idTk = new StringTokenizer(this.getFileIds(), "\n");
// Build Arrays since we cannot pass complex objects from the js bus
for (int i = 0; i < pathTk.countTokens(); i++) {
filesToDelete.add(new SolutionBrowserFile(idTk.tokenAt(i), nameTk.tokenAt(i), pathTk.tokenAt(i)));
}
performOperation(true);
} else {
performOperation(true);
}
}
use of org.pentaho.gwt.widgets.client.utils.string.StringTokenizer in project pentaho-platform by pentaho.
the class MantleController method executeAdminContent.
private void executeAdminContent() {
try {
RequestCallback internalCallback = new RequestCallback() {
public void onError(Request request, Throwable exception) {
}
public void onResponseReceived(Request request, Response response) {
JsArray<JsSetting> jsSettings = null;
try {
jsSettings = JsSetting.parseSettingsJson(response.getText());
} catch (Throwable t) {
// happens when there are no settings
}
if (jsSettings == null) {
return;
}
for (int i = 0; i < jsSettings.length(); i++) {
String content = jsSettings.get(i).getValue();
// $NON-NLS-1$
StringTokenizer nameValuePairs = new StringTokenizer(content, ";");
String perspective = null, content_panel_id = null, content_url = null;
for (int j = 0; j < nameValuePairs.countTokens(); j++) {
String currentToken = nameValuePairs.tokenAt(j).trim();
if (currentToken.startsWith("perspective=")) {
// $NON-NLS-1$
// $NON-NLS-1$
perspective = currentToken.substring("perspective=".length());
}
if (currentToken.startsWith("content-panel-id=")) {
// $NON-NLS-1$
// $NON-NLS-1$
content_panel_id = currentToken.substring("content-panel-id=".length());
}
if (currentToken.startsWith("content-url=")) {
// $NON-NLS-1$
// $NON-NLS-1$
content_url = currentToken.substring("content-url=".length());
}
}
if (content_panel_id != null && content_url != null) {
overrideContentPanelId = content_panel_id;
overrideContentUrl = content_url;
}
if (perspective != null) {
PerspectiveManager.getInstance().setPerspective(perspective);
}
if (perspective == null && content_panel_id == null && content_url == null) {
GwtMessageBox warning = new GwtMessageBox();
// $NON-NLS-1$
warning.setTitle(Messages.getString("warning"));
warning.setMessage(content);
warning.setButtons(new Object[GwtMessageBox.ACCEPT]);
// $NON-NLS-1$
warning.setAcceptLabel(Messages.getString("close"));
warning.show();
}
}
}
};
RequestBuilder builder = // $NON-NLS-1$
new RequestBuilder(RequestBuilder.GET, GWT.getHostPageBaseURL() + "api/mantle/getAdminContent");
builder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
// $NON-NLS-1$ //$NON-NLS-2$
builder.setHeader("accept", "application/json");
builder.sendRequest(null, internalCallback);
// TO DO Reset the menuItem click for browser and workspace here?
} catch (RequestException e) {
// ignore
}
}
use of org.pentaho.gwt.widgets.client.utils.string.StringTokenizer in project pentaho-platform by pentaho.
the class SolutionTree method select.
public void select(String path) {
this.selectedPath = path;
ArrayList<String> pathSegments = new ArrayList<String>();
if (path != null) {
if (path.startsWith("/")) {
// $NON-NLS-1$
path = path.substring(1);
}
StringTokenizer st = new StringTokenizer(path, '/');
for (int i = 0; i < st.countTokens(); i++) {
String token = st.tokenAt(i);
pathSegments.add(token);
}
}
TreeItem item = getTreeItem(pathSegments);
selectedItem = item;
ArrayList<TreeItem> parents = new ArrayList<TreeItem>();
if (item != null) {
this.setSelectedItem(item, false);
parents.add(item);
item = item.getParentItem();
while (item != null) {
parents.add(item);
item = item.getParentItem();
}
Collections.reverse(parents);
selectFromList(parents);
// this.setSelectedItem(selectedItem, false);
// selectedItem.setSelected(true);
}
}
use of org.pentaho.gwt.widgets.client.utils.string.StringTokenizer in project pentaho-platform by pentaho.
the class JsCreateNewConfig method getActionUrl.
public final String getActionUrl() {
String value = getValue();
StringTokenizer st = new StringTokenizer(value, ',');
return st.tokenAt(3).trim();
}
use of org.pentaho.gwt.widgets.client.utils.string.StringTokenizer in project pentaho-platform by pentaho.
the class JsCreateNewConfig method getEnabledUrl.
public final String getEnabledUrl() {
String value = getValue();
StringTokenizer st = new StringTokenizer(value, ',');
if (st.countTokens() < 5) {
return null;
} else {
return st.tokenAt(4).trim();
}
}
Aggregations