Search in sources :

Example 1 with DockLayoutPanel

use of com.google.gwt.user.client.ui.DockLayoutPanel in project rstudio by rstudio.

the class EditSnippetsDialog method createMainWidget.

@Override
protected Widget createMainWidget() {
    panel_ = new DockLayoutPanel(Unit.PX);
    // compute the widget size and set it
    Size size = new Size(900, 900);
    size = DomMetrics.adjustedElementSize(size, null, // pad
    70, // client margin
    100);
    panel_.setWidth(size.width + "px");
    panel_.setHeight(size.height + "px");
    // snippet types
    snippetTypes_ = new WidgetListBox<EditableSnippets>();
    snippetTypes_.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            updateEditor(snippetTypes_.getSelectedItem());
        }
    });
    snippetTypes_.addItem(new EditableSnippets("R", FileTypeRegistry.R));
    snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.CPP));
    snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.MARKDOWN));
    snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.TEX));
    snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.JS));
    snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.HTML));
    snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.CSS));
    snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.SQL));
    snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.JAVA));
    snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.PYTHON));
    snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.STAN));
    panel_.addWest(snippetTypes_, 150);
    // editor
    docDisplay_ = new AceEditor();
    docDisplay_.setUseSoftTabs(false);
    docDisplay_.setTabSize(uiPrefs_.numSpacesForTab().getValue());
    docDisplay_.addValueChangeHandler(new ValueChangeHandler<Void>() {

        @Override
        public void onValueChange(ValueChangeEvent<Void> event) {
            editorDirty_ = true;
        }
    });
    docDisplay_.setFileType(FileTypeRegistry.SNIPPETS);
    SimplePanel panel = new SimplePanel();
    panel.addStyleName("EditDialog");
    panel.getElement().getStyle().setMarginLeft(8, Unit.PX);
    panel.setWidget(docDisplay_.asWidget());
    panel_.add(panel);
    TextEditingTarget.syncFontSize(releaseOnDismiss_, events_, this, fontSizeManager_);
    snippetTypes_.setSelectedIndex(0, true);
    return panel_;
}
Also used : ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ValueChangeEvent(com.google.gwt.event.logical.shared.ValueChangeEvent) DockLayoutPanel(com.google.gwt.user.client.ui.DockLayoutPanel) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) Size(org.rstudio.core.client.Size) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) AceEditor(org.rstudio.studio.client.workbench.views.source.editors.text.AceEditor) Void(org.rstudio.studio.client.server.Void)

Example 2 with DockLayoutPanel

use of com.google.gwt.user.client.ui.DockLayoutPanel in project rstudio by rstudio.

the class ToolbarPane method createWidget.

@Override
protected Widget createWidget() {
    dockPanel_ = new DockLayoutPanel(Style.Unit.PX);
    dockPanel_.setSize("100%", "100%");
    mainToolbar_ = createMainToolbar();
    if (mainToolbar_ != null)
        addToolbar(mainToolbar_);
    secondaryToolbar_ = createSecondaryToolbar();
    if (secondaryToolbar_ != null)
        addToolbar(secondaryToolbar_);
    mainWidget_ = createMainWidget();
    mainWidget_.setSize("100%", "100%");
    progressPanel_ = new SimplePanelWithProgress();
    progressPanel_.setSize("100%", "100%");
    progressPanel_.setWidget(mainWidget_);
    dockPanel_.add(progressPanel_);
    AutoGlassPanel glassPanel = new AutoGlassPanel(dockPanel_);
    glassPanel.setSize("100%", "100%");
    return glassPanel;
}
Also used : SimplePanelWithProgress(org.rstudio.core.client.widget.SimplePanelWithProgress) DockLayoutPanel(com.google.gwt.user.client.ui.DockLayoutPanel) AutoGlassPanel(org.rstudio.studio.client.common.AutoGlassPanel)

Example 3 with DockLayoutPanel

use of com.google.gwt.user.client.ui.DockLayoutPanel in project rstudio by rstudio.

the class FilesPane method createMainWidget.

@Override
protected Widget createMainWidget() {
    filePathToolbar_ = new FilePathToolbar(new DisplayObserverProxy());
    // create file list and file progress
    filesList_ = new FilesList(new DisplayObserverProxy(), fileTypeRegistry_);
    DockLayoutPanel dockPanel = new DockLayoutPanel(Unit.PX);
    dockPanel.addNorth(filePathToolbar_, filePathToolbar_.getHeight());
    dockPanel.add(filesList_);
    // return container
    return dockPanel;
}
Also used : DockLayoutPanel(com.google.gwt.user.client.ui.DockLayoutPanel)

Example 4 with DockLayoutPanel

