
ide.resource-dialogs.jsx Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of DevCenter Show documentation
Show all versions of DevCenter Show documentation
Prompto Development Center POM
The newest version!
const { Modal, Button, FormGroup, ControlLabel, InputGroup, FormControl } = ReactBootstrap;
const DroppedFileWidget = widgets.DroppedFileWidget.default;
class NewFileResourceDialog extends React.Component {
constructor(props) {
super(props);
const cleanName = getParam("name").toLowerCase().replace(/ /g, "-");
this.state = {show: true, folder: cleanName, name: "", file: null};
this.handleClose = this.handleClose.bind(this);
this.handleFolder = this.handleFolder.bind(this);
this.handleName = this.handleName.bind(this);
this.handleDrop = this.handleDrop.bind(this);
this.handleCreate = this.handleCreate.bind(this);
}
handleClose() {
this.setState({show: false});
this.props.onClose();
}
render() {
const droppedWidgetStyle = {
display: 'inline-flex',
border: '1px solid lightgray',
height: '650px',
width: '650px',
padding: '20px',
alignItems: 'center',
justifyContent: 'center'
};
return
New {this.props.type.label}
;
}
handleDrop(file) {
this.setState({ file: file, name: file.name });
}
handleFolder(event) {
this.setState({ folder: event.target.value });
}
handleName(event) {
this.setState({ name: event.target.value });
}
handleCreate(event) {
const path = this.state.folder + "/" + this.state.name;
const resource = this.props.type.createBinaryResource(path, this.state.file)
this.props.root.addResource(resource);
this.handleClose();
}
}
class NewTextResourceDialog extends React.Component {
constructor(props) {
super(props);
const cleanName = getParam("name").toLowerCase().replace(/ /g, "-");
this.state = {show: true, folder: cleanName, name: '', extension: this.props.type.id.toLowerCase()};
this.handleClose = this.handleClose.bind(this);
this.handleFolder = this.handleFolder.bind(this);
this.handleName = this.handleName.bind(this);
this.handleExtension = this.handleExtension.bind(this);
this.handleCreate = this.handleCreate.bind(this);
}
handleClose() {
this.setState({show: false});
this.props.onClose();
}
render() {
return
New {this.props.type.label}
;
}
handleFolder(event) {
this.setState({ folder: event.target.value });
}
handleName(event) {
this.setState({ name: event.target.value });
}
handleExtension(event) {
this.setState({ extension: event.target.value });
}
handleCreate(event) {
const path = this.state.folder + "/" + this.state.name + "." + this.state.extension;
const resource = this.props.type.createTextResource(path)
this.props.root.addResource(resource);
this.handleClose();
}
}
class RenameResourceDialog extends React.Component {
constructor(props) {
super(props);
const resourceName = this.props.resource.value.name;
const idx1 = resourceName.indexOf("/");
const folder = resourceName.substring(0, idx1);
const idx2 = resourceName.lastIndexOf(".");
const name = resourceName.substring(idx1 + 1, idx2);
const extension = resourceName.substring(idx2 + 1);
this.state = {show: true, folder: folder, name: name, extension: extension};
this.handleClose = this.handleClose.bind(this);
this.handleFolder = this.handleFolder.bind(this);
this.handleName = this.handleName.bind(this);
this.handleExtension = this.handleExtension.bind(this);
this.handleRename = this.handleRename.bind(this);
}
handleClose() {
this.setState({show: false});
this.props.onClose();
}
render() {
return
Rename resource
;
}
handleFolder(event) {
this.setState({ folder: event.target.value });
}
handleName(event) {
this.setState({ name: event.target.value });
}
handleExtension(event) {
this.setState({ extension: event.target.value });
}
handleRename(event) {
const path = this.state.folder + "/" + this.state.name + "." + this.state.extension;
this.props.root.renameResource(this.props.resource, path);
this.handleClose();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy