Example usage for com.google.gwt.user.client Window addResizeHandler

List of usage examples for com.google.gwt.user.client Window addResizeHandler

Introduction

In this page you can find the example usage for com.google.gwt.user.client Window addResizeHandler.

Prototype

public static HandlerRegistration addResizeHandler(ResizeHandler handler) 

Source Link

Usage

From source file:org.libredraw.client.DiagramList.java

License:Open Source License

private DiagramList() {
    initWidget(uiBinder.createAndBindUi(this));

    DiagramList.onResize();/*w  w  w.j av  a2 s.  com*/

    ProvidesKey<Diagram> KEY_PROVIDER = new ProvidesKey<Diagram>() {
        public Object getKey(Diagram d) {
            return d.id;
        }
    };

    final SelectionModel<Diagram> selectionModel = new MultiSelectionModel<Diagram>(KEY_PROVIDER);
    table.setSelectionModel(selectionModel, DefaultSelectionEventManager.<Diagram>createCheckboxManager());

    Window.addResizeHandler(new ResizeHandler() {
        public void onResize(ResizeEvent event) {
            DiagramList.onResize();
        }
    });

    Column<Diagram, Boolean> checkColumn = new Column<Diagram, Boolean>(new CheckboxCell(true, false)) {
        @Override
        public Boolean getValue(Diagram d) {
            return selectionModel.isSelected(d);
        }
    };

    TextColumn<Diagram> nameColumn = new TextColumn<Diagram>() {
        @Override
        public String getValue(Diagram d) {
            return d.m_name;
        }
    };

    TextColumn<Diagram> typeColumn = new TextColumn<Diagram>() {
        @Override
        public String getValue(Diagram d) {
            return d.m_type.toString();
        }
    };

    TextColumn<Diagram> modifiedColumn = new TextColumn<Diagram>() {
        @Override
        public String getValue(Diagram d) {
            return d.modifiedDate.toString();
        }
    };

    TextColumn<Diagram> modifiedByColumn = new TextColumn<Diagram>() {
        @Override
        public String getValue(Diagram d) {
            return d.modifiedBy.m_displayName;
        }
    };

    TextColumn<Diagram> createdOnColumn = new TextColumn<Diagram>() {
        @Override
        public String getValue(Diagram d) {
            return d.m_createdDate.toString();
        }
    };

    TextColumn<Diagram> ownerColumn = new TextColumn<Diagram>() {
        @Override
        public String getValue(Diagram d) {
            return d.owner.m_displayName;
        }
    };

    table.addColumn(checkColumn, "");
    table.addColumn(nameColumn, "Name");
    table.addColumn(typeColumn, "Type");
    table.addColumn(modifiedColumn, "Date Modified");
    table.addColumn(modifiedByColumn, "By");
    table.addColumn(createdOnColumn, "Created On");
    table.addColumn(ownerColumn, "Owner");

    table.setWidth("100%", true);
    table.setColumnWidth(checkColumn, 50.0, Unit.PX);

    table.addCellPreviewHandler(new CellPreviewEvent.Handler<Diagram>() {
        @Override
        public void onCellPreview(CellPreviewEvent<Diagram> event) {
            //TODO get a real double click event
            if ("click".equals(event.getNativeEvent().getType())) {
                if (event.getContext().getColumn() != 0) {
                    if (clickTracker == null)
                        clickTracker = new Date();
                    else {
                        long difference = new Date().getTime() - clickTracker.getTime();
                        if (difference <= 500) {
                            Diagram thisDiagram = event.getValue();
                            DiagramView.getInstance().setBranch(thisDiagram.master);
                            RootPanel.get("body").add(DiagramView.getInstance());
                            myRemove();
                            BreadCrumb.getInstance().registerDiagram(thisDiagram.m_name, "MASTER");
                        } else
                            clickTracker = new Date();
                    }
                }
            }
        }
    });

    newDiagramMenu.setCommand(new Command() {
        @Override
        public void execute() {
            TableView.registerDialog(new NewDiagramDialog(thisProject));
        }
    });

    refreshMenu.setCommand(new Command() {
        @Override
        public void execute() {
            refresh();
        }
    });

    editMenu.setCommand(new Command() {
        @Override
        public void execute() {
            int count = 0;
            Diagram selectedDiagram = null;
            for (Diagram d : diagramList) {
                logger.log(Level.WARNING, d.m_name);
                if (table.getSelectionModel().isSelected(d)) {
                    selectedDiagram = d;
                    count++;
                }
            }
            if (count > 1) {
                Window.alert("Please select only one diagram to edit.");
                return;
            }
            if (selectedDiagram != null) {
                TableView.registerDialog(new EditDiagramDialog(selectedDiagram));

            }
        }
    });

}

From source file:org.libredraw.client.ProjectList.java

License:Open Source License