use of com.google.gwt.user.client.ui.DockLayoutPanel in project perun by CESNET.

the class TestDataGridAttributesTabItem method draw.

public Widget draw() {
    //contentWidget.setSize("100%", "100%");
    DockLayoutPanel ft = new DockLayoutPanel(Style.Unit.PX);
    contentWidget.setWidget(ft);
    final DataGrid gridTable = new DataGrid();
    gridTable.setSize("100%", "100%");
    final ArrayList<Attribute> vosList = new ArrayList<Attribute>();
    final GetAttributesV2 getVos = new GetAttributesV2(new JsonCallbackEvents() {

        public void onFinished(JavaScriptObject jso) {
            vosList.addAll(new TableSorter<Attribute>().sortByAttrNameTranslation(JsonUtils.<Attribute>jsoAsList(jso)));
            gridTable.setRowData(vosList);
            gridTable.redraw();
        }
    });
    getVos.getUserAttributes(3411);
    getVos.retrieveData();
    gridTable.setSelectionModel(new MultiSelectionModel<Attribute>(new GeneralKeyProvider<Attribute>()));
    final SelectionModel<Attribute> selectionModel = gridTable.getSelectionModel();
    gridTable.setKeyboardSelectionPolicy(HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.DISABLED);
    Column<Attribute, Boolean> checkBoxColumn = new Column<Attribute, Boolean>(new CheckboxCell(true, true)) {

        @Override
        public Boolean getValue(Attribute object) {
            // Get the value from the selection model.
            return selectionModel.isSelected(object);
        }
    };
    checkBoxColumn.setFieldUpdater(new FieldUpdater<Attribute, Boolean>() {

        @Override
        public void update(int i, Attribute Attribute, Boolean aBoolean) {
            selectionModel.setSelected(Attribute, aBoolean);
        }
    });
    // Checkbox column header
    CheckboxCell cb = new CheckboxCell();
    Header<Boolean> checkBoxHeader = new Header<Boolean>(cb) {

        public Boolean getValue() {
            //return true to see a checked checkbox.
            return false;
        }
    };
    checkBoxHeader.setUpdater(new ValueUpdater<Boolean>() {

        public void update(Boolean value) {
            // sets selected to all, if value = true, unselect otherwise
            for (Attribute obj : vosList) {
                selectionModel.setSelected(obj, value);
            }
        }
    });
    gridTable.addColumn(checkBoxColumn, checkBoxHeader, checkBoxHeader);
    gridTable.setColumnWidth(checkBoxColumn, 40.0, Style.Unit.PX);
    TextColumn<Attribute> idColumn = new TextColumn<Attribute>() {

        @Override
        public String getValue(Attribute object) {
            return String.valueOf(object.getId());
        }
    };
    if (JsonUtils.isExtendedInfoVisible()) {
        gridTable.addColumn(idColumn, "Id", "Id");
        gridTable.setColumnWidth(idColumn, "90px");
    }
    // Name column
    Column<Attribute, Attribute> nameColumn = JsonUtils.addColumn(new PerunAttributeNameCell());
    // Description column
    Column<Attribute, Attribute> descriptionColumn = JsonUtils.addColumn(new PerunAttributeDescriptionCell());
    // Value column
    Column<Attribute, Attribute> valueColumn = JsonUtils.addColumn(new PerunAttributeValueCell(), new FieldUpdater<Attribute, Attribute>() {

        public void update(int index, Attribute object, Attribute value) {
            object = value;
            selectionModel.setSelected(object, object.isAttributeValid());
        }
    });
    ColumnSortEvent.ListHandler<Attribute> columnSortHandler = new ColumnSortEvent.ListHandler<Attribute>(vosList);
    gridTable.addColumnSortHandler(columnSortHandler);
    // Sorting name column
    nameColumn.setSortable(true);
    columnSortHandler.setComparator(nameColumn, new AttributeComparator<Attribute>(AttributeComparator.Column.TRANSLATED_NAME));
    // Sorting description column
    descriptionColumn.setSortable(true);
    columnSortHandler.setComparator(descriptionColumn, new AttributeComparator<Attribute>(AttributeComparator.Column.TRANSLATED_DESCRIPTION));
    // Add sorting
    gridTable.addColumnSortHandler(columnSortHandler);
    // updates the columns size
    gridTable.setColumnWidth(nameColumn, 200.0, Style.Unit.PX);
    gridTable.setColumnWidth(valueColumn, 420.0, Style.Unit.PX);
    gridTable.addColumn(nameColumn, "Name");
    gridTable.addColumn(valueColumn, "Value");
    gridTable.addColumn(descriptionColumn, "Description");
    TabMenu tabMenu = new TabMenu();
    tabMenu.addWidget(TabMenu.getPredefinedButton(ButtonType.ADD, "", new ClickHandler() {

        @Override
        public void onClick(ClickEvent clickEvent) {
            session.getTabManager().addTabToCurrentTab(new TestDataGridTabItem(), true);
        }
    }));
    ft.addNorth(tabMenu, 50);
    ft.add(gridTable);
    return getWidget();
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) Attribute(cz.metacentrum.perun.webgui.model.Attribute) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ArrayList(java.util.ArrayList) CheckboxCell(com.google.gwt.cell.client.CheckboxCell) PerunAttributeValueCell(cz.metacentrum.perun.webgui.widgets.cells.PerunAttributeValueCell) GetAttributesV2(cz.metacentrum.perun.webgui.json.attributesManager.GetAttributesV2) GeneralKeyProvider(cz.metacentrum.perun.webgui.json.keyproviders.GeneralKeyProvider) PerunAttributeNameCell(cz.metacentrum.perun.webgui.widgets.cells.PerunAttributeNameCell) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) PerunAttributeDescriptionCell(cz.metacentrum.perun.webgui.widgets.cells.PerunAttributeDescriptionCell) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) DockLayoutPanel(com.google.gwt.user.client.ui.DockLayoutPanel) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject)

Example 5 with DockLayoutPanel

use of com.google.gwt.user.client.ui.DockLayoutPanel in project opennms by OpenNMS.

the class Application method onModuleLoad.

/**
   * This is the entry point method.
   */
public void onModuleLoad() {
    m_chartService = new DefaultChartService();
    Image img = new Image();
    img.setUrl("../images/logo.png");
    img.getElement().getStyle().setPaddingTop(14, Unit.PX);
    img.getElement().getStyle().setPaddingLeft(14, Unit.PX);
    FlowPanel header = new FlowPanel();
    header.getElement().setId("header");
    header.add(img);
    final DockLayoutPanel dockLayoutPanel = new DockLayoutPanel(Unit.PX);
    dockLayoutPanel.addNorth(header, 75.00);
    RootLayoutPanel.get().add(dockLayoutPanel);
    m_nav = new Navigation();
    m_nav.addLocationUpdateEventHandler(this);
    m_nav.addHostUpdateEventHandler(this);
    m_flowPanel = new FlowPanel();
    Runnable timelineCallback = new Runnable() {

        public void run() {
            m_chartService.getAllLocationsAvailability(new RequestCallback() {

                @Override
                public void onResponseReceived(Request request, Response response) {
                    if (response.getStatusCode() == 200) {
                        m_timeline = new AnnotatedTimeLine(ChartUtils.convertJSONToDataTable(response.getText()), createTimelineOptions(), "440px", "250px");
                        m_flowPanel.add(m_timeline);
                        m_flowPanel.add(m_nav);
                        dockLayoutPanel.add(m_flowPanel);
                    }
                }

                @Override
                public void onError(Request request, Throwable exception) {
                    Window.alert("Error Initializing Chart");
                }
            });
        }
    };
    VisualizationUtils.loadVisualizationApi(timelineCallback, AnnotatedTimeLine.PACKAGE);
    initializeNav();
}
Also used : Response(com.google.gwt.http.client.Response) AnnotatedTimeLine(com.google.gwt.visualization.client.visualizations.AnnotatedTimeLine) RequestCallback(com.google.gwt.http.client.RequestCallback) DockLayoutPanel(com.google.gwt.user.client.ui.DockLayoutPanel) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Request(com.google.gwt.http.client.Request) Image(com.google.gwt.user.client.ui.Image)

Aggregations

DockLayoutPanel (com.google.gwt.user.client.ui.DockLayoutPanel)5 CheckboxCell (com.google.gwt.cell.client.CheckboxCell)1 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)1 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)1 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)1 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 ValueChangeEvent (com.google.gwt.event.logical.shared.ValueChangeEvent)1 ValueChangeHandler (com.google.gwt.event.logical.shared.ValueChangeHandler)1 Request (com.google.gwt.http.client.Request)1 RequestCallback (com.google.gwt.http.client.RequestCallback)1 Response (com.google.gwt.http.client.Response)1 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)1 Image (com.google.gwt.user.client.ui.Image)1 SimplePanel (com.google.gwt.user.client.ui.SimplePanel)1 AnnotatedTimeLine (com.google.gwt.visualization.client.visualizations.AnnotatedTimeLine)1 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)1 GetAttributesV2 (cz.metacentrum.perun.webgui.json.attributesManager.GetAttributesV2)1 GeneralKeyProvider (cz.metacentrum.perun.webgui.json.keyproviders.GeneralKeyProvider)1 Attribute (cz.metacentrum.perun.webgui.model.Attribute)1