private ProjectList() {
    initWidget(uiBinder.createAndBindUi(this));

    ProjectList.onResize();/*from   w w w .jav a 2 s  .  c o m*/

    Window.addResizeHandler(new ResizeHandler() {
        public void onResize(ResizeEvent event) {
            ProjectList.onResize();
        }
    });

    ProvidesKey<Project> KEY_PROVIDER = new ProvidesKey<Project>() {
        public Object getKey(Project p) {
            return p.id;
        }
    };

    final SelectionModel<Project> selectionModel = new MultiSelectionModel<Project>(KEY_PROVIDER);
    table.setSelectionModel(selectionModel, DefaultSelectionEventManager.<Project>createCheckboxManager());

    Column<Project, Boolean> checkColumn = new Column<Project, Boolean>(new CheckboxCell(true, false)) {
        @Override
        public Boolean getValue(Project p) {
            return selectionModel.isSelected(p);
        }
    };

    TextColumn<Project> nameColumn = new TextColumn<Project>() {
        @Override
        public String getValue(Project p) {
            return p.m_name;
        }
    };

    TextColumn<Project> modifiedColumn = new TextColumn<Project>() {
        @Override
        public String getValue(Project p) {
            return p.modified.toString();
        }
    };

    TextColumn<Project> modifiedByColumn = new TextColumn<Project>() {
        @Override
        public String getValue(Project p) {
            return p.modifiedBy.m_displayName;
        }
    };

    TextColumn<Project> createdOnColumn = new TextColumn<Project>() {
        @Override
        public String getValue(Project p) {
            return p.m_createdDate.toString();
        }
    };

    TextColumn<Project> ownerColumn = new TextColumn<Project>() {
        @Override
        public String getValue(Project p) {
            return p.owner.m_displayName;
        }
    };
    table.addColumn(checkColumn, "");
    table.addColumn(nameColumn, "Name");
    table.addColumn(modifiedColumn, "Date Modified");
    table.addColumn(modifiedByColumn, "By");
    table.addColumn(createdOnColumn, "Created On");
    table.addColumn(ownerColumn, "Owner");

    table.setWidth("100%", true);
    table.setColumnWidth(checkColumn, 50.0, Unit.PX);

    table.sinkEvents(Event.DBLCLICK);

    table.addCellPreviewHandler(new CellPreviewEvent.Handler<Project>() {
        @Override
        public void onCellPreview(CellPreviewEvent<Project> event) {
            //TODO get a real double click event
            if ("click".equals(event.getNativeEvent().getType())) {
                if (event.getContext().getColumn() != 0) {
                    if (clickTracker == null)
                        clickTracker = new Date();
                    else {
                        long difference = new Date().getTime() - clickTracker.getTime();
                        if (difference <= 500) {
                            Project thisProject = event.getValue();
                            DiagramList.getInstance().setProject(thisProject.id);
                            myRemove();
                            RootPanel.get("body").add(DiagramList.getInstance());
                            BreadCrumb.getInstance().registerProject(thisProject);
                        } else
                            clickTracker = new Date();
                    }
                }
            }
        }
    });

    newProjectMenu.setCommand(new Command() {
        public void execute() {
            TableView.registerDialog(new NewProjectDialog());
        }
    });
    refreshMenu.setCommand(new Command() {
        public void execute() {
            refresh();
        }
    });
    archiveMenu.setCommand(new Command() {
        public void execute() {
            DiagramView.getInstance().setBranch(1l);
            myRemove();
            RootPanel.get("body").add(DiagramView.getInstance());
        }
    });

    editMenu.setCommand(new Command() {
        @Override
        public void execute() {
            int count = 0;
            Project selectedProject = null;
            for (Project p : projectList) {
                if (table.getSelectionModel().isSelected(p)) {
                    selectedProject = p;
                    count++;
                }
            }
            if (count > 1) {
                Window.alert("Please select only one project to edit.");
                return;
            }
            if (selectedProject != null)
                TableView.registerDialog(new EditProjectDialog(selectedProject));
        }
    });

    refresh();

}

From source file:org.libredraw.client.umlclassdiagram.DiagramView.java

License:Open Source License

private DiagramView() {
    initWidget(uiBinder.createAndBindUi(this));

    ProvidesKey<DiagramEntity> KEY_PROVIDER = new ProvidesKey<DiagramEntity>() {
        public Object getKey(DiagramEntity d) {
            return d.entityKey;
        }/*from  w ww .  j a v a 2  s  .  co  m*/
    };

    final SelectionModel<DiagramEntity> selectionModel = new MultiSelectionModel<DiagramEntity>(KEY_PROVIDER);
    table.setSelectionModel(selectionModel,
            DefaultSelectionEventManager.<DiagramEntity>createCheckboxManager());

    tabPanel.selectTab(0);

    onResize();

    Column<DiagramEntity, Boolean> checkColumn = new Column<DiagramEntity, Boolean>(
            new CheckboxCell(true, false)) {
        @Override
        public Boolean getValue(DiagramEntity d) {
            return selectionModel.isSelected(d);
        }
    };

    TextColumn<DiagramEntity> nameColumn = new TextColumn<DiagramEntity>() {
        @Override
        public String getValue(DiagramEntity d) {
            return d.m_name;
        }
    };

    TextColumn<DiagramEntity> typeColumn = new TextColumn<DiagramEntity>() {
        @Override
        public String getValue(DiagramEntity d) {
            return d.entityKey.getKind();
        }
    };

    TextColumn<DiagramEntity> modifiedColumn = new TextColumn<DiagramEntity>() {
        @Override
        public String getValue(DiagramEntity d) {
            return d.m_modified.toString();
        }
    };

    TextColumn<DiagramEntity> modifiedByColumn = new TextColumn<DiagramEntity>() {
        @Override
        public String getValue(DiagramEntity d) {
            return d.modifiedBy.m_displayName;
        }
    };

    TextColumn<DiagramEntity> createdOnColumn = new TextColumn<DiagramEntity>() {
        @Override
        public String getValue(DiagramEntity d) {
            return d.m_created.toString();
        }
    };

    TextColumn<DiagramEntity> ownerColumn = new TextColumn<DiagramEntity>() {
        @Override
        public String getValue(DiagramEntity d) {
            return d.createdBy.m_displayName;
        }
    };

    TextColumn<DiagramEntity> lockedColumn = new TextColumn<DiagramEntity>() {
        @Override
        public String getValue(DiagramEntity d) {
            if (d.m_locked)
                return d.lockedBy.m_displayName;
            if (d.m_limited)
                return d.limitedBy.m_displayName;
            return null;
        }
    };

    table.addColumn(checkColumn, "");
    table.addColumn(nameColumn, "Name");
    table.addColumn(typeColumn, "Type");
    table.addColumn(modifiedColumn, "Date Modified");
    table.addColumn(modifiedByColumn, "By");
    table.addColumn(createdOnColumn, "Created On");
    table.addColumn(ownerColumn, "By");
    table.addColumn(lockedColumn, "Locked/Limited By");

    table.setWidth("100%", true);
    table.setColumnWidth(checkColumn, 50.0, Unit.PX);

    Window.addResizeHandler(new ResizeHandler() {
        public void onResize(ResizeEvent event) {
            DiagramView.onResize();
        }
    });

    newClassMenu.setCommand(new Command() {
        @Override
        public void execute() {
            TableView.registerDialog(new NewClassDialog(thisBranch));
        }
    });

    newInterfaceMenu.setCommand(new Command() {
        @Override
        public void execute() {
            TableView.registerDialog(new NewInterfaceDialog(thisBranch));
        }
    });

    newAssociationMenu.setCommand(new Command() {
        @Override
        public void execute() {
            TableView.registerDialog(new NewAssociationDialog(thisBranch, entities));
        }
    });

    refreshMenu.setCommand(new Command() {
        @Override
        public void execute() {
            refresh();
        }
    });

    classHandler = new AsyncCallback<Boolean>() {
        @Override
        public void onFailure(Throwable caught) {
            TableView.registerErrorDialog(new StackTrace(caught));
        }

        @Override
        public void onSuccess(Boolean result) {
            if (result)
                TableView.registerDialog(new EditClassDialog(entityCalled, thisBranch));
            else
                Window.alert("That is Locked");

        }
    };

    interfaceHandler = new AsyncCallback<Boolean>() {
        @Override
        public void onFailure(Throwable caught) {
            TableView.registerErrorDialog(new StackTrace(caught));
        }

        @Override
        public void onSuccess(Boolean result) {
            if (result)
                TableView.registerDialog(new EditInterfaceDialog(entityCalled, thisBranch));
            else
                Window.alert("That is Locked");
        }
    };

    associationHandler = new AsyncCallback<Boolean>() {
        @Override
        public void onFailure(Throwable caught) {
            TableView.registerErrorDialog(new StackTrace(caught));
        }

        @Override
        public void onSuccess(Boolean result) {
            if (result)
                TableView.registerDialog(new EditAssociationDialog(thisBranch, entities, entityCalled));
            else
                Window.alert("That is Locked");
        }
    };

    table.addCellPreviewHandler(new CellPreviewEvent.Handler<DiagramEntity>() {
        @Override
        public void onCellPreview(CellPreviewEvent<DiagramEntity> event) {
            //TODO get a real double click event
            if ("click".equals(event.getNativeEvent().getType())) {
                if (event.getContext().getColumn() != 0) {
                    if (clickTracker == null)
                        clickTracker = new Date();
                    else {
                        long difference = new Date().getTime() - clickTracker.getTime();
                        if (difference <= 500) {
                            DiagramEntity e = event.getValue();
                            entityCalled = e.entityKey;
                            if ("UMLClass".equals(e.entityKey.getKind())) {
                                LibreRPCService.lock(ClientSession.getInstance().getSessionId(), e.entityKey,
                                        classHandler);
                            } else if ("UMLInterface".equals(e.entityKey.getKind())) {
                                LibreRPCService.lock(ClientSession.getInstance().getSessionId(), e.entityKey,
                                        interfaceHandler);

                            } else if ("UMLAssociation".equals(e.entityKey.getKind())) {
                                LibreRPCService.lock(ClientSession.getInstance().getSessionId(), e.entityKey,
                                        associationHandler);
                            } else { // should never happen
                                Window.alert("generic error");
                            }
                        } else
                            clickTracker = new Date();
                    }
                }
            }
        }
    });

}

From source file:org.mindinformatics.gwt.domeo.client.Domeo.java

License:Apache License

public void completeInitialization() {

    // Preferences
    Preferences preferences = new Preferences(this);
    componentsManager.addComponent(preferences);

    // Images Cache
    imagesCache = new ImagesCache(this);
    componentsManager.addComponent(imagesCache);
    // Images mashup
    pmcImagesCache = new PmcImagesMetadataCache(this);

    // Resources/*  w  ww.j  a v  a  2  s .c  o  m*/
    componentsManager.addComponent(resourcesManager);

    // Style
    this.getCssManager().setStrategy(new AnnotationTypeStyleStrategy(this));

    // Persistence
    // persistenceManager = new AnnotationPersistenceManager(this);
    // componentsManager.addComponent(persistenceManager);
    _persistenceManager = this.selectPersistenceManager();
    if (_persistenceManager != null) {
        this.getLogger().debug(this.getClass().getName(),
                "Persistence manager selected " + _persistenceManager.getClass().getName());
        componentsManager.addComponent(_persistenceManager);
        pluginsManager.registerPlugin(PersistencePlugin.getInstance());
    }

    // Clipboard
    clipboardManager = new ClipboardManager();
    componentsManager.addComponent(clipboardManager);

    accessManager = new AnnotationAccessManager(this);
    componentsManager.addComponent(accessManager);
    // Components initialization
    componentsManager.initializeComponents();

    getInitializer().updateMessage("Creating Domeo UI...");

    domeoToolbarPanel = new DomeoToolbarPanel(this);
    componentsManager.addComponent(domeoToolbarPanel);
    p.addNorth(domeoToolbarPanel, 31);
    // p.addSouth(new HTML("footer"), 20);
    // p.addWest(s, 200);
    // placeholder.setStyleName("sidebarPlaceholder");

    sidePanelsFacade = new SidePanelsFacade(this, p);
    componentsManager.addComponent(sidePanelsFacade);
    p.addEast(sidePanelsFacade.getSidePanelsContainer(), 35);

    jsonUnmarshallingManager = new JsonUnmarshallingManager(this);

    // eastPanel = new EastPanelsContainer(this);
    // componentsManager.addComponent(eastPanel);
    // p.addEast(eastPanel, 15);
    contentPanel = new ContentPanel(this);
    p.add(contentPanel);

    resourcePanelsManager.registerResourcePanel(MGenericResource.class.getName(),
            new LGenericResourceCardPanel(this));
    // resourcePanelsManager.registerResourcePanel(MOnlineResource.class.getName(),
    // new LOnlineResourceCardPanel(this));
    resourcePanelsManager.registerResourcePanel(MDocumentResource.class.getName(),
            new LDocumentResourceCardPanel(this));

    // OMIM Plugin
    pluginsManager.registerPlugin(OmimPlugin.getInstance());
    if (_profileManager.getUserCurrentProfile().isPluginEnabled(OmimPlugin.getInstance().getPluginName())) {
        resourcePanelsManager.registerResourcePanel(MOmimDocument.class.getName(),
                new LOmimDocumentCardPanel(this));
        pluginsManager.enablePlugin(OmimPlugin.getInstance(), true);
    }
    // Open Trials Plugin
    pluginsManager.registerPlugin(OpenTrialsPlugin.getInstance());
    if (_profileManager.getUserCurrentProfile()
            .isPluginEnabled(OpenTrialsPlugin.getInstance().getPluginName())) {
        resourcePanelsManager.registerResourcePanel(MOpenTrialsDocument.class.getName(),
                new LOpenTrialsDocumentCardPanel(this));
        pluginsManager.enablePlugin(OpenTrialsPlugin.getInstance(), true);
    }
    // Pubmed Plugin and Pubmed Central Plugin
    // PMC plugin is dependent from the PubMed plugin
    pluginsManager.registerPlugin(PubMedPlugin.getInstance());
    pluginsManager.registerPlugin(PmcPlugin.getInstance());
    if (_profileManager.getUserCurrentProfile().isPluginEnabled(PubMedPlugin.getInstance().getPluginName())) {
        resourcePanelsManager.registerResourcePanel(MPubMedDocument.class.getName(),
                new LPubMedDocumentCardPanel(this));
        pluginsManager.enablePlugin(PubMedPlugin.getInstance(), true);
        if (_profileManager.getUserCurrentProfile().isPluginEnabled(PmcPlugin.getInstance().getPluginName())) {
            pluginsManager.enablePlugin(PmcPlugin.getInstance(), true);
        }
    }

    pluginsManager.registerPlugin(DocumentPlugin.getInstance(), true);
    pluginsManager.registerPlugin(BioPortalPlugin.getInstance(), true);

    annotationCardsManager.registerAnnotationCard(MAnnotationCitationReference.class.getName(),
            new ReferenceCardProvider(this));

    // Selection
    pluginsManager.registerPlugin(SelectionPlugin.getInstance(), true);
    annotationTailsManager.registerAnnotationTile(MSelectionAnnotation.class.getName(),
            new SelectionTileProvider(this));

    // Highlight
    pluginsManager.registerPlugin(HighlightPlugin.getInstance(), true);
    annotationTailsManager.registerAnnotationTile(MHighlightAnnotation.class.getName(),
            new HighlightTileProvider(this));
    annotationCardsManager.registerAnnotationCard(MHighlightAnnotation.class.getName(),
            new HighlightCardProvider(this));
    searchComponentsManager.registerAnnotationCard(MHighlightAnnotation.class.getName(),
            new HighligthSearchComponent(this));

    // SPLs
    pluginsManager.registerPlugin(SPLsPlugin.getInstance(), true);
    // pluginsManager.enablePlugin(SPLsPlugin.getInstance(), false);
    // Paolo added the check to see if the PLugin is enabled
    if (_profileManager.getUserCurrentProfile().isPluginEnabled(SPLsPlugin.getInstance().getPluginName())) {
        annotationFormsManager.registerAnnotationForm(MSPLsAnnotation.class.getName(),
                new SPLsFormProvider(this));
    }
    annotationTailsManager.registerAnnotationTile(MSPLsAnnotation.class.getName(), new SPLsTileProvider(this));
    annotationCardsManager.registerAnnotationCard(MSPLsAnnotation.class.getName(), new SPLsCardProvider(this));
    searchComponentsManager.registerAnnotationCard(MSPLsAnnotation.class.getName(),
            new SPLsSearchComponent(this));

    // Post It
    /*
     * pluginsManager.registerPlugin(PostitPlugin.getInstance(), true);
     * annotationFormsManager
     * .registerAnnotationForm(MPostItAnnotation.class.getName(), new
     * PostItFormProvider(this)); annotationTailsManager
     * .registerAnnotationTile(MPostItAnnotation.class.getName(), new
     * PostItTileProvider(this)); annotationCardsManager
     * .registerAnnotationCard(MPostItAnnotation.class.getName(), new
     * PostItCardProvider(this));
     * searchComponentsManager.registerAnnotationCard
     * (MPostItAnnotation.class .getName(), new
     * PostItSearchComponent(this));
     */

    // Qualifier

    pluginsManager.registerPlugin(QualifierPlugin.getInstance(), true);
    //pluginsManager.enablePlugin(QualifierPlugin.getInstance(), true);
    if (_profileManager.getUserCurrentProfile()
            .isPluginEnabled(QualifierPlugin.getInstance().getPluginName())) {
        annotationFormsManager.registerAnnotationForm(MQualifierAnnotation.class.getName(),
                new QualifierFormProvider(this));
    }
    annotationTailsManager.registerAnnotationTile(MQualifierAnnotation.class.getName(),
            new QualifierTileProvider(this));
    annotationCardsManager.registerAnnotationCard(MQualifierAnnotation.class.getName(),
            new QualifierCardProvider(this));
    searchComponentsManager.registerAnnotationCard(MQualifierAnnotation.class.getName(),
            new QualifierSearchComponent(this));

    annotationHelpersManager.registerAnnotationHelper(MQualifierAnnotation.class.getName(),
            new HQualifierHelper());

    // Curation
    annotationTailsManager.registerAnnotationTile(MCurationToken.class.getName(),
            new CurationTileProvider(this));

    // Antibody
    /*
     * pluginsManager.registerPlugin(AntibodyPlugin.getInstance(), true); //
     * pluginsManager.enablePlugin(AntibodyPlugin.getInstance(), true); if
     * (_profileManager.getUserCurrentProfile().isPluginEnabled(
     * AntibodyPlugin.getInstance().getPluginName())) {
     * annotationFormsManager.registerAnnotationForm(
     * MAntibodyAnnotation.class.getName(), new AntibodyFormProvider(this));
     * }
     * annotationTailsManager.registerAnnotationTile(MAntibodyAnnotation.class
     * .getName(), new AntibodyTileProvider(this));
     * annotationCardsManager.registerAnnotationCard
     * (MAntibodyAnnotation.class .getName(), new
     * AntibodyCardProvider(this));
     * searchComponentsManager.registerAnnotationCard(
     * MAntibodyAnnotation.class.getName(), new
     * AntibodySearchComponent(this));
     */

    // Micropublications
    pluginsManager.registerPlugin(MicroPublicationsPlugin.getInstance(), true);
    // pluginsManager.enablePlugin(MicroPublicationsPlugin.getInstance(),
    // false);
    if (_profileManager.getUserCurrentProfile()
            .isPluginEnabled(MicroPublicationsPlugin.getInstance().getPluginName())) {
        annotationFormsManager.registerAnnotationForm(MMicroPublicationAnnotation.class.getName(),
                new MicroPublicationFormProvider(this));
    }
    annotationTailsManager.registerAnnotationTile(MMicroPublicationAnnotation.class.getName(),
            new MicroPublicationTileProvider(this));
    annotationCardsManager.registerAnnotationCard(MMicroPublicationAnnotation.class.getName(),
            new MicroPublicationCardProvider(this));
    getAnnotationPersistenceManager().registerCache(new MicroPublicationCache());

    // Comments
    annotationTailsManager.registerAnnotationTile(MCommentAnnotation.class.getName(),
            new CommentTileProvider(this));

    // ddi
    pluginsManager.registerPlugin(ddiPlugin.getInstance(), true);

    if (_profileManager.getUserCurrentProfile().isPluginEnabled(ddiPlugin.getInstance().getPluginName())) {

        annotationFormsManager.registerAnnotationForm(MddiAnnotation.class.getName(),
                new ddiFormProvider(this));
    }

    annotationTailsManager.registerAnnotationTile(MddiAnnotation.class.getName(), new ddiTileProvider(this));
    annotationCardsManager.registerAnnotationCard(MddiAnnotation.class.getName(), new ddiCardProvider(this));

    // Comments
    annotationTailsManager.registerAnnotationTile(MCommentAnnotation.class.getName(),
            new CommentTileProvider(this));
    annotationTailsManager.registerAnnotationTile(MLinearCommentAnnotation.class.getName(),
            new LinearCommentTileProvider(this));

    // Digesters
    linkedDataDigestersManager.registerLnkedDataDigester(new NifStandardDigester());
    linkedDataDigestersManager.registerLnkedDataDigester(new BioPortalTermsDigester());

    sideTabPanel = sidePanelsFacade.getSideTabsContainer();

    final ASideTab annotationsSideTab = new AnnotationSideTab(this, sidePanelsFacade);
    final ASideTab resourceSideTab = new ResourceSideTab(this, sidePanelsFacade);
    final ASideTab annotationSetsSideTab2 = new AnnotationSetSideTab(this, sidePanelsFacade);
    final ASideTab clipboardSideTab = new ClipboardSideTab(this, sidePanelsFacade);

    AnnotationSidePanel annotationSidePanel = new AnnotationSidePanel(this, sidePanelsFacade,
            annotationsSideTab);
    ResourceSidePanel resourceSidePanel = new ResourceSidePanel(this, sidePanelsFacade, resourceSideTab);
    AnnotationSetsSidePanel annotationSetsSidePanel2 = new AnnotationSetsSidePanel(this, sidePanelsFacade,
            annotationSetsSideTab2);
    ClipboardSidePanel clipboardSidePanel = new ClipboardSidePanel(this, sidePanelsFacade, clipboardSideTab);

    sidePanelsFacade.registerSideComponent(resourceSideTab, resourceSidePanel,
            (ResourceSideTab.HEIGHT + 16) + "px");
    sidePanelsFacade.registerSideComponent(annotationsSideTab, annotationSidePanel,
            (AnnotationSideTab.HEIGHT + 16) + "px");
    sidePanelsFacade.registerSideComponent(annotationSetsSideTab2, annotationSetsSidePanel2,
            (AnnotationSetSideTab.HEIGHT + 16) + "px");

    /*
     * discussionSideTab = new CommentSideTab(this, sidePanelsFacade); //
     * if(
     * ((BooleanPreference)getPreferences().getPreferenceItem(Domeo.class.
     * getName(), Domeo.PREF_ALLOW_COMMENTING)).getValue()) {
     * CommentSidePanel commentSidePanel = new CommentSidePanel(this,
     * sidePanelsFacade, discussionSideTab);
     * sidePanelsFacade.registerSideComponent(discussionSideTab,
     * commentSidePanel, (CommentSideTab.HEIGHT+16) + "px"); }
     */

    commentsSideTab = new LinearCommentsSideTab(this, sidePanelsFacade);
    if (((BooleanPreference) getPreferences().getPreferenceItem(Domeo.class.getName(),
            Domeo.PREF_ALLOW_COMMENTING)).getValue()) {
        LinearCommentsSidePanel commentsSidePanel = new LinearCommentsSidePanel(this, sidePanelsFacade,
                discussionSideTab);
        sidePanelsFacade.registerSideComponent(commentsSideTab, commentsSidePanel,
                (LinearCommentsSideTab.HEIGHT + 16) + "px");
    }

    if (((BooleanPreference) this.getPreferences().getPreferenceItem(Application.class.getName(),
            Domeo.PREF_ANN_MULTIPLE_TARGETS)) != null
            && ((BooleanPreference) this.getPreferences().getPreferenceItem(Application.class.getName(),
                    Domeo.PREF_ANN_MULTIPLE_TARGETS)).getValue()) {
        sidePanelsFacade.registerSideComponent(clipboardSideTab, clipboardSidePanel,
                (ClipboardSideTab.HEIGHT + 16) + "px");
    }

    if (((BooleanPreference) getPreferences().getPreferenceItem(Domeo.class.getName(),
            Domeo.PREF_DISPLAY_ANNOTATION_FOR_DEBUG)).getValue()) {
        final ASideTab annotationsDebugSideTab = new AnnotationDebugSideTab(this, sidePanelsFacade);

        AnnotationDebugSidePanel annotationDebugSidePanel = new AnnotationDebugSidePanel(this, sidePanelsFacade,
                annotationsDebugSideTab);
        componentsManager.addComponent(annotationDebugSidePanel);

        sidePanelsFacade.registerSideComponent(annotationsDebugSideTab, annotationDebugSidePanel,
                (AnnotationDebugSideTab.HEIGHT + 16) + "px");
    }

    // Filters
    urlEncodersManager = new UrlEncodersManager();
    urlEncodersManager.registerFilter(new ScienceDirectUrlFilter());

    // -----------------------------------
    // TEXT MINING SERVICES REGISTRATION
    // ===================================
    TextMiningRegistry.getInstance(this).registerTextMiningService(BioPortalManager.getInstance());
    TextMiningRegistry.getInstance(this).registerTextMiningService(NifManager.getInstance());

    RootPanel rpp = RootPanel.get();
    rpp.add(sideTabPanel);

    // Add the nameField and sendButton to the RootPanel
    // Use RootPanel.get() to get the entire body element
    // Attach the LayoutPanel to the RootLayoutPanel. The latter will listen
    // for
    // resize events on the window to ensure that its children are informed
    // of
    // possible size changes.
    RootLayoutPanel rp = RootLayoutPanel.get();
    getInitializer().removeFromParent();
    rp.add(p);

    Window.addResizeHandler(new ResizeHandler() {
        /*
         * Timer resizeTimer = new Timer() {
         * 
         * @Override public void run() { Window.alert("Resized"); } };
         */

        @Override
        public void onResize(ResizeEvent event) {
            // resizeTimer.cancel();
            // resizeTimer.schedule(250);
            notifyResizing();
        }
    });

    this.logger.info(this, "Domeo Creation completed");
    this.logger.info(this, "-------------------------------------");
    extractorsManager = new ContentExtractorsManager(this);
    componentsManager.addComponent(extractorsManager);

    /*
     * if(!ApplicationUtils.getUrlParameter("url").isEmpty())
     * Window.alert("Url: " + ApplicationUtils.getUrlParameter("url"));
     * if(!ApplicationUtils.getUrlParameter("setId").isEmpty())
     * Window.alert("Url: " + ApplicationUtils.getUrlParameter("setId"));
     * if(!ApplicationUtils.getUrlParameter("setIds").isEmpty())
     * Window.alert("Url: " + ApplicationUtils.getUrlParameter("setIds"));
     */

    if (!ApplicationUtils.getUrlParameter("url").isEmpty()) {
        domeoToolbarPanel.getAddressBarPanel()
                .setAddress(ApplicationUtils.decodeURIComponent(ApplicationUtils.getUrlParameter("url")));
        this.attemptContentLoading(
                ApplicationUtils.decodeURIComponent(ApplicationUtils.getUrlParameter("url")));
    }

    /*
     * if(ApplicationUtils.getDocumentUrl()!=null &&
     * ApplicationUtils.getDocumentUrl().trim().length()>13) {
     * domeoToolbarPanel
     * .getAddressBarPanel().setAddress(ApplicationUtils.getDocumentUrl());
     * this.attemptContentLoading(ApplicationUtils.getDocumentUrl()); }
     */
}

From source file:org.nsesa.editor.gwt.editor.client.Editor.java

License:EUPL

/**
 * Registers the listeners.//from w  ww  .  j  a v a 2 s. c o m
 */
protected void registerEventListeners() {
    // register the basic event listeners
    final EventBus eventBus = clientFactory.getEventBus();

    // deal with critical errors
    eventBus.addHandler(CriticalErrorEvent.TYPE, new CriticalErrorEventHandler() {
        @Override
        public void onEvent(CriticalErrorEvent event) {
            handleError(clientFactory.getCoreMessages().errorTitleDefault(), event.getMessage(),
                    event.getThrowable());
        }
    });

    // deal with information events
    eventBus.addHandler(InformationEvent.TYPE, new InformationEventHandler() {
        @Override
        public void onEvent(InformationEvent event) {
            handleInformation(event.getTitle(), event.getMessage());
        }
    });

    // deal with confirmations
    eventBus.addHandler(ConfirmationEvent.TYPE, new ConfirmationEventHandler() {
        @Override
        public void onEvent(ConfirmationEvent event) {
            handleConfirmation(event.getTitle(), event.getMessage(), event.getConfirmationButtonText(),
                    event.getConfirmationHandler(), event.getCancelButtonText(), event.getCancelHandler());
        }
    });

    // handle login & logout
    eventBus.addHandler(AuthenticatedEvent.TYPE, new AuthenticatedEventHandler() {
        @Override
        public void onEvent(AuthenticatedEvent event) {
            final ClientContext clientContext = event.getClientContext();
            clientFactory.setClientContext(clientContext);

            LOG.info("User authenticated as " + clientContext.getLoggedInPerson().getUsername()
                    + " with roles: "
                    + (clientContext.getRoles() != null ? Arrays.asList(clientContext.getRoles()) : "[NONE]"));

            // we're authenticated, time for bootstrapping the rest of the application
            eventBus.fireEvent(new BootstrapEvent(clientContext));
        }
    });

    // handle updates to the window title
    eventBus.addHandler(SetWindowTitleEvent.TYPE, new SetWindowTitleEventHandler() {
        @Override
        public void onEvent(SetWindowTitleEvent event) {
            LOG.info("Setting window.title to " + event.getTitle());
            Window.setTitle(event.getTitle());
        }
    });

    // add notification events
    eventBus.addHandler(NotificationEvent.TYPE, new NotificationEventHandler() {
        @Override
        public void onEvent(NotificationEvent event) {
            LOG.info("Showing notification: '" + event.getMessage() + "' for " + event.getDuration()
                    + " seconds.");
            handleNotification(event.getMessage(), event.getDuration());
        }
    });

    // handle browser window resizing
    Window.addResizeHandler(new ResizeHandler() {
        @Override
        public void onResize(ResizeEvent event) {
            clientFactory.getScheduler().scheduleDeferred(new Command() {
                @Override
                public void execute() {
                    eventBus.fireEvent(new org.nsesa.editor.gwt.core.client.event.ResizeEvent(
                            Window.getClientHeight(), Window.getClientWidth()));
                }
            });
        }
    });

    // handle locale change requests
    eventBus.addHandler(LocaleChangeEvent.TYPE, new LocaleChangeEventHandler() {
        @Override
        public void onEvent(LocaleChangeEvent event) {
            LOG.info("Changing UI language to " + event.getLocale());
            Window.Location.assign(Window.Location.createUrlBuilder()
                    .setParameter(LocaleInfo.getLocaleQueryParam(), event.getLocale()).buildString());
        }
    });
}

From source file:org.onebusaway.webapp.gwt.common.layout.BoxLayoutManager.java

License:Apache License

public BoxLayoutManager() {
    Window.addResizeHandler(_handler);
}

From source file:org.onebusaway.webapp.gwt.common.widgets.MapWidgetMaxSizeResizeHandler.java

License:Apache License

public static Widget registerHandler(Widget parent, MapWidget map) {

    DivPanel mapPanel = new DivPanel();
    mapPanel.setSize("100%", "100%");
    mapPanel.add(map);//from   ww w .j a  v a 2s . co m

    map.setSize("100%", "100%");

    final MapWidgetMaxSizeResizeHandler handler = new MapWidgetMaxSizeResizeHandler(parent, mapPanel, map);
    DeferredCommand.addCommand(new Command() {

        public void execute() {
            ResizeEvent event = new ResizeEventImpl(Window.getClientWidth(), Window.getClientHeight());
            handler.onResize(event);
            Window.addResizeHandler(handler);
        }
    });

    return mapPanel;
}

From source file:org.onesocialweb.gwt.client.ui.dialog.AbstractDialog.java

License:Apache License

public AbstractDialog() {
    // set styles
    this.setStylePrimaryName("dialog");

    this.setModal(true);

    Window.addResizeHandler(new ResizeHandler() {
        public void onResize(ResizeEvent event) {
            // make sure dialog is always centered
            if (isShowing())
                center();//ww w  . j  av a 2  s . c  om
        }
    });

}

From source file:org.onesocialweb.gwt.client.ui.dialog.PicturePreviewDialog.java

License:Apache License

@Override
protected void onShow() {
    updateSize();/*from  ww w.  j av  a  2  s .  c o m*/
    // handlers
    resizehandler = Window.addResizeHandler(new ResizeHandler() {
        public void onResize(ResizeEvent event) {
            updateSize();
        }
    });
}

From source file:org.onesocialweb.gwt.client.ui.window.AbstractWindow.java

License:Apache License

public void show() {
    // If already shown, we don't do anything
    if (isShown)//from  ww  w . j a  v a  2  s  . co m
        return;

    if (isAttached()) {
        // Let the implementing class know that we will be shown
        onShow();

        // Add resize handler
        handlerRegistration = Window.addResizeHandler(resizeHandler);

        // Register our task observer
        TaskMonitor.getInstance().registerEventHandler(taskObserver);

        // Update the taskbar with ongoig task if any
        List<TaskInfo> tasks = TaskMonitor.getInstance().getTasks();
        if (!tasks.isEmpty()) {
            taskObserver.setCurrentTask(tasks.get(tasks.size() - 1));
        }

        // Force a repaint
        repaint();

        // Display the window elements
        setVisible(true);

        // Keep track that we are now being shown
        isShown = true;
    }
